X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f2fdc4d56e41711ce7c547484bf97aa0c2bd997a..9a6384ca1e6e9a84f755dbca28875a5e89267766:/samples/widgets/combobox.cpp diff --git a/samples/widgets/combobox.cpp b/samples/widgets/combobox.cpp index 04c4214933..2ac76337af 100644 --- a/samples/widgets/combobox.cpp +++ b/samples/widgets/combobox.cpp @@ -52,7 +52,7 @@ // control ids enum { - ComboPage_Reset = 100, + ComboPage_Reset = wxID_HIGHEST, ComboPage_CurText, ComboPage_InsertionPointText, ComboPage_Insert, @@ -90,6 +90,9 @@ public: virtual wxControl *GetWidget() const { return m_combobox; } virtual void RecreateWidget() { CreateCombo(); } + // lazy creation of the content + virtual void CreateContent(); + protected: // event handlers void OnButtonReset(wxCommandEvent& event); @@ -192,14 +195,19 @@ END_EVENT_TABLE() // implementation // ============================================================================ +#if defined(__WXUNIVERSAL__) + #define FAMILY_CTRLS UNIVERSAL_CTRLS +#else + #define FAMILY_CTRLS NATIVE_CTRLS +#endif + IMPLEMENT_WIDGETS_PAGE(ComboboxWidgetsPage, _T("Combobox"), - (int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS) - | WITH_ITEMS_CTRLS | COMBO_CTRLS + FAMILY_CTRLS | WITH_ITEMS_CTRLS | COMBO_CTRLS ); ComboboxWidgetsPage::ComboboxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) - : WidgetsPage(book) + : WidgetsPage(book, imaglist, combobox_xpm) { // init everything m_chkSort = @@ -207,9 +215,10 @@ ComboboxWidgetsPage::ComboboxWidgetsPage(WidgetsBookCtrl *book, m_combobox = (wxComboBox *)NULL; m_sizerCombo = (wxSizer *)NULL; +} - imaglist->Add(wxBitmap(combobox_xpm)); - +void ComboboxWidgetsPage::CreateContent() +{ /* What we create here is a frame having 3 panes: style pane is the leftmost one, in the middle the pane with buttons allowing to perform @@ -405,7 +414,7 @@ void ComboboxWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event)) void ComboboxWidgetsPage::OnButtonChange(wxCommandEvent& WXUNUSED(event)) { int sel = m_combobox->GetSelection(); - if ( sel != -1 ) + if ( sel != wxNOT_FOUND ) { #ifndef __WXGTK__ m_combobox->SetString(sel, m_textChange->GetValue()); @@ -528,7 +537,7 @@ void ComboboxWidgetsPage::OnUpdateUIDeleteButton(wxUpdateUIEvent& event) void ComboboxWidgetsPage::OnUpdateUIDeleteSelButton(wxUpdateUIEvent& event) { if (m_combobox) - event.Enable(m_combobox->GetSelection() != -1); + event.Enable(m_combobox->GetSelection() != wxNOT_FOUND); } void ComboboxWidgetsPage::OnUpdateUIClearButton(wxUpdateUIEvent& event)