]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/button.cpp
fixing infinite recursion for rotated text, introduced in cleanup r57915
[wxWidgets.git] / samples / widgets / button.cpp
index 1c2304b364a315f128cd7aafa166779aea47f937..914fa1a08b347d7eb210c85dcb5ed7d41d34b660 100644 (file)
@@ -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);
@@ -164,10 +167,8 @@ 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 =
@@ -185,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
@@ -271,8 +275,6 @@ ButtonWidgetsPage::ButtonWidgetsPage(WidgetsBookCtrl *book,
     CreateButton();
 
     SetSizer(sizerTop);
-
-    sizerTop->Fit(this);
 }
 
 // ----------------------------------------------------------------------------