From ceee16c01a884bb073f0e42fa62b242f6a3ba127 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 12 May 2018 23:57:42 +0200 Subject: [PATCH] Remove sizing hacks from wxAuiMDIChildFrame There doesn't seem to be any reason for overriding DoSetSize() and DoMoveWindow(), so just stop doing it. Notice that this was already changed for wxGTK many years ago in a94476deb9c1a778001aeb84e6e95df719c9bc17 and there is no reason to use different code wxGTK and other ports. --- include/wx/aui/tabmdi.h | 5 ----- src/aui/auibook.cpp | 8 -------- src/aui/tabmdi.cpp | 35 ----------------------------------- 3 files changed, 48 deletions(-) diff --git a/include/wx/aui/tabmdi.h b/include/wx/aui/tabmdi.h index bcbb2f5cad..842e9dd805 100644 --- a/include/wx/aui/tabmdi.h +++ b/include/wx/aui/tabmdi.h @@ -162,8 +162,6 @@ public: protected: void Init(); - virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags) wxOVERRIDE; - virtual void DoMoveWindow(int x, int y, int width, int height) wxOVERRIDE; public: // This function needs to be called when a size change is confirmed, @@ -174,8 +172,6 @@ public: protected: wxAuiMDIParentFrame* m_pMDIParentFrame; - wxRect m_mdiNewRect; - wxRect m_mdiCurRect; wxIcon m_icon; wxIconBundle m_iconBundle; bool m_activateOnCreate; @@ -218,7 +214,6 @@ protected: void PageChanged(int oldSelection, int newSelection); void OnPageClose(wxAuiNotebookEvent& evt); void OnPageChanged(wxAuiNotebookEvent& evt); - void OnSize(wxSizeEvent& evt); private: wxDECLARE_DYNAMIC_CLASS(wxAuiMDIClientWindow); diff --git a/src/aui/auibook.cpp b/src/aui/auibook.cpp index d7f5d5e57b..f01a58c46b 100644 --- a/src/aui/auibook.cpp +++ b/src/aui/auibook.cpp @@ -1595,14 +1595,6 @@ public: } // TODO: else if (GetFlags() & wxAUI_NB_LEFT){} // TODO: else if (GetFlags() & wxAUI_NB_RIGHT){} - -#if wxUSE_MDI - if (wxDynamicCast(page.window, wxAuiMDIChildFrame)) - { - wxAuiMDIChildFrame* wnd = (wxAuiMDIChildFrame*)page.window; - wnd->ApplyMDIChildFrameRect(); - } -#endif } } diff --git a/src/aui/tabmdi.cpp b/src/aui/tabmdi.cpp index 7d416987b9..30a781cbc8 100644 --- a/src/aui/tabmdi.cpp +++ b/src/aui/tabmdi.cpp @@ -722,32 +722,6 @@ void wxAuiMDIChildFrame::DoShow(bool show) wxWindow::Show(show); } -void wxAuiMDIChildFrame::DoSetSize(int x, int y, int width, int height, int sizeFlags) -{ - m_mdiNewRect = wxRect(x, y, width, height); -#ifdef __WXGTK__ - wxWindow::DoSetSize(x,y,width, height, sizeFlags); -#else - wxUnusedVar(sizeFlags); -#endif -} - -void wxAuiMDIChildFrame::DoMoveWindow(int x, int y, int width, int height) -{ - m_mdiNewRect = wxRect(x, y, width, height); -} - -void wxAuiMDIChildFrame::ApplyMDIChildFrameRect() -{ - if (m_mdiCurRect != m_mdiNewRect) - { - wxWindow::DoMoveWindow(m_mdiNewRect.x, m_mdiNewRect.y, - m_mdiNewRect.width, m_mdiNewRect.height); - m_mdiCurRect = m_mdiNewRect; - } -} - - //----------------------------------------------------------------------------- // wxAuiMDIClientWindow //----------------------------------------------------------------------------- @@ -757,7 +731,6 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxAuiMDIClientWindow, wxAuiNotebook); wxBEGIN_EVENT_TABLE(wxAuiMDIClientWindow, wxAuiNotebook) EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, wxAuiMDIClientWindow::OnPageChanged) EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, wxAuiMDIClientWindow::OnPageClose) - EVT_SIZE(wxAuiMDIClientWindow::OnSize) wxEND_EVENT_TABLE() wxAuiMDIClientWindow::wxAuiMDIClientWindow() @@ -874,13 +847,5 @@ void wxAuiMDIClientWindow::OnPageChanged(wxAuiNotebookEvent& evt) PageChanged(evt.GetOldSelection(), evt.GetSelection()); } -void wxAuiMDIClientWindow::OnSize(wxSizeEvent& evt) -{ - wxAuiNotebook::OnSize(evt); - - for (size_t pos = 0; pos < GetPageCount(); pos++) - ((wxAuiMDIChildFrame *)GetPage(pos))->ApplyMDIChildFrameRect(); -} - #endif //wxUSE_AUI #endif // wxUSE_MDI