void wxGenericCollapsiblePane::SetLabel(const wxString &label) { m_strLabel = label; #ifdef __WXMAC__ m_pButton->SetLabel(GetBtnLabel()); #else m_pButton->SetLabel(GetBtnLabel()); m_pButton->SetInitialSize(); #endif Layout(); }
bool wxGenericCollapsiblePane::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, long style, const wxValidator& val, const wxString& name) { if ( !wxControl::Create(parent, id, pos, size, style, val, name) ) return false; m_strLabel = label; #if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) // on Mac we use the disclosure triangle // we need a light gray line above and below, lets approximate with the frame m_pStaticLine = NULL; m_pButton = new wxDisclosureTriangle( this, wxID_ANY, GetBtnLabel(), wxDefaultPosition, wxDefaultSize, wxSIMPLE_BORDER ); m_pButton->SetBackgroundColour( wxColour( 221, 226, 239 ) ); m_sz = new wxBoxSizer(wxHORIZONTAL); // m_sz->Add(4,4); where shall we put it? m_sz->Add( m_pButton, 1); #else // create children and lay them out using a wxBoxSizer // (so that we automatically get RTL features) m_pButton = new wxButton(this, wxID_ANY, GetBtnLabel(), wxPoint(0, 0), wxDefaultSize, wxBU_EXACTFIT); m_pStaticLine = new wxStaticLine(this, wxID_ANY); // on other platforms we put the static line and the button horizontally m_sz = new wxBoxSizer(wxHORIZONTAL); m_sz->Add(m_pButton, 0, wxLEFT|wxTOP|wxBOTTOM, GetBorder()); m_sz->Add(m_pStaticLine, 1, wxALIGN_CENTER|wxLEFT|wxRIGHT, GetBorder()); #endif // FIXME: at least under wxCE and wxGTK1 the background is black if we don't do // this, no idea why... #if defined(__WXWINCE__) || defined(__WXGTK__) SetBackgroundColour(parent->GetBackgroundColour()); #endif // do not set sz as our sizers since we handle the pane window without using sizers m_pPane = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL|wxNO_BORDER, wxT("wxCollapsiblePanePane") ); // start as collapsed: m_pPane->Hide(); return true; }
void wxGenericCollapsiblePane::SetLabel(const wxString &label) { m_strLabel = label; m_pButton->SetLabel(GetBtnLabel()); m_pButton->SetInitialSize(); Layout(); }
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::Collapse(bool collapse) { // optimization if ( IsCollapsed() == collapse ) return; // update our state m_pPane->Show(!collapse); // update button label #if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) m_pButton->SetOpen( !collapse ); #else // NB: this must be done after updating our "state" m_pButton->SetLabel(GetBtnLabel()); #endif OnStateChange(GetBestSize()); }