From d92f353ce96bb452fb62ce6dc1e570e85e0df5e9 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 21 Aug 2007 08:55:48 +0000 Subject: [PATCH] Applied patch [ 1675084 ] wxAUI - Added events to be notified after drag and close git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48257 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/aui/auibook.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index 97b223c14e..1cc7df0cfd 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -42,6 +42,7 @@ WX_DEFINE_OBJARRAY(wxAuiNotebookPageArray) WX_DEFINE_OBJARRAY(wxAuiTabContainerButtonArray) DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE) +DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED) DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING) DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED) DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_BUTTON) @@ -49,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_DRAG_DONE) DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_UP) DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_TAB_MIDDLE_DOWN) DEFINE_EVENT_TYPE(wxEVT_COMMAND_AUINOTEBOOK_TAB_RIGHT_UP) @@ -3823,6 +3825,13 @@ void wxAuiNotebook::OnTabEndDrag(wxCommandEvent& command_evt) // set the selection in the destination tab control nb->SetSelectionToPage(page_info); + // notify owner that the tab has been dragged + wxAuiNotebookEvent e2(wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, m_windowId); + e2.SetSelection(evt.GetSelection()); + e2.SetOldSelection(evt.GetSelection()); + e2.SetEventObject(this); + GetEventHandler()->ProcessEvent(e2); + return; } } @@ -3924,6 +3933,13 @@ void wxAuiNotebook::OnTabEndDrag(wxCommandEvent& command_evt) UpdateHintWindowSize(); } + + // notify owner that the tab has been dragged + wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, m_windowId); + e.SetSelection(evt.GetSelection()); + e.SetOldSelection(evt.GetSelection()); + e.SetEventObject(this); + GetEventHandler()->ProcessEvent(e); } @@ -4150,6 +4166,8 @@ void wxAuiNotebook::OnTabButton(wxCommandEvent& command_evt) // ask owner if it's ok to close the tab wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, m_windowId); e.SetSelection(m_tabs.GetIdxFromWindow(close_wnd)); + const int idx = m_tabs.GetIdxFromWindow(close_wnd); + e.SetSelection(idx); e.SetOldSelection(evt.GetSelection()); e.SetEventObject(this); GetEventHandler()->ProcessEvent(e); @@ -4170,6 +4188,12 @@ void wxAuiNotebook::OnTabButton(wxCommandEvent& command_evt) DeletePage(main_idx); } + + // notify owner that the tab has been closed + wxAuiNotebookEvent e2(wxEVT_COMMAND_AUINOTEBOOK_PAGE_CLOSED, m_windowId); + e2.SetSelection(idx); + e2.SetEventObject(this); + GetEventHandler()->ProcessEvent(e2); } } }