X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5378558e5ca2de455ba9749cc8a3044c6a93d1eb..17b1d76b4add82305463d10b9f65668d06169363:/samples/widgets/checkbox.cpp?ds=inline diff --git a/samples/widgets/checkbox.cpp b/samples/widgets/checkbox.cpp index aeaf200853..65a5c1ea4e 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, @@ -73,10 +73,14 @@ enum class CheckBoxWidgetsPage : public WidgetsPage { public: - CheckBoxWidgetsPage(wxBookCtrlBase *book, wxImageList *imaglist); + CheckBoxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); virtual ~CheckBoxWidgetsPage(){}; virtual wxControl *GetWidget() const { return m_checkbox; } + virtual void RecreateWidget() { CreateCheckbox(); } + + // lazy creation of the content + virtual void CreateContent(); protected: // event handlers @@ -147,14 +151,22 @@ END_EVENT_TABLE() // implementation // ============================================================================ -IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, wxT("CheckBox")); +#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(wxBookCtrlBase *book, +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 @@ -243,7 +255,7 @@ void CheckBoxWidgetsPage::CreateCheckbox() delete m_checkbox; - int flags = 0; + int flags = ms_defaultFlags; if ( m_chkRight->IsChecked() ) flags |= wxALIGN_RIGHT;