From 198be845897a79ba350ae7f93db536ddb2eccfb2 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 21 Aug 2007 09:37:23 +0000 Subject: [PATCH] Applied patch [ 1701723 ] wxAUI: Added event for doubleclicks on the tabbar bg git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48264 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/aui/auibook.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index 365339947c..e1b60c3e02 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -50,6 +50,7 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG) DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_END_DRAG) DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION) DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK) DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE) DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP) DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN) @@ -2135,7 +2136,7 @@ BEGIN_EVENT_TABLE(wxAuiTabCtrl, wxControl) EVT_ERASE_BACKGROUND(wxAuiTabCtrl::OnEraseBackground) EVT_SIZE(wxAuiTabCtrl::OnSize) EVT_LEFT_DOWN(wxAuiTabCtrl::OnLeftDown) - EVT_LEFT_DCLICK(wxAuiTabCtrl::OnLeftDown) + EVT_LEFT_DCLICK(wxAuiTabCtrl::OnLeftDClick) EVT_LEFT_UP(wxAuiTabCtrl::OnLeftUp) EVT_MIDDLE_DOWN(wxAuiTabCtrl::OnMiddleDown) EVT_MIDDLE_UP(wxAuiTabCtrl::OnMiddleUp) @@ -2328,6 +2329,18 @@ void wxAuiTabCtrl::OnRightDown(wxMouseEvent& evt) GetEventHandler()->ProcessEvent(e); } +void wxAuiTabCtrl::OnLeftDClick(wxMouseEvent& evt) +{ + wxWindow* wnd; + wxAuiTabContainerButton* button; + if (!TabHitTest(evt.m_x, evt.m_y, &wnd) && !ButtonHitTest(evt.m_x, evt.m_y, &button)) + { + wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, m_windowId); + e.SetEventObject(this); + GetEventHandler()->ProcessEvent(e); + } +} + void wxAuiTabCtrl::OnMotion(wxMouseEvent& evt) { wxPoint pos = evt.GetPosition(); @@ -2702,6 +2715,9 @@ BEGIN_EVENT_TABLE(wxAuiNotebook, wxControl) EVT_COMMAND_RANGE(wxAuiBaseTabCtrlId, wxAuiBaseTabCtrlId+500, wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP, wxAuiNotebook::OnTabRightUp) + EVT_COMMAND_RANGE(wxAuiBaseTabCtrlId, wxAuiBaseTabCtrlId+500, + wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, + wxAuiNotebook::OnTabBgDClick) EVT_NAVIGATION_KEY(wxAuiNotebook::OnNavigationKeyNotebook) #ifdef wxHAS_NATIVE_TAB_TRAVERSAL @@ -3563,6 +3579,14 @@ void wxAuiNotebook::OnTabClicked(wxCommandEvent& command_evt) SetSelectionToWindow(wnd); } +void wxAuiNotebook::OnTabBgDClick(wxCommandEvent& WXUNUSED(evt)) +{ + // notify owner that the tabbar background has been double-clicked + wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, m_windowId); + e.SetEventObject(this); + GetEventHandler()->ProcessEvent(e); +} + void wxAuiNotebook::OnTabBeginDrag(wxCommandEvent&) { m_last_drag_x = 0;