X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1301e2289f81208bdd2cb1ac92a0d13c3d0959c4..084ad0c2424aa998a640c151f8fa762435364449:/samples/widgets/button.cpp diff --git a/samples/widgets/button.cpp b/samples/widgets/button.cpp index 8e855553a3..c06a28bf69 100644 --- a/samples/widgets/button.cpp +++ b/samples/widgets/button.cpp @@ -52,7 +52,7 @@ // control ids enum { - ButtonPage_Reset = 100, + ButtonPage_Reset = wxID_HIGHEST, ButtonPage_ChangeLabel, ButtonPage_Button }; @@ -79,12 +79,15 @@ enum class ButtonWidgetsPage : public WidgetsPage { public: - ButtonWidgetsPage(wxBookCtrlBase *book, wxImageList *imaglist); + ButtonWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); virtual ~ButtonWidgetsPage(){}; virtual wxControl *GetWidget() const { return m_button; } virtual void RecreateWidget() { CreateButton(); } + // lazy creation of the content + virtual void CreateContent(); + protected: // event handlers void OnCheckOrRadioBox(wxCommandEvent& event); @@ -154,14 +157,18 @@ END_EVENT_TABLE() // implementation // ============================================================================ -IMPLEMENT_WIDGETS_PAGE(ButtonWidgetsPage, _T("Button")); +#if defined(__WXUNIVERSAL__) + #define FAMILY_CTRLS UNIVERSAL_CTRLS +#else + #define FAMILY_CTRLS NATIVE_CTRLS +#endif + +IMPLEMENT_WIDGETS_PAGE(ButtonWidgetsPage, _T("Button"), FAMILY_CTRLS ); -ButtonWidgetsPage::ButtonWidgetsPage(wxBookCtrlBase *book, +ButtonWidgetsPage::ButtonWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) - : WidgetsPage(book) + : WidgetsPage(book, imaglist, button_xpm) { - imaglist->Add(wxBitmap(button_xpm)); - // init everything m_chkBitmap = m_chkImage = @@ -179,7 +186,10 @@ ButtonWidgetsPage::ButtonWidgetsPage(wxBookCtrlBase *book, m_button = (wxButton *)NULL; m_sizerButton = (wxSizer *)NULL; +} +void ButtonWidgetsPage::CreateContent() +{ wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane