X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/32816f9a683a67e61f3e527e9d149e86f364f127..f4f5d5697dc5e34a5582061dbd857d1cd4326f91:/samples/widgets/toggle.cpp diff --git a/samples/widgets/toggle.cpp b/samples/widgets/toggle.cpp index 626bc0c2bb..a44b1ff900 100644 --- a/samples/widgets/toggle.cpp +++ b/samples/widgets/toggle.cpp @@ -34,6 +34,7 @@ #ifndef WX_PRECOMP #include "wx/sizer.h" #include "wx/statbox.h" + #include "wx/textctrl.h" #endif #include "icons/toggle.xpm" @@ -63,6 +64,9 @@ public: virtual wxControl *GetWidget() const { return m_toggle; } virtual void RecreateWidget() { CreateToggle(); } + // lazy creation of the content + virtual void CreateContent(); + protected: // event handlers void OnButtonReset(wxCommandEvent& event); @@ -114,10 +118,12 @@ IMPLEMENT_WIDGETS_PAGE(ToggleWidgetsPage, wxT("ToggleButton"), ToggleWidgetsPage::ToggleWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) - :WidgetsPage(book) + :WidgetsPage(book, imaglist, toggle_xpm) { - imaglist->Add(wxBitmap(toggle_xpm)); +} +void ToggleWidgetsPage::CreateContent() +{ wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane @@ -157,8 +163,6 @@ ToggleWidgetsPage::ToggleWidgetsPage(WidgetsBookCtrl *book, Reset(); SetSizer(sizerTop); - - sizerTop->Fit(this); } void ToggleWidgetsPage::Reset()