simplify DoSetClientSize

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46125 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2007-05-19 17:34:42 +00:00
parent ba705c09b4
commit 949ff63e2f
7 changed files with 5 additions and 90 deletions

View File

@@ -91,7 +91,6 @@ protected:
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
// override wxWindow methods to take into account tool/menu/statusbars // 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; virtual void DoGetClientSize( int *width, int *height ) const;
#if wxUSE_MENUS_NATIVE #if wxUSE_MENUS_NATIVE

View File

@@ -164,8 +164,6 @@ protected:
virtual void DoSetSize(int x, int y, virtual void DoSetSize(int x, int y,
int width, int height, int width, int height,
int sizeFlags = wxSIZE_AUTO); int sizeFlags = wxSIZE_AUTO);
virtual void DoSetClientSize(int width, int height);
virtual void DoGetClientSize( int *width, int *height ) const;
private: private:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()

View File

@@ -120,8 +120,7 @@ protected:
// common part of all ctors // common part of all ctors
void Init(); void Init();
// move the window to the specified location and resize it: this is called // move the window to the specified location and resize it
// from both DoSetSize() and DoSetClientSize()
virtual void DoMoveWindow(int x, int y, int width, int height); virtual void DoMoveWindow(int x, int y, int width, int height);
// take into account WM decorations here // take into account WM decorations here
@@ -131,11 +130,10 @@ protected:
int sizeFlags = wxSIZE_AUTO); int sizeFlags = wxSIZE_AUTO);
// override these methods to take into account tool/menu/statusbars // 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; virtual void DoGetClientSize(int *width, int *height) const;
// this method takes the size of the window not taking account of // 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); void GTKDoSetSize(int width, int height);

View File

@@ -265,55 +265,6 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const
*height = 0; *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() void wxFrame::GtkOnSize()
{ {
// avoid recursions // avoid recursions

View File

@@ -353,16 +353,6 @@ void wxMDIChildFrame::DoSetSize( int x, int y, int width, int height, int sizeFl
wxWindow::DoSetSize( x, y, width, height, sizeFlags ); 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 ) void wxMDIChildFrame::AddChild( wxWindowBase *child )
{ {
wxWindow::AddChild(child); wxWindow::AddChild(child);

View File

@@ -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, void wxTopLevelWindowGTK::DoSetSizeHints( int minW, int minH,
int maxW, int maxH, int maxW, int maxH,
int incW, int incH ) int incW, int incH )

View File

@@ -2868,25 +2868,9 @@ void wxWindowGTK::DoSetClientSize( int width, int height )
{ {
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
if (m_wxwindow) const wxSize size = GetSize();
{ const wxSize clientSize = GetClientSize();
int dw = 0; SetSize(width + (size.x - clientSize.x), height + (size.y - clientSize.y));
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);
} }
void wxWindowGTK::DoGetClientSize( int *width, int *height ) const void wxWindowGTK::DoGetClientSize( int *width, int *height ) const