Updated Collapsed/Layout for PrusaCollapsiblePane.

Cleaned right_panel
This commit is contained in:
YuSanka 2018-05-28 17:08:48 +02:00
parent d7d0edf4dc
commit c7d7da452e
4 changed files with 86 additions and 82 deletions

View file

@ -257,6 +257,36 @@ void PrusaCollapsiblePane::UpdateBtnBmp()
Layout();
}
void PrusaCollapsiblePane::OnStateChange_(const wxSize& sz)
{
SetSize(sz);
if (this->HasFlag(wxCP_NO_TLW_RESIZE))
{
// the user asked to explicitly handle the resizing itself...
return;
}
auto top = GetParent(); //right_panel
if (!top)
return;
wxSizer *sizer = top->GetSizer();
if (!sizer)
return;
const wxSize newBestSize = sizer->ComputeFittingClientSize(top);
top->SetMinClientSize(newBestSize);
wxWindowUpdateLocker noUpdates_p(top->GetParent());
// we shouldn't attempt to resize a maximized window, whatever happens
// if (!top->IsMaximized())
// top->SetClientSize(newBestSize);
top->GetParent()->Layout();
top->Refresh();
}
void PrusaCollapsiblePane::Collapse(bool collapse)
{
// optimization
@ -268,10 +298,20 @@ void PrusaCollapsiblePane::Collapse(bool collapse)
// update our state
m_pPane->Show(!collapse);
// update button label
#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__)
m_pButton->SetOpen(!collapse);
#else
#ifdef __WXMSW__
// update button bitmap
UpdateBtnBmp();
#else
// NB: this must be done after updating our "state"
m_pButton->SetLabel(GetBtnLabel());
#endif //__WXMSW__
#endif
OnStateChange(GetBestSize());
OnStateChange_(GetBestSize());
}
void PrusaCollapsiblePane::SetLabel(const wxString &label)