Minor cleanup of wxFrame::DoGetClientSize() in wxQt

Test whether height != NULL just once and make the code slightly more
compact.
This commit is contained in:
Vadim Zeitlin
2018-06-22 14:33:26 +02:00
parent 5a877535a8
commit 175756506c

View File

@@ -170,22 +170,19 @@ void wxFrame::DoGetClientSize(int *width, int *height) const
{
wxWindow::DoGetClientSize(width, height);
// for a status bar, we must subtract it's height here
wxStatusBar *sb = GetStatusBar();
if (height && sb)
// Adjust the height, taking the status and menu bars into account, if any:
if ( height )
{
int sbh = 0;
sb->GetSize(NULL, &sbh);
*height -= sbh;
}
if ( wxStatusBar *sb = GetStatusBar() )
{
*height -= sb->GetSize().y;
}
// also for menubar , we must subtract it's height here
QMenuBar *qmb = GetQMainWindow()->menuBar();
if (height && qmb)
{
QRect geometry = qmb->geometry();
*height -= geometry.height();
if ( QMenuBar *qmb = GetQMainWindow()->menuBar() )
{
*height -= qmb->geometry().height();
}
}
}