X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a27c36f9652f460288a38bda44bb4c2b1a02a911..7d6a4d96961eac84d05db8bb24c64d39003f6e54:/src/aui/framemanager.cpp diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index cefa38376e..7526cf6938 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,28 @@ 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) + wxAuiPaneInfo* active_paneinfo = NULL; + 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; + active_paneinfo = &pane; + } + } + + // send the 'activated' event after all panes have been updated + if ( active_paneinfo ) + { + wxAuiManagerEvent evt(wxEVT_AUI_PANE_ACTIVATED); + evt.SetManager(this); + evt.SetPane(active_paneinfo); + ProcessMgrEvent(evt); } } @@ -808,7 +822,7 @@ void wxAuiManager::UpdateHintWindowConfig() wxWindow* w = m_frame; while (w) { - if (w->IsKindOf(CLASSINFO(wxFrame))) + if (wxDynamicCast(w, wxFrame)) { wxFrame* f = static_cast(w); can_do_transparent = f->CanSetTransparent(); @@ -899,7 +913,7 @@ void wxAuiManager::SetManagedWindow(wxWindow* wnd) // we need to add the MDI client window as the default // center pane - if (m_frame->IsKindOf(CLASSINFO(wxMDIParentFrame))) + if (wxDynamicCast(m_frame, wxMDIParentFrame)) { wxMDIParentFrame* mdi_frame = (wxMDIParentFrame*)m_frame; wxWindow* client_window = mdi_frame->GetClientWindow(); @@ -910,7 +924,7 @@ void wxAuiManager::SetManagedWindow(wxWindow* wnd) wxAuiPaneInfo().Name(wxT("mdiclient")). CenterPane().PaneBorder(false)); } - else if (m_frame->IsKindOf(CLASSINFO(wxAuiMDIParentFrame))) + else if (wxDynamicCast(m_frame, wxAuiMDIParentFrame)) { wxAuiMDIParentFrame* mdi_frame = (wxAuiMDIParentFrame*)m_frame; wxAuiMDIClientWindow* client_window = mdi_frame->GetClientWindow(); @@ -1083,7 +1097,7 @@ bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& paneInfo) if (pinfo.HasGripper()) { - if (pinfo.window->IsKindOf(CLASSINFO(wxAuiToolBar))) + if (wxDynamicCast(pinfo.window, wxAuiToolBar)) { // prevent duplicate gripper -- both wxAuiManager and wxAuiToolBar // have a gripper control. The toolbar's built-in gripper @@ -1103,7 +1117,7 @@ bool wxAuiManager::AddPane(wxWindow* window, const wxAuiPaneInfo& paneInfo) pinfo.best_size = pinfo.window->GetClientSize(); #if wxUSE_TOOLBAR - if (pinfo.window->IsKindOf(CLASSINFO(wxToolBar))) + if (wxDynamicCast(pinfo.window, wxToolBar)) { // GetClientSize() doesn't get the best size for // a toolbar under some newer versions of wxWidgets, @@ -2655,12 +2669,7 @@ void wxAuiManager::Update() if (p.rect != old_pane_rects[i]) { p.window->Refresh(); - - // under OSX the repaint events occurs almost immediately - // for the other platforms we issue an immediate repaint -#ifndef __WXOSX__ p.window->Update(); -#endif } } } @@ -3304,7 +3313,7 @@ void wxAuiManager::ShowHint(const wxRect& rect) m_hintFadeAmt = m_hintFadeMax; if ((m_flags & wxAUI_MGR_HINT_FADE) - && !((m_hintWnd->IsKindOf(CLASSINFO(wxPseudoTransparentFrame))) && + && !((wxDynamicCast(m_hintWnd, wxPseudoTransparentFrame)) && (m_flags & wxAUI_MGR_NO_VENETIAN_BLINDS_FADE)) ) m_hintFadeAmt = 0; @@ -3342,9 +3351,7 @@ void wxAuiManager::ShowHint(const wxRect& rect) // remove the last hint rectangle m_lastHint = rect; m_frame->Refresh(); -#ifdef TODO_REMOVE_IF_NO_PROBLEMS m_frame->Update(); -#endif } wxScreenDC screendc; @@ -3412,9 +3419,7 @@ void wxAuiManager::HideHint() if (!m_lastHint.IsEmpty()) { m_frame->Refresh(); -#ifdef TODO_REMOVE_IF_NO_PROBLEMS m_frame->Update(); -#endif m_lastHint = wxRect(); } } @@ -3688,9 +3693,7 @@ void wxAuiManager::OnFloatingPaneMoving(wxWindow* wnd, wxDirection dir) // reduces flicker -#ifdef TODO_REMOVE_IF_NO_PROBLEMS m_frame->Update(); -#endif } void wxAuiManager::OnFloatingPaneMoved(wxWindow* wnd, wxDirection dir) @@ -3825,7 +3828,7 @@ void wxAuiManager::OnFloatingPaneActivated(wxWindow* wnd) { if ((GetFlags() & wxAUI_MGR_ALLOW_ACTIVE_PANE) && GetPane(wnd).IsOk()) { - SetActivePane(m_panes, wnd); + SetActivePane(wnd); Repaint(); } } @@ -3898,13 +3901,11 @@ void wxAuiManager::Render(wxDC* dc) void wxAuiManager::Repaint(wxDC* dc) { -#ifdef __WXMAC__ */ +#ifdef __WXMAC__ if ( dc == NULL ) { m_frame->Refresh() ; -#ifdef TODO_REMOVE_IF_NO_PROBLEMS m_frame->Update() ; -#endif return ; } #endif @@ -3958,7 +3959,7 @@ void wxAuiManager::OnSize(wxSizeEvent& event) Repaint(); #if wxUSE_MDI - if (m_frame->IsKindOf(CLASSINFO(wxMDIParentFrame))) + if (wxDynamicCast(m_frame, wxMDIParentFrame)) { // for MDI parent frames, this event must not // be "skipped". In other words, the parent frame @@ -3982,7 +3983,7 @@ void wxAuiManager::OnFindManager(wxAuiManagerEvent& evt) } // if we are managing a child frame, get the 'real' manager - if (window->IsKindOf(CLASSINFO(wxAuiFloatingFrame))) + if (wxDynamicCast(window, wxAuiFloatingFrame)) { wxAuiFloatingFrame* float_frame = static_cast(window); evt.SetManager(float_frame->GetOwnerManager()); @@ -4125,7 +4126,7 @@ void wxAuiManager::OnLeftDown(wxMouseEvent& event) if (part->pane && part->pane->window && managed_wnd && - managed_wnd->IsKindOf(CLASSINFO(wxAuiFloatingFrame))) + wxDynamicCast(managed_wnd, wxAuiFloatingFrame)) { wxAuiFloatingFrame* floating_frame = (wxAuiFloatingFrame*)managed_wnd; wxAuiManager* owner_mgr = floating_frame->GetOwnerManager(); @@ -4140,7 +4141,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(); } @@ -4210,7 +4211,7 @@ bool wxAuiManager::DoEndResizeAction(wxMouseEvent& event) #if wxUSE_STATUSBAR // if there's a status control, the available // height decreases accordingly - if (m_frame && m_frame->IsKindOf(CLASSINFO(wxFrame))) + if (wxDynamicCast(m_frame, wxFrame)) { wxFrame* frame = static_cast(m_frame); wxStatusBar* status = frame->GetStatusBar(); @@ -4639,7 +4640,7 @@ void wxAuiManager::OnMotion(wxMouseEvent& event) // We can't move the child window so we need to get the frame that // we want to be really moving. This is probably not the best place // to do this but at least it fixes the bug (#13177) for now. - if (!m_actionWindow->IsKindOf(CLASSINFO(wxAuiFloatingFrame))) + if (!wxDynamicCast(m_actionWindow, wxAuiFloatingFrame)) { wxAuiPaneInfo& pane = GetPane(m_actionWindow); m_actionWindow = pane.frame; @@ -4750,7 +4751,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(); } }