bool wxSwitcherDialog::Create( const wxSwitcherItems& items, wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint &position, const wxSize& size, long style ) { m_switcherBorderStyle = (style & wxBORDER_MASK); if (m_switcherBorderStyle == wxBORDER_NONE) m_switcherBorderStyle = wxBORDER_SIMPLE; style &= wxBORDER_MASK; style |= wxBORDER_NONE; wxScrollingDialog::Create( parent, id, title, position, size, style ); m_listCtrl = new wxMultiColumnListCtrl(); m_listCtrl->SetItems(items); m_listCtrl->Create(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS|wxNO_BORDER); m_listCtrl->CalculateLayout(); if (m_extraNavigationKey != -1) m_listCtrl->SetExtraNavigationKey(m_extraNavigationKey); if (m_modifierKey != -1) m_listCtrl->SetModifierKey(m_modifierKey); int borderStyle = wxSIMPLE_BORDER; borderStyle = wxBORDER_NONE; #if defined(__WXMSW__) && wxCHECK_VERSION(2,8,5) // borderStyle = wxBORDER_THEME; #endif m_descriptionCtrl = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 100), borderStyle); m_descriptionCtrl->SetHTMLBackgroundColour(GetBackgroundColour()); #ifdef __WXGTK20__ int fontSize = 11; m_descriptionCtrl->SetStandardFonts(fontSize); #endif wxSizer* sizer = new wxBoxSizer(wxVERTICAL); SetSizer(sizer); sizer->Add(m_listCtrl, 1, wxALL|wxEXPAND, 10); sizer->Add(m_descriptionCtrl, 0, wxALL|wxEXPAND, 10); sizer->SetSizeHints(this); m_listCtrl->SetFocus(); Centre(wxBOTH); if (m_listCtrl->GetItems().GetSelection() == -1) m_listCtrl->GetItems().SetSelection(0); m_listCtrl->AdvanceToNextSelectableItem(1); ShowDescription(m_listCtrl->GetItems().GetSelection()); return true; }
void wxSwitcherDialog::OnSelectItem(wxCommandEvent& event) { ShowDescription(event.GetSelection()); }