X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/413fac165f1963dabed326f50c4e1e4d537b5441..30738aae14dfbce0c492d8696c861947228028c2:/samples/widgets/checkbox.cpp diff --git a/samples/widgets/checkbox.cpp b/samples/widgets/checkbox.cpp index 77136e673c..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, @@ -73,8 +73,14 @@ enum class CheckBoxWidgetsPage : public WidgetsPage { public: - CheckBoxWidgetsPage(wxNotebook *notebook, wxImageList *imaglist); - virtual ~CheckBoxWidgetsPage(); + 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 @@ -145,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 -CheckBoxWidgetsPage::CheckBoxWidgetsPage(wxNotebook *notebook, - wxImageList *imaglist) - : WidgetsPage(notebook) +IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, wxT("CheckBox"), FAMILY_CTRLS ); + +CheckBoxWidgetsPage::CheckBoxWidgetsPage(WidgetsBookCtrl *book, + wxImageList *imaglist) + : WidgetsPage(book, imaglist, checkbox_xpm) { - imaglist->Add(wxBitmap(checkbox_xpm)); +} +void CheckBoxWidgetsPage::CreateContent() +{ wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane @@ -219,12 +233,6 @@ CheckBoxWidgetsPage::CheckBoxWidgetsPage(wxNotebook *notebook, Reset(); SetSizer(sizerTop); - - sizerTop->Fit(this); -} - -CheckBoxWidgetsPage::~CheckBoxWidgetsPage() -{ } void CheckBoxWidgetsPage::Reset() @@ -245,7 +253,7 @@ void CheckBoxWidgetsPage::CreateCheckbox() delete m_checkbox; - int flags = 0; + int flags = ms_defaultFlags; if ( m_chkRight->IsChecked() ) flags |= wxALIGN_RIGHT;