]> git.saurik.com Git - wxWidgets.git/commitdiff
Create new tab at the correct location in wxAuiNotebook.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 10 Feb 2013 16:13:42 +0000 (16:13 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 10 Feb 2013 16:13:42 +0000 (16:13 +0000)
Create the new tab in wxAuiTabCtrl that was double clicked and not near the
last selected tab which could have been in another wxAuiTabCtrl.

Closes #14995.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73490 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/aui/auibook.cpp

index 1aa4b2569cf6d995885e841a1ca7d02eb73dd003..2b64833d7296a006137e7d58393383b31a8a9720 100644 (file)
@@ -2482,8 +2482,19 @@ void wxAuiNotebook::OnTabClicked(wxAuiNotebookEvent& evt)
     SetSelectionToWindow(wnd);
 }
 
-void wxAuiNotebook::OnTabBgDClick(wxAuiNotebookEvent& WXUNUSED(evt))
+void wxAuiNotebook::OnTabBgDClick(wxAuiNotebookEvent& evt)
 {
+    // select the tab ctrl which received the db click
+    int selection;
+    wxWindow* wnd;
+    wxAuiTabCtrl* ctrl = (wxAuiTabCtrl*)evt.GetEventObject();
+    if (   (ctrl != NULL)
+        && ((selection = ctrl->GetActivePage()) != wxNOT_FOUND)
+        && ((wnd = ctrl->GetWindowFromIdx(selection)) != NULL))
+    {
+        SetSelectionToWindow(wnd);
+    }
+
     // notify owner that the tabbar background has been double-clicked
     wxAuiNotebookEvent e(wxEVT_COMMAND_AUINOTEBOOK_BG_DCLICK, m_windowId);
     e.SetEventObject(this);