X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4223cec504c3699f5986f5b6b8e9fd42e7fea6b2..686ca1b5d4867bca6c82a82078fd26291c6e6659:/src/generic/collpaneg.cpp diff --git a/src/generic/collpaneg.cpp b/src/generic/collpaneg.cpp index cded9aef40..8985914aa1 100644 --- a/src/generic/collpaneg.cpp +++ b/src/generic/collpaneg.cpp @@ -17,11 +17,14 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" +#include "wx/collpane.h" + #ifndef WX_PRECOMP + #include "wx/toplevel.h" #include "wx/button.h" + #include "wx/sizer.h" #endif // !WX_PRECOMP -#include "wx/collpane.h" #include "wx/statline.h" // ---------------------------------------------------------------------------- @@ -108,8 +111,9 @@ void wxGenericCollapsiblePane::OnStateChange(const wxSize& sz) SetMinSize(sz); SetSize(sz); - wxWindow *top = wxGetTopLevelParent(this); - if (top) + wxTopLevelWindow * + top = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow); + if ( top ) { // we've changed our size, thus our top level parent needs to relayout // itself @@ -130,17 +134,22 @@ void wxGenericCollapsiblePane::OnStateChange(const wxSize& sz) #endif top->GetSizer()->SetSizeHints(top); - if (IsCollapsed()) - { - // use SetClientSize() and not SetSize() otherwise the size for - // e.g. a wxFrame with a menubar wouldn't be correctly set - top->SetClientSize(sz); - } - else + + // we shouldn't attempt to resize a maximized window, whatever happens + if ( !top->IsMaximized() ) { - // force our parent to "fit", i.e. expand so that it can honour - // our minimal size - top->Fit(); + if ( IsCollapsed() ) + { + // use SetClientSize() and not SetSize() otherwise the size for + // e.g. a wxFrame with a menubar wouldn't be correctly set + top->SetClientSize(sz); + } + else + { + // force our parent to "fit", i.e. expand so that it can honour + // our minimal size + top->Fit(); + } } } } @@ -227,4 +236,3 @@ void wxGenericCollapsiblePane::OnSize(wxSizeEvent& WXUNUSED(event)) // this is very important to make the pane window layout show correctly m_pPane->Layout(); } -