From f2f0e4bea115b95ce6cc2b93c17b6d790ebe9cd0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 15 Aug 2012 23:34:31 +0000 Subject: [PATCH] Fix AUI appearance when a maximized pane becomes floating. The other panes were not previously restored, resulting in bad appearance and behaviour. Do restore them now before making the previous maximized pane floating. Closes #14460. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72346 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/aui/framemanager.cpp | 30 ++++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index f3e736c6be..70ae91854f 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -538,6 +538,7 @@ All (GUI): - Add possibility to hide and show again wxRibbonBar pages (wxBen). - Add expand/collapse button to wxRibbonBar (rakeshthp). - Fix item data access in wxDataViewListCtrl (Kry). +- Fix problem with floating maximized AUI panes (Laurent Poujoulat). wxGTK: diff --git a/src/aui/framemanager.cpp b/src/aui/framemanager.cpp index 7526cf6938..30ca612af4 100644 --- a/src/aui/framemanager.cpp +++ b/src/aui/framemanager.cpp @@ -4793,7 +4793,7 @@ void wxAuiManager::OnPaneButton(wxAuiManagerEvent& evt) } else if (evt.button == wxAUI_BUTTON_MAXIMIZE_RESTORE && !pane.IsMaximized()) { - // fire pane close event + // fire pane maximize event wxAuiManagerEvent e(wxEVT_AUI_PANE_MAXIMIZE); e.SetManager(this); e.SetPane(evt.pane); @@ -4807,7 +4807,7 @@ void wxAuiManager::OnPaneButton(wxAuiManagerEvent& evt) } else if (evt.button == wxAUI_BUTTON_MAXIMIZE_RESTORE && pane.IsMaximized()) { - // fire pane close event + // fire pane restore event wxAuiManagerEvent e(wxEVT_AUI_PANE_RESTORE); e.SetManager(this); e.SetPane(evt.pane); @@ -4819,11 +4819,29 @@ void wxAuiManager::OnPaneButton(wxAuiManagerEvent& evt) Update(); } } - else if (evt.button == wxAUI_BUTTON_PIN) + else if (evt.button == wxAUI_BUTTON_PIN && + (m_flags & wxAUI_MGR_ALLOW_FLOATING) && pane.IsFloatable()) { - if ((m_flags & wxAUI_MGR_ALLOW_FLOATING) && - pane.IsFloatable()) - pane.Float(); + if (pane.IsMaximized()) + { + // If the pane is maximized, the original state must be restored + // before trying to float the pane, otherwise the other panels + // wouldn't appear correctly when it becomes floating. + wxAuiManagerEvent e(wxEVT_AUI_PANE_RESTORE); + e.SetManager(this); + e.SetPane(evt.pane); + ProcessMgrEvent(e); + + if (e.GetVeto()) + { + // If it can't be restored, it can't be floated neither. + return; + } + + RestorePane(pane); + } + + pane.Float(); Update(); } } -- 2.45.2