From: Julian Smart Date: Tue, 29 Aug 2000 16:09:59 +0000 (+0000) Subject: Sash window layout algorithm now fails if not enough space to complete. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/8c023dee921d6ce6f8a849c269b5622f111a0503 Sash window layout algorithm now fails if not enough space to complete. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8209 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/laywin.cpp b/src/generic/laywin.cpp index 2d0702f53c..b418869ad2 100644 --- a/src/generic/laywin.cpp +++ b/src/generic/laywin.cpp @@ -270,6 +270,7 @@ bool wxLayoutAlgorithm::LayoutWindow(wxWindow* parent, wxWindow* mainWindow) node = node->Next(); } + // Now do a dummy run to see if we have any space left for the final window (fail if not) node = parent->GetChildren().First(); while (node) { @@ -277,7 +278,31 @@ bool wxLayoutAlgorithm::LayoutWindow(wxWindow* parent, wxWindow* mainWindow) // If mainWindow is NULL and we're at the last window, // skip this, because we'll simply make it fit the remaining space. - if ((win != mainWindow) && (mainWindow != NULL || win != lastAwareWindow)) + if (win->IsShown() && (win != mainWindow) && (mainWindow != NULL || win != lastAwareWindow)) + { + event.SetId(win->GetId()); + event.SetEventObject(win); + event.SetFlags(wxLAYOUT_QUERY); + + win->GetEventHandler()->ProcessEvent(event); + } + + node = node->Next(); + } + + if (event.GetRect().GetWidth() < 0 || event.GetRect().GetHeight() < 0) + return FALSE; + + event.SetRect(rect); + + node = parent->GetChildren().First(); + while (node) + { + wxWindow* win = (wxWindow*) node->Data(); + + // If mainWindow is NULL and we're at the last window, + // skip this, because we'll simply make it fit the remaining space. + if (win->IsShown() && (win != mainWindow) && (mainWindow != NULL || win != lastAwareWindow)) { event.SetId(win->GetId()); event.SetEventObject(win);