virtual wxString GetLabel() const
{ return m_strLabel; }
+
+ // implementation only, don't use
+ void OnStateChange(const wxSize& sizeNew);
+
protected:
// overridden methods
virtual wxSize DoGetBestSize() const;
return m_strLabel + (IsCollapsed() ? wxT(" >>") : wxT(" <<"));
}
-void wxGenericCollapsiblePane::Collapse(bool collapse)
+void wxGenericCollapsiblePane::OnStateChange(const wxSize& sz)
{
- // optimization
- if ( IsCollapsed() == collapse )
- return;
-
- // update our state
- m_pPane->Show(!collapse);
-
- // update button label
- // NB: this must be done after updating our "state"
- m_pButton->SetLabel(GetBtnLabel());
-
// minimal size has priority over the best size so set here our min size
- wxSize sz = GetBestSize();
SetMinSize(sz);
SetSize(sz);
}
}
+void wxGenericCollapsiblePane::Collapse(bool collapse)
+{
+ // optimization
+ if ( IsCollapsed() == collapse )
+ return;
+
+ // update our state
+ m_pPane->Show(!collapse);
+
+ // update button label
+ // NB: this must be done after updating our "state"
+ m_pButton->SetLabel(GetBtnLabel());
+
+ OnStateChange(GetBestSize());
+}
+
void wxGenericCollapsiblePane::SetLabel(const wxString &label)
{
m_strLabel = label;
sz = p->m_szCollapsed;
}
- // minimal size has priority over the best size so set here our min size
- p->SetMinSize(sz);
- p->SetSize(sz);
-
- wxWindow *top = wxGetTopLevelParent(p);
- if (top)
- {
- // we've changed our size, thus our top level parent needs to relayout
- // itself
- top->Layout();
-
- if (p->IsExpanded())
- {
- // force our parent to "fit", i.e. expand so that it can honour
- // our minimal size
- top->Fit();
- }
- else // correctly
- {
- if (top->GetSizer())
- top->GetSizer()->SetSizeHints(top);
-
- // use SetClientSize() and not SetSize() otherwise the size for
- // e.g. a wxFrame with a menubar wouldn't be correctly set
- top->SetClientSize(sz);
- }
- }
+ p->OnStateChange(sz);
if ( p->m_bIgnoreNextChange )
{