simplify client size calculation

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46129 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2007-05-20 02:35:15 +00:00
parent ab7eba4c38
commit e36a8aff9a

View File

@@ -209,52 +209,40 @@ void wxFrame::DoGetClientSize( int *width, int *height ) const
{ {
wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") ); wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
wxTopLevelWindow::DoGetClientSize( width, height ); wxFrameBase::DoGetClientSize(width, height);
if (height) if (height)
{ {
#if wxUSE_MENUS_NATIVE #if wxUSE_MENUS_NATIVE
// menu bar // menu bar
if (m_frameMenuBar && !(m_fsIsShowing && (m_fsSaveFlag & wxFULLSCREEN_NOMENUBAR) != 0)) if (m_frameMenuBar &&
GTK_WIDGET_VISIBLE(m_frameMenuBar->m_widget) && !m_menuBarDetached)
{ {
if (!m_menuBarDetached) *height -= m_menuBarHeight;
(*height) -= m_menuBarHeight;
else
(*height) -= wxPLACE_HOLDER;
} }
#endif // wxUSE_MENUS_NATIVE #endif // wxUSE_MENUS_NATIVE
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
// status bar // status bar
if (m_frameStatusBar && m_frameStatusBar->IsShown() && if (m_frameStatusBar && GTK_WIDGET_VISIBLE(m_frameStatusBar->m_widget))
!(m_fsIsShowing && (m_fsSaveFlag & wxFULLSCREEN_NOSTATUSBAR) != 0)) *height -= wxSTATUS_HEIGHT;
(*height) -= wxSTATUS_HEIGHT;
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
} }
#if wxUSE_TOOLBAR #if wxUSE_TOOLBAR
// tool bar // tool bar
if (m_frameToolBar && m_frameToolBar->IsShown()) if (m_frameToolBar &&
GTK_WIDGET_VISIBLE(m_frameToolBar->m_widget) && !m_toolBarDetached)
{ {
if (m_toolBarDetached) if (m_frameToolBar->IsVertical())
{ {
if (height != NULL) if (width)
*height -= wxPLACE_HOLDER; *width -= m_frameToolBar->GetSize().x;
} }
else else
{ {
int x, y; if (height)
m_frameToolBar->GetSize( &x, &y ); *height -= m_frameToolBar->GetSize().y;
if ( m_frameToolBar->IsVertical() )
{
if (width != NULL)
*width -= x;
}
else
{
if (height != NULL)
*height -= y;
}
} }
} }
#endif // wxUSE_TOOLBAR #endif // wxUSE_TOOLBAR