From 949ff63e2f81719cd47a6c6b26047ee57c0aa052 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sat, 19 May 2007 17:34:42 +0000 Subject: [PATCH] simplify DoSetClientSize git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46125 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/frame.h | 1 - include/wx/gtk/mdi.h | 2 -- include/wx/gtk/toplevel.h | 6 ++--- src/gtk/frame.cpp | 49 --------------------------------------- src/gtk/mdi.cpp | 10 -------- src/gtk/toplevel.cpp | 5 ---- src/gtk/window.cpp | 22 +++--------------- 7 files changed, 5 insertions(+), 90 deletions(-) diff --git a/include/wx/gtk/frame.h b/include/wx/gtk/frame.h index c052cd6388..9265754229 100644 --- a/include/wx/gtk/frame.h +++ b/include/wx/gtk/frame.h @@ -91,7 +91,6 @@ protected: #endif // wxUSE_STATUSBAR // override wxWindow methods to take into account tool/menu/statusbars - virtual void DoSetClientSize(int width, int height); virtual void DoGetClientSize( int *width, int *height ) const; #if wxUSE_MENUS_NATIVE diff --git a/include/wx/gtk/mdi.h b/include/wx/gtk/mdi.h index 5ce91c006e..ee20c378be 100644 --- a/include/wx/gtk/mdi.h +++ b/include/wx/gtk/mdi.h @@ -164,8 +164,6 @@ protected: virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO); - virtual void DoSetClientSize(int width, int height); - virtual void DoGetClientSize( int *width, int *height ) const; private: DECLARE_EVENT_TABLE() diff --git a/include/wx/gtk/toplevel.h b/include/wx/gtk/toplevel.h index fcc7ff9871..7c0998c7df 100644 --- a/include/wx/gtk/toplevel.h +++ b/include/wx/gtk/toplevel.h @@ -120,8 +120,7 @@ protected: // common part of all ctors void Init(); - // move the window to the specified location and resize it: this is called - // from both DoSetSize() and DoSetClientSize() + // move the window to the specified location and resize it virtual void DoMoveWindow(int x, int y, int width, int height); // take into account WM decorations here @@ -131,11 +130,10 @@ protected: int sizeFlags = wxSIZE_AUTO); // override these methods to take into account tool/menu/statusbars - virtual void DoSetClientSize(int width, int height); virtual void DoGetClientSize(int *width, int *height) const; // this method takes the size of the window not taking account of - // decorations and is used by both DoSetSize() and DoSetClientSize() + // decorations void GTKDoSetSize(int width, int height); diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index 027d3bf090..754e601fc5 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -265,55 +265,6 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const *height = 0; } -void wxFrame::DoSetClientSize( int width, int height ) -{ - wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); - -#if wxUSE_MENUS_NATIVE - // menu bar - if (m_frameMenuBar && !(m_fsIsShowing && (m_fsSaveFlag & wxFULLSCREEN_NOMENUBAR) != 0)) - { - if (!m_menuBarDetached) - height += m_menuBarHeight; - else - height += wxPLACE_HOLDER; - } -#endif // wxUSE_MENUS_NATIVE - -#if wxUSE_STATUSBAR - // status bar - if (m_frameStatusBar && m_frameStatusBar->IsShown() && - !(m_fsIsShowing && (m_fsSaveFlag & wxFULLSCREEN_NOSTATUSBAR) != 0)) - height += wxSTATUS_HEIGHT; -#endif - -#if wxUSE_TOOLBAR - // tool bar - if (m_frameToolBar && m_frameToolBar->IsShown()) - { - if (m_toolBarDetached) - { - height += wxPLACE_HOLDER; - } - else - { - int x, y; - m_frameToolBar->GetSize( &x, &y ); - if ( m_frameToolBar->IsVertical() ) - { - width += x; - } - else - { - height += y; - } - } - } -#endif - - wxTopLevelWindow::DoSetClientSize( width, height ); -} - void wxFrame::GtkOnSize() { // avoid recursions diff --git a/src/gtk/mdi.cpp b/src/gtk/mdi.cpp index df17918271..51027b628d 100644 --- a/src/gtk/mdi.cpp +++ b/src/gtk/mdi.cpp @@ -353,16 +353,6 @@ void wxMDIChildFrame::DoSetSize( int x, int y, int width, int height, int sizeFl wxWindow::DoSetSize( x, y, width, height, sizeFlags ); } -void wxMDIChildFrame::DoSetClientSize(int width, int height) -{ - wxWindow::DoSetClientSize( width, height ); -} - -void wxMDIChildFrame::DoGetClientSize( int *width, int *height ) const -{ - wxWindow::DoGetClientSize( width, height ); -} - void wxMDIChildFrame::AddChild( wxWindowBase *child ) { wxWindow::AddChild(child); diff --git a/src/gtk/toplevel.cpp b/src/gtk/toplevel.cpp index 77e2dd6083..16588492bf 100644 --- a/src/gtk/toplevel.cpp +++ b/src/gtk/toplevel.cpp @@ -977,11 +977,6 @@ void wxTopLevelWindowGTK::DoGetClientSize( int *width, int *height ) const } } -void wxTopLevelWindowGTK::DoSetClientSize( int width, int height ) -{ - GTKDoSetSize(width + m_miniEdge*2, height + m_miniEdge*2 + m_miniTitle); -} - void wxTopLevelWindowGTK::DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH ) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index d88e7964eb..0b1aff6fa8 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2868,25 +2868,9 @@ void wxWindowGTK::DoSetClientSize( int width, int height ) { wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); - if (m_wxwindow) - { - int dw = 0; - int dh = 0; - - if (m_hasScrolling) - { - GetScrollbarWidth(m_widget, dw, dh); - } - - const int border = GTK_CONTAINER(m_wxwindow)->border_width; - dw += 2 * border; - dh += 2 * border; - - width += dw; - height += dh; - } - - SetSize(width, height); + const wxSize size = GetSize(); + const wxSize clientSize = GetClientSize(); + SetSize(width + (size.x - clientSize.x), height + (size.y - clientSize.y)); } void wxWindowGTK::DoGetClientSize( int *width, int *height ) const -- 2.45.2