]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/checkbox.cpp
fix problems with using incorrect vswprintf() for mingw32/VC6 when wxUSE_PRINTF_POS_P...
[wxWidgets.git] / samples / widgets / checkbox.cpp
index efa37bf753ffea1ef8086ebc15924a067b5ed579..65a5c1ea4ead0b4967ed3d6420c7db913ae6c358 100644 (file)
@@ -32,6 +32,9 @@
     #include "wx/bitmap.h"
     #include "wx/button.h"
     #include "wx/checkbox.h"
+    #include "wx/radiobox.h"
+    #include "wx/statbox.h"
+    #include "wx/textctrl.h"
 
     #include "wx/sizer.h"
 #endif
@@ -47,7 +50,7 @@
 // control ids
 enum
 {
-    CheckboxPage_Reset = 100,
+    CheckboxPage_Reset = wxID_HIGHEST,
     CheckboxPage_ChangeLabel,
     CheckboxPage_Check,
     CheckboxPage_Uncheck,
@@ -70,8 +73,14 @@ enum
 class CheckBoxWidgetsPage : public WidgetsPage
 {
 public:
-    CheckBoxWidgetsPage(wxNotebook *notebook, wxImageList *imaglist);
-    virtual ~CheckBoxWidgetsPage();
+    CheckBoxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
+    virtual ~CheckBoxWidgetsPage(){};
+
+    virtual wxControl *GetWidget() const { return m_checkbox; }
+    virtual void RecreateWidget() { CreateCheckbox(); }
+
+    // lazy creation of the content
+    virtual void CreateContent();
 
 protected:
     // event handlers
@@ -142,14 +151,22 @@ END_EVENT_TABLE()
 // implementation
 // ============================================================================
 
-IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, wxT("CheckBox"));
+#if defined(__WXUNIVERSAL__)
+    #define FAMILY_CTRLS UNIVERSAL_CTRLS
+#else
+    #define FAMILY_CTRLS NATIVE_CTRLS
+#endif
 
-CheckBoxWidgetsPage::CheckBoxWidgetsPage(wxNotebook *notebook,
-                                       wxImageList *imaglist)
-                  : WidgetsPage(notebook)
+IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, wxT("CheckBox"), FAMILY_CTRLS );
+
+CheckBoxWidgetsPage::CheckBoxWidgetsPage(WidgetsBookCtrl *book,
+                                         wxImageList *imaglist)
+                  : WidgetsPage(book, imaglist, checkbox_xpm)
 {
-    imaglist->Add(wxBitmap(checkbox_xpm));
+}
 
+void CheckBoxWidgetsPage::CreateContent()
+{
     wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
 
     // left pane
@@ -220,10 +237,6 @@ CheckBoxWidgetsPage::CheckBoxWidgetsPage(wxNotebook *notebook,
     sizerTop->Fit(this);
 }
 
-CheckBoxWidgetsPage::~CheckBoxWidgetsPage()
-{
-}
-
 void CheckBoxWidgetsPage::Reset()
 {
     m_chkRight->SetValue(false);
@@ -242,7 +255,7 @@ void CheckBoxWidgetsPage::CreateCheckbox()
 
     delete m_checkbox;
 
-    int flags = 0;
+    int flags = ms_defaultFlags;
     if ( m_chkRight->IsChecked() )
         flags |= wxALIGN_RIGHT;