From: Vadim Zeitlin Date: Sun, 4 Mar 2012 20:31:29 +0000 (+0000) Subject: No changes, just make wxAUI SetActivePane() a member function. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/fc5a609912bb8c692ff32e782f244c028116706f?ds=inline No changes, just make wxAUI SetActivePane() a member function. Make a global function a member one as it uses member variables and it's easier to use them directly instead of passing the object pointer to it all the time. See #14026. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70806 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/aui/framemanager.h b/include/wx/aui/framemanager.h index 98dfc1adae..4376ed6d72 100644 --- a/include/wx/aui/framemanager.h +++ b/include/wx/aui/framemanager.h @@ -594,6 +594,8 @@ protected: /// Ends a resize action, or for live update, resizes the sash bool DoEndResizeAction(wxMouseEvent& event); + void SetActivePane(wxWindow* active_pane); + public: // public events (which can be invoked externally) diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index 24e718d3d3..9f4625708f 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -59,6 +59,7 @@ wxDEFINE_EVENT( wxEVT_AUI_PANE_BUTTON, wxAuiManagerEvent ); wxDEFINE_EVENT( wxEVT_AUI_PANE_CLOSE, wxAuiManagerEvent ); wxDEFINE_EVENT( wxEVT_AUI_PANE_MAXIMIZE, wxAuiManagerEvent ); wxDEFINE_EVENT( wxEVT_AUI_PANE_RESTORE, wxAuiManagerEvent ); +wxDEFINE_EVENT( wxEVT_AUI_PANE_ACTIVATED, wxAuiManagerEvent ); wxDEFINE_EVENT( wxEVT_AUI_RENDER, wxAuiManagerEvent ); wxDEFINE_EVENT( wxEVT_AUI_FIND_MANAGER, wxAuiManagerEvent ); @@ -550,15 +551,17 @@ static void RenumberDockRows(wxAuiDockInfoPtrArray& docks) // SetActivePane() sets the active pane, as well as cycles through // every other pane and makes sure that all others' active flags // are turned off -static void SetActivePane(wxAuiPaneInfoArray& panes, wxWindow* active_pane) +void wxAuiManager::SetActivePane(wxWindow* active_pane) { int i, pane_count; - for (i = 0, pane_count = panes.GetCount(); i < pane_count; ++i) + for (i = 0, pane_count = m_panes.GetCount(); i < pane_count; ++i) { - wxAuiPaneInfo& pane = panes.Item(i); + wxAuiPaneInfo& pane = m_panes.Item(i); pane.state &= ~wxAuiPaneInfo::optionActive; if (pane.window == active_pane) + { pane.state |= wxAuiPaneInfo::optionActive; + } } } @@ -3814,7 +3817,7 @@ void wxAuiManager::OnFloatingPaneActivated(wxWindow* wnd) { if ((GetFlags() & wxAUI_MGR_ALLOW_ACTIVE_PANE) && GetPane(wnd).IsOk()) { - SetActivePane(m_panes, wnd); + SetActivePane(wnd); Repaint(); } } @@ -4127,7 +4130,7 @@ void wxAuiManager::OnLeftDown(wxMouseEvent& event) if (GetFlags() & wxAUI_MGR_ALLOW_ACTIVE_PANE) { // set the caption as active - SetActivePane(m_panes, part->pane->window); + SetActivePane(part->pane->window); Repaint(); } @@ -4737,7 +4740,7 @@ void wxAuiManager::OnChildFocus(wxChildFocusEvent& event) wxAuiPaneInfo& pane = GetPane(event.GetWindow()); if (pane.IsOk() && (pane.state & wxAuiPaneInfo::optionActive) == 0) { - SetActivePane(m_panes, event.GetWindow()); + SetActivePane(event.GetWindow()); m_frame->Refresh(); } }