wxFrame::OnSize() slightly optimized (the behaviour is the same as before)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@239 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -749,47 +749,36 @@ bool wxFrame::MSWProcessMessage(WXMSG* pMsg)
|
|||||||
// resize to client rectangle size
|
// resize to client rectangle size
|
||||||
void wxFrame::OnSize(wxSizeEvent& event)
|
void wxFrame::OnSize(wxSizeEvent& event)
|
||||||
{
|
{
|
||||||
// Search for a child which is a subwindow, not another frame.
|
// if we're using constraints - do use them
|
||||||
|
#if USE_CONSTRAINTS
|
||||||
|
if ( GetAutoLayout() ) {
|
||||||
|
Layout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// do we have _exactly_ one child?
|
||||||
wxWindow *child = NULL;
|
wxWindow *child = NULL;
|
||||||
// Count the number of _subwindow_ children
|
|
||||||
int noChildren = 0;
|
|
||||||
for ( wxNode *node = GetChildren()->First(); node; node = node->Next() )
|
for ( wxNode *node = GetChildren()->First(); node; node = node->Next() )
|
||||||
{
|
{
|
||||||
wxWindow *win = (wxWindow *)node->Data();
|
wxWindow *win = (wxWindow *)node->Data();
|
||||||
if (!win->IsKindOf(CLASSINFO(wxFrame)) && !win->IsKindOf(CLASSINFO(wxDialog))
|
if ( !win->IsKindOf(CLASSINFO(wxFrame)) &&
|
||||||
&& (win != GetStatusBar()))
|
!win->IsKindOf(CLASSINFO(wxDialog)) &&
|
||||||
|
(win != GetStatusBar()) )
|
||||||
{
|
{
|
||||||
child = win;
|
|
||||||
noChildren ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If not one child, call the Layout function if compiled in
|
|
||||||
if (!child || (noChildren > 1)
|
|
||||||
#if USE_CONSTRAINTS
|
|
||||||
|| GetAutoLayout()
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
|
||||||
#if USE_CONSTRAINTS
|
|
||||||
if (GetAutoLayout())
|
|
||||||
Layout();
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( child )
|
if ( child )
|
||||||
{
|
return; // it's our second subwindow - nothing to do
|
||||||
int client_x, client_y;
|
child = win;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if WXDEBUG > 1
|
if ( child ) {
|
||||||
wxDebugMsg("wxFrame::OnSize: about to set the child's size.\n");
|
// we have exactly one child - set it's size to fill the whole frame
|
||||||
#endif
|
int client_x, client_y;
|
||||||
|
|
||||||
GetClientSize(&client_x, &client_y);
|
GetClientSize(&client_x, &client_y);
|
||||||
child->SetSize(0, 0, client_x, client_y);
|
child->SetSize(0, 0, client_x, client_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default activation behaviour - set the focus for the first child
|
// Default activation behaviour - set the focus for the first child
|
||||||
|
Reference in New Issue
Block a user