avoid code duplication between the generic and GTK versions, factor the common code out in OnStateChange()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42264 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -102,21 +102,9 @@ wxString wxGenericCollapsiblePane::GetBtnLabel() 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);
|
||||
|
||||
@@ -157,6 +145,22 @@ void wxGenericCollapsiblePane::Collapse(bool collapse)
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
Reference in New Issue
Block a user