]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/toggle.cpp
use wxFD_XXX instead of deprecated wxXXX in the documentation
[wxWidgets.git] / samples / widgets / toggle.cpp
index 626bc0c2bb4af89d39390b6b8b5f26ddb2e0473a..a44b1ff900c2a032d40880d0cf9bce6aa0d29388 100644 (file)
@@ -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()