]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/collpaneg.cpp
update the Cairo version to match recent changes in the others
[wxWidgets.git] / src / generic / collpaneg.cpp
index cded9aef40737991df876de6f463a2f2977a5b69..2f1ea156b472f824c5cdc48ab0cb9ff04d1f51d3 100644 (file)
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
+#include "wx/collpane.h"
+
+#if wxUSE_BUTTON && wxUSE_STATLINE
+
 #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 +113,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 +136,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();
+            }
         }
     }
 }
@@ -228,3 +239,4 @@ void wxGenericCollapsiblePane::OnSize(wxSizeEvent& WXUNUSED(event))
     m_pPane->Layout();
 }
 
+#endif // wxUSE_BUTTON && wxUSE_STATLINE