]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/checkbox.cpp
Playing with wxgrid, adding optionnally native columns labels
[wxWidgets.git] / samples / widgets / checkbox.cpp
index c683f6774c48a30f8f44793a89109fdf77f0a0b9..6ecbfd872a1d36d3070bc8b6ebae4d5638444053 100644 (file)
@@ -50,7 +50,7 @@
 // control ids
 enum
 {
-    CheckboxPage_Reset = 100,
+    CheckboxPage_Reset = wxID_HIGHEST,
     CheckboxPage_ChangeLabel,
     CheckboxPage_Check,
     CheckboxPage_Uncheck,
@@ -79,6 +79,9 @@ public:
     virtual wxControl *GetWidget() const { return m_checkbox; }
     virtual void RecreateWidget() { CreateCheckbox(); }
 
+    // lazy creation of the content
+    virtual void CreateContent();
+
 protected:
     // event handlers
     void OnCheckBox(wxCommandEvent& event);
@@ -148,16 +151,22 @@ END_EVENT_TABLE()
 // implementation
 // ============================================================================
 
-IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, wxT("CheckBox"),
-                       (int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
-                       );
+#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(WidgetsBookCtrl *book,
                                          wxImageList *imaglist)
-                  : WidgetsPage(book)
+                  : WidgetsPage(book, imaglist, checkbox_xpm)
 {
-    imaglist->Add(wxBitmap(checkbox_xpm));
+}
 
+void CheckBoxWidgetsPage::CreateContent()
+{
     wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
 
     // left pane
@@ -224,8 +233,6 @@ CheckBoxWidgetsPage::CheckBoxWidgetsPage(WidgetsBookCtrl *book,
     Reset();
 
     SetSizer(sizerTop);
-
-    sizerTop->Fit(this);
 }
 
 void CheckBoxWidgetsPage::Reset()