// default resizing behaviour - if only ONE subwindow, resize to fill the // whole client area void wxTopLevelWindowBase::DoLayout() { // if we're using constraints or sizers - do use them if ( GetAutoLayout() ) { Layout(); } else { // do we have _exactly_ one child? wxWindow *child = (wxWindow *)NULL; for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext() ) { wxWindow *win = node->GetData(); // exclude top level and managed windows (status bar isn't // currently in the children list except under wxMac anyhow, but // it makes no harm to test for it) if ( !win->IsTopLevel() && !IsOneOfBars(win) ) { if ( child ) { return; // it's our second subwindow - nothing to do } child = win; } } // do we have any children at all? if ( child ) { // exactly one child - set it's size to fill the whole frame int clientW, clientH; DoGetClientSize(&clientW, &clientH); // for whatever reasons, wxGTK wants to have a small offset - it // probably looks better with it? #ifdef __WXGTK__ static const int ofs = 1; #else static const int ofs = 0; #endif child->SetSize(ofs, ofs, clientW - 2*ofs, clientH - 2*ofs); } } }
// default resizing behaviour - if only ONE subwindow, resize to fill the // whole client area void wxTopLevelWindowBase::DoLayout() { // if we're using constraints or sizers - do use them if ( GetAutoLayout() ) { Layout(); } else { // do we have _exactly_ one child? wxWindow *child = NULL; for ( wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); node; node = node->GetNext() ) { wxWindow *win = node->GetData(); // exclude top level and managed windows (status bar isn't // currently in the children list except under wxMac anyhow, but // it makes no harm to test for it) if ( !win->IsTopLevel() && !IsOneOfBars(win) ) { if ( child ) { return; // it's our second subwindow - nothing to do } child = win; } } // do we have any children at all? if ( child && child->IsShown() ) { // exactly one child - set it's size to fill the whole frame int clientW, clientH; DoGetClientSize(&clientW, &clientH); child->SetSize(0, 0, clientW, clientH); } } }