PrusaCollapsiblePanel works correct on MSW now
This commit is contained in:
parent
e78a885247
commit
75a0dea93f
1 changed files with 11 additions and 9 deletions
|
@ -192,6 +192,7 @@ bool PrusaCollapsiblePane::Create(wxWindow *parent, wxWindowID id, const wxStrin
|
||||||
|
|
||||||
m_pDisclosureTriangleButton = new wxButton(this, wxID_ANY, m_strLabel, wxPoint(0, 0),
|
m_pDisclosureTriangleButton = new wxButton(this, wxID_ANY, m_strLabel, wxPoint(0, 0),
|
||||||
wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER);
|
wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER);
|
||||||
|
UpdateBtnBmp();
|
||||||
m_pDisclosureTriangleButton->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event)
|
m_pDisclosureTriangleButton->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
if (event.GetEventObject() != m_pDisclosureTriangleButton)
|
if (event.GetEventObject() != m_pDisclosureTriangleButton)
|
||||||
|
@ -207,8 +208,6 @@ bool PrusaCollapsiblePane::Create(wxWindow *parent, wxWindowID id, const wxStrin
|
||||||
GetEventHandler()->ProcessEvent(ev);
|
GetEventHandler()->ProcessEvent(ev);
|
||||||
});
|
});
|
||||||
|
|
||||||
UpdateBtnBmp();
|
|
||||||
|
|
||||||
m_sz->Add(m_pDisclosureTriangleButton, 0, wxLEFT | wxTOP | wxBOTTOM, GetBorder());
|
m_sz->Add(m_pDisclosureTriangleButton, 0, wxLEFT | wxTOP | wxBOTTOM, GetBorder());
|
||||||
|
|
||||||
// do not set sz as our sizers since we handle the pane window without using sizers
|
// do not set sz as our sizers since we handle the pane window without using sizers
|
||||||
|
@ -228,11 +227,17 @@ bool PrusaCollapsiblePane::Create(wxWindow *parent, wxWindowID id, const wxStrin
|
||||||
|
|
||||||
void PrusaCollapsiblePane::UpdateBtnBmp()
|
void PrusaCollapsiblePane::UpdateBtnBmp()
|
||||||
{
|
{
|
||||||
IsCollapsed() ?
|
if (IsCollapsed())
|
||||||
m_pDisclosureTriangleButton->SetBitmap(m_bmp_close) :
|
m_pDisclosureTriangleButton->SetBitmap(m_bmp_close);
|
||||||
|
else{
|
||||||
m_pDisclosureTriangleButton->SetBitmap(m_bmp_open);
|
m_pDisclosureTriangleButton->SetBitmap(m_bmp_open);
|
||||||
|
// To updating button bitmap it's needed to lost focus on this button, so
|
||||||
|
// we set focus to mainframe
|
||||||
|
//GetParent()->GetParent()->GetParent()->SetFocus();
|
||||||
|
//or to pane
|
||||||
|
GetPane()->SetFocus();
|
||||||
|
}
|
||||||
Layout();
|
Layout();
|
||||||
// m_pDisclosureTriangleButton->Refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrusaCollapsiblePane::Collapse(bool collapse)
|
void PrusaCollapsiblePane::Collapse(bool collapse)
|
||||||
|
@ -246,8 +251,7 @@ void PrusaCollapsiblePane::Collapse(bool collapse)
|
||||||
// update our state
|
// update our state
|
||||||
m_pPane->Show(!collapse);
|
m_pPane->Show(!collapse);
|
||||||
|
|
||||||
// update button label
|
// update button bitmap
|
||||||
// m_pDisclosureTriangleButton->SetLabel(m_strLabel);
|
|
||||||
UpdateBtnBmp();
|
UpdateBtnBmp();
|
||||||
|
|
||||||
OnStateChange(GetBestSize());
|
OnStateChange(GetBestSize());
|
||||||
|
@ -256,9 +260,7 @@ void PrusaCollapsiblePane::Collapse(bool collapse)
|
||||||
void PrusaCollapsiblePane::SetLabel(const wxString &label)
|
void PrusaCollapsiblePane::SetLabel(const wxString &label)
|
||||||
{
|
{
|
||||||
m_strLabel = label;
|
m_strLabel = label;
|
||||||
|
|
||||||
m_pDisclosureTriangleButton->SetLabel(m_strLabel);
|
m_pDisclosureTriangleButton->SetLabel(m_strLabel);
|
||||||
|
|
||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue