]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/radiobox.cpp
fixed incorrectly reported WXWIN_COMPATIBILITY_2_6 value in summary
[wxWidgets.git] / samples / widgets / radiobox.cpp
index 91f5cc9fa9e38b256105ad99c258c73380c51e43..d0729c6f10c85e9c7be567a14a492f0c47d29b11 100644 (file)
@@ -51,7 +51,7 @@
 // control ids
 enum
 {
 // control ids
 enum
 {
-    RadioPage_Reset = 100,
+    RadioPage_Reset = wxID_HIGHEST,
     RadioPage_Update,
     RadioPage_Selection,
     RadioPage_Label,
     RadioPage_Update,
     RadioPage_Selection,
     RadioPage_Label,
@@ -83,12 +83,15 @@ static const int TEST_BUTTON = 1;
 class RadioWidgetsPage : public WidgetsPage
 {
 public:
 class RadioWidgetsPage : public WidgetsPage
 {
 public:
-    RadioWidgetsPage(wxBookCtrlBase *book, wxImageList *imaglist);
+    RadioWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
     virtual ~RadioWidgetsPage(){};
 
     virtual wxControl *GetWidget() const { return m_radio; }
     virtual void RecreateWidget() { CreateRadio(); }
 
     virtual ~RadioWidgetsPage(){};
 
     virtual wxControl *GetWidget() const { return m_radio; }
     virtual void RecreateWidget() { CreateRadio(); }
 
+    // lazy creation of the content
+    virtual void CreateContent();
+
 protected:
     // event handlers
     void OnCheckOrRadioBox(wxCommandEvent& event);
 protected:
     // event handlers
     void OnCheckOrRadioBox(wxCommandEvent& event);
@@ -173,14 +176,20 @@ END_EVENT_TABLE()
 // implementation
 // ============================================================================
 
 // implementation
 // ============================================================================
 
-IMPLEMENT_WIDGETS_PAGE(RadioWidgetsPage, _T("Radio"));
+#if defined(__WXUNIVERSAL__)
+    #define FAMILY_CTRLS UNIVERSAL_CTRLS
+#else
+    #define FAMILY_CTRLS NATIVE_CTRLS
+#endif
+
+IMPLEMENT_WIDGETS_PAGE(RadioWidgetsPage, _T("Radio"),
+                       FAMILY_CTRLS | WITH_ITEMS_CTRLS
+                       );
 
 
-RadioWidgetsPage::RadioWidgetsPage(wxBookCtrlBase *book,
+RadioWidgetsPage::RadioWidgetsPage(WidgetsBookCtrl *book,
                                    wxImageList *imaglist)
                                    wxImageList *imaglist)
-                  : WidgetsPage(book)
+                  : WidgetsPage(book, imaglist, radio_xpm)
 {
 {
-    imaglist->Add(wxBitmap(radio_xpm));
-
     // init everything
     m_chkVert = (wxCheckBox *)NULL;
     m_chkEnableItem = (wxCheckBox *)NULL;
     // init everything
     m_chkVert = (wxCheckBox *)NULL;
     m_chkEnableItem = (wxCheckBox *)NULL;
@@ -193,7 +202,10 @@ RadioWidgetsPage::RadioWidgetsPage(wxBookCtrlBase *book,
     m_radio =
     m_radioDir = (wxRadioBox *)NULL;
     m_sizerRadio = (wxSizer *)NULL;
     m_radio =
     m_radioDir = (wxRadioBox *)NULL;
     m_sizerRadio = (wxSizer *)NULL;
+}
 
 
+void RadioWidgetsPage::CreateContent()
+{
     wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
 
     // left pane
     wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
 
     // left pane
@@ -290,8 +302,6 @@ RadioWidgetsPage::RadioWidgetsPage(wxBookCtrlBase *book,
 
     // final initializations
     SetSizer(sizerTop);
 
     // final initializations
     SetSizer(sizerTop);
-
-    sizerTop->Fit(this);
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------