X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d8a731eed4ac51dd1b3fd26d43ccf681465e3018..ba59de5d95df686101f44abcdc2dec9f6f464e2a:/samples/widgets/button.cpp?ds=sidebyside diff --git a/samples/widgets/button.cpp b/samples/widgets/button.cpp index 805126fef1..914fa1a08b 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 }; @@ -85,6 +85,9 @@ public: 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); @@ -156,25 +159,16 @@ END_EVENT_TABLE() #if defined(__WXUNIVERSAL__) #define FAMILY_CTRLS UNIVERSAL_CTRLS -#elif defined(__WXMSW__) || \ - defined(__WXMOTIF__) || \ - defined(__WXGTK__) || \ - defined(__WXMAC__) || \ - defined(__WXPM__) || \ - defined(__WXPALMOS__) - #define FAMILY_CTRLS NATIVE_CTRLS #else - #define FAMILY_CTRLS GENERIC_CTRLS + #define FAMILY_CTRLS NATIVE_CTRLS #endif IMPLEMENT_WIDGETS_PAGE(ButtonWidgetsPage, _T("Button"), FAMILY_CTRLS ); ButtonWidgetsPage::ButtonWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) - : WidgetsPage(book) + : WidgetsPage(book, imaglist, button_xpm) { - imaglist->Add(wxBitmap(button_xpm)); - // init everything m_chkBitmap = m_chkImage = @@ -192,7 +186,10 @@ ButtonWidgetsPage::ButtonWidgetsPage(WidgetsBookCtrl *book, m_button = (wxButton *)NULL; m_sizerButton = (wxSizer *)NULL; +} +void ButtonWidgetsPage::CreateContent() +{ wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane @@ -278,8 +275,6 @@ ButtonWidgetsPage::ButtonWidgetsPage(WidgetsBookCtrl *book, CreateButton(); SetSizer(sizerTop); - - sizerTop->Fit(this); } // ----------------------------------------------------------------------------