]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/checkbox.cpp
fixing infinite recursion for rotated text, introduced in cleanup r57915
[wxWidgets.git] / samples / widgets / checkbox.cpp
index d0c53b5734891d2bd729bd8f24e297c5170593ca..6ecbfd872a1d36d3070bc8b6ebae4d5638444053 100644 (file)
@@ -50,7 +50,7 @@
 // control ids
 enum
 {
 // control ids
 enum
 {
-    CheckboxPage_Reset = 100,
+    CheckboxPage_Reset = wxID_HIGHEST,
     CheckboxPage_ChangeLabel,
     CheckboxPage_Check,
     CheckboxPage_Uncheck,
     CheckboxPage_ChangeLabel,
     CheckboxPage_Check,
     CheckboxPage_Uncheck,
@@ -73,10 +73,14 @@ enum
 class CheckBoxWidgetsPage : public WidgetsPage
 {
 public:
 class CheckBoxWidgetsPage : public WidgetsPage
 {
 public:
-    CheckBoxWidgetsPage(wxBookCtrl *book, wxImageList *imaglist);
+    CheckBoxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
     virtual ~CheckBoxWidgetsPage(){};
 
     virtual wxControl *GetWidget() const { return m_checkbox; }
     virtual ~CheckBoxWidgetsPage(){};
 
     virtual wxControl *GetWidget() const { return m_checkbox; }
+    virtual void RecreateWidget() { CreateCheckbox(); }
+
+    // lazy creation of the content
+    virtual void CreateContent();
 
 protected:
     // event handlers
 
 protected:
     // event handlers
@@ -147,14 +151,22 @@ END_EVENT_TABLE()
 // implementation
 // ============================================================================
 
 // implementation
 // ============================================================================
 
-IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, wxT("CheckBox"));
+#if defined(__WXUNIVERSAL__)
+    #define FAMILY_CTRLS UNIVERSAL_CTRLS
+#else
+    #define FAMILY_CTRLS NATIVE_CTRLS
+#endif
+
+IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, wxT("CheckBox"), FAMILY_CTRLS );
 
 
-CheckBoxWidgetsPage::CheckBoxWidgetsPage(wxBookCtrl *book,
+CheckBoxWidgetsPage::CheckBoxWidgetsPage(WidgetsBookCtrl *book,
                                          wxImageList *imaglist)
                                          wxImageList *imaglist)
-                  : WidgetsPage(book)
+                  : WidgetsPage(book, imaglist, checkbox_xpm)
 {
 {
-    imaglist->Add(wxBitmap(checkbox_xpm));
+}
 
 
+void CheckBoxWidgetsPage::CreateContent()
+{
     wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
 
     // left pane
     wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
 
     // left pane
@@ -221,8 +233,6 @@ CheckBoxWidgetsPage::CheckBoxWidgetsPage(wxBookCtrl *book,
     Reset();
 
     SetSizer(sizerTop);
     Reset();
 
     SetSizer(sizerTop);
-
-    sizerTop->Fit(this);
 }
 
 void CheckBoxWidgetsPage::Reset()
 }
 
 void CheckBoxWidgetsPage::Reset()
@@ -243,7 +253,7 @@ void CheckBoxWidgetsPage::CreateCheckbox()
 
     delete m_checkbox;
 
 
     delete m_checkbox;
 
-    int flags = 0;
+    int flags = ms_defaultFlags;
     if ( m_chkRight->IsChecked() )
         flags |= wxALIGN_RIGHT;
 
     if ( m_chkRight->IsChecked() )
         flags |= wxALIGN_RIGHT;