X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f2fdc4d56e41711ce7c547484bf97aa0c2bd997a..b64845917a8aa2e6b6186ba6bd291debc2afc195:/samples/widgets/checkbox.cpp diff --git a/samples/widgets/checkbox.cpp b/samples/widgets/checkbox.cpp index c683f6774c..6ecbfd872a 100644 --- a/samples/widgets/checkbox.cpp +++ b/samples/widgets/checkbox.cpp @@ -50,7 +50,7 @@ // control ids enum { - CheckboxPage_Reset = 100, + CheckboxPage_Reset = wxID_HIGHEST, CheckboxPage_ChangeLabel, CheckboxPage_Check, CheckboxPage_Uncheck, @@ -79,6 +79,9 @@ public: virtual wxControl *GetWidget() const { return m_checkbox; } virtual void RecreateWidget() { CreateCheckbox(); } + // lazy creation of the content + virtual void CreateContent(); + protected: // event handlers void OnCheckBox(wxCommandEvent& event); @@ -148,16 +151,22 @@ END_EVENT_TABLE() // implementation // ============================================================================ -IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, wxT("CheckBox"), - (int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS) - ); +#if defined(__WXUNIVERSAL__) + #define FAMILY_CTRLS UNIVERSAL_CTRLS +#else + #define FAMILY_CTRLS NATIVE_CTRLS +#endif + +IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, wxT("CheckBox"), FAMILY_CTRLS ); CheckBoxWidgetsPage::CheckBoxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) - : WidgetsPage(book) + : WidgetsPage(book, imaglist, checkbox_xpm) { - imaglist->Add(wxBitmap(checkbox_xpm)); +} +void CheckBoxWidgetsPage::CreateContent() +{ wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane @@ -224,8 +233,6 @@ CheckBoxWidgetsPage::CheckBoxWidgetsPage(WidgetsBookCtrl *book, Reset(); SetSizer(sizerTop); - - sizerTop->Fit(this); } void CheckBoxWidgetsPage::Reset()