]> git.saurik.com Git - wxWidgets.git/commitdiff
Continuation of 'widgets' sample improvements.
authorWłodzimierz Skiba <abx@abx.art.pl>
Mon, 22 May 2006 10:39:40 +0000 (10:39 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Mon, 22 May 2006 10:39:40 +0000 (10:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39265 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

12 files changed:
samples/widgets/button.cpp
samples/widgets/checkbox.cpp
samples/widgets/combobox.cpp
samples/widgets/datepick.cpp
samples/widgets/gauge.cpp
samples/widgets/listbox.cpp
samples/widgets/notebook.cpp
samples/widgets/radiobox.cpp
samples/widgets/slider.cpp
samples/widgets/spinbtn.cpp
samples/widgets/static.cpp
samples/widgets/textctrl.cpp

index 805126fef1d2637f669538bf8ed658597456b308..1c2304b364a315f128cd7aafa166779aea47f937 100644 (file)
@@ -52,7 +52,7 @@
 // control ids
 enum
 {
-    ButtonPage_Reset = 100,
+    ButtonPage_Reset = wxID_HIGHEST,
     ButtonPage_ChangeLabel,
     ButtonPage_Button
 };
@@ -156,15 +156,8 @@ END_EVENT_TABLE()
 
 #if defined(__WXUNIVERSAL__)
     #define FAMILY_CTRLS UNIVERSAL_CTRLS
-#elif defined(__WXMSW__)    || \
-      defined(__WXMOTIF__)  || \
-      defined(__WXGTK__)    || \
-      defined(__WXMAC__)    || \
-      defined(__WXPM__)     || \
-      defined(__WXPALMOS__)
-    #define FAMILY_CTRLS NATIVE_CTRLS
 #else
-    #define FAMILY_CTRLS GENERIC_CTRLS
+    #define FAMILY_CTRLS NATIVE_CTRLS
 #endif
 
 IMPLEMENT_WIDGETS_PAGE(ButtonWidgetsPage, _T("Button"), FAMILY_CTRLS );
index c683f6774c48a30f8f44793a89109fdf77f0a0b9..375a7a370fb0ce37a5bf646c332f8c8c1bb12a55 100644 (file)
@@ -50,7 +50,7 @@
 // control ids
 enum
 {
-    CheckboxPage_Reset = 100,
+    CheckboxPage_Reset = wxID_HIGHEST,
     CheckboxPage_ChangeLabel,
     CheckboxPage_Check,
     CheckboxPage_Uncheck,
@@ -148,9 +148,13 @@ 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)
index 04c4214933ecebe37f61ea1ba46bac10fe588f6f..aa9a6a8a0596a1221b521b419e22ddd6902b4d47 100644 (file)
@@ -52,7 +52,7 @@
 // control ids
 enum
 {
-    ComboPage_Reset = 100,
+    ComboPage_Reset = wxID_HIGHEST,
     ComboPage_CurText,
     ComboPage_InsertionPointText,
     ComboPage_Insert,
@@ -192,9 +192,14 @@ END_EVENT_TABLE()
 // implementation
 // ============================================================================
 
+#if defined(__WXUNIVERSAL__)
+    #define FAMILY_CTRLS UNIVERSAL_CTRLS
+#else
+    #define FAMILY_CTRLS NATIVE_CTRLS
+#endif
+
 IMPLEMENT_WIDGETS_PAGE(ComboboxWidgetsPage, _T("Combobox"),
-                       (int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
-                       | WITH_ITEMS_CTRLS | COMBO_CTRLS
+                       FAMILY_CTRLS | WITH_ITEMS_CTRLS | COMBO_CTRLS
                        );
 
 ComboboxWidgetsPage::ComboboxWidgetsPage(WidgetsBookCtrl *book,
index b9aab44eebaf67953b144f93b5a8fc94fd5b3e79..9babbf8c0226ceb76e94467407a3b158b1714abb 100644 (file)
@@ -119,9 +119,14 @@ END_EVENT_TABLE()
 // implementation
 // ============================================================================
 
+#if defined(__WXMSW__)
+    #define FAMILY_CTRLS NATIVE_CTRLS
+#else
+    #define FAMILY_CTRLS GENERIC_CTRLS
+#endif
+
 IMPLEMENT_WIDGETS_PAGE(DatePickerWidgetsPage, wxT("DatePicker"),
-                       (int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
-                       | PICKER_CTRLS
+                       FAMILY_CTRLS | PICKER_CTRLS
                        );
 
 DatePickerWidgetsPage::DatePickerWidgetsPage(WidgetsBookCtrl *book,
index 5c779721cbcbc7b1cd0c39e69e118fb09ad8f88e..4affd9ab33769dca7aaa11b07dd1ef5c1d88310e 100644 (file)
@@ -52,7 +52,7 @@
 // control ids
 enum
 {
-    GaugePage_Reset = 100,
+    GaugePage_Reset = wxID_HIGHEST,
     GaugePage_Progress,
     GaugePage_Clear,
     GaugePage_SetValue,
@@ -157,9 +157,13 @@ END_EVENT_TABLE()
 // implementation
 // ============================================================================
 
-IMPLEMENT_WIDGETS_PAGE(GaugeWidgetsPage, _T("Gauge"),
-                       (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(GaugeWidgetsPage, _T("Gauge"), FAMILY_CTRLS );
 
 GaugeWidgetsPage::GaugeWidgetsPage(WidgetsBookCtrl *book,
                                    wxImageList *imaglist)
index 0a40eb74e1959b96c10574fc56bf928176fd56a8..1a43e7b4a2e1246a730d892827a903ed69d61334 100644 (file)
@@ -55,7 +55,7 @@
 // control ids
 enum
 {
-    ListboxPage_Reset = 100,
+    ListboxPage_Reset = wxID_HIGHEST,
     ListboxPage_Add,
     ListboxPage_AddText,
     ListboxPage_AddSeveral,
@@ -193,9 +193,14 @@ END_EVENT_TABLE()
 // implementation
 // ============================================================================
 
+#if defined(__WXUNIVERSAL__)
+    #define FAMILY_CTRLS UNIVERSAL_CTRLS
+#else
+    #define FAMILY_CTRLS NATIVE_CTRLS
+#endif
+
 IMPLEMENT_WIDGETS_PAGE(ListboxWidgetsPage, _T("Listbox"),
-                       (int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
-                       | WITH_ITEMS_CTRLS
+                       FAMILY_CTRLS | WITH_ITEMS_CTRLS
                        );
 
 ListboxWidgetsPage::ListboxWidgetsPage(WidgetsBookCtrl *book,
index f65f461179a6c4e461b64a3a269494e450e3a8bc..357ac05684e63077e43b332b48b85438447c1229 100644 (file)
@@ -93,11 +93,6 @@ public:
 
 protected:
     // event handlers
-#ifdef ABX
-    void OnPageChanging(wxNotebookEvent& event);
-    void OnPageChanged(wxNotebookEvent& event);
-#endif
-
     void OnButtonReset(wxCommandEvent& event);
     void OnButtonDeleteAll(wxCommandEvent& event);
     void OnButtonSelectPage(wxCommandEvent& event);
@@ -181,11 +176,6 @@ BEGIN_EVENT_TABLE(BookWidgetsPage, WidgetsPage)
     EVT_UPDATE_UI(BookPage_InsertPage, BookWidgetsPage::OnUpdateUIInsertButton)
     EVT_UPDATE_UI(BookPage_RemovePage, BookWidgetsPage::OnUpdateUIRemoveButton)
 
-#ifdef ABX
-    EVT_NOTEBOOK_PAGE_CHANGING(wxID_ANY, BookWidgetsPage::OnPageChanging)
-    EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, NotebookWidgetsPage::OnPageChanged)
-#endif
-
     EVT_CHECKBOX(wxID_ANY, BookWidgetsPage::OnCheckOrRadioBox)
     EVT_RADIOBOX(wxID_ANY, BookWidgetsPage::OnCheckOrRadioBox)
 END_EVENT_TABLE()
@@ -516,29 +506,6 @@ void BookWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
     RecreateBook();
 }
 
-#ifdef ABX
-void BookWidgetsPage::OnPageChanging(wxBookEvent& event)
-{
-    wxLogMessage(_T("Notebook page changing from %d to %d (currently %d)."),
-                 event.GetOldSelection(),
-                 event.GetSelection(),
-                 m_notebook->GetSelection());
-
-    event.Skip();
-}
-
-void NotebookWidgetsPage::OnPageChanged(wxNotebookEvent& event)
-{
-    wxLogMessage(_T("Notebook page changed from %d to %d (currently %d)."),
-                 event.GetOldSelection(),
-                 event.GetSelection(),
-                 m_notebook->GetSelection());
-
-    event.Skip();
-}
-
-#endif
-
 #if wxUSE_NOTEBOOK
 
 #include "icons/notebook.xpm"
@@ -561,6 +528,10 @@ public:
 
 protected:
 
+    // event handlers
+    void OnPageChanging(wxNotebookEvent& event);
+    void OnPageChanged(wxNotebookEvent& event);
+
     // (re)create book
     virtual wxBookCtrlBase *CreateBook(long flags)
     {
@@ -580,14 +551,42 @@ private:
 // ----------------------------------------------------------------------------
 
 BEGIN_EVENT_TABLE(NotebookWidgetsPage, BookWidgetsPage)
+    EVT_NOTEBOOK_PAGE_CHANGING(wxID_ANY, NotebookWidgetsPage::OnPageChanging)
+    EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, NotebookWidgetsPage::OnPageChanged)
 END_EVENT_TABLE()
 
+#if defined(__WXUNIVERSAL__)
+    #define FAMILY_CTRLS UNIVERSAL_CTRLS
+#elif defined(__WXMOTIF__)
+    #define FAMILY_CTRLS GENERIC_CTRLS
+#else
+    #define FAMILY_CTRLS NATIVE_CTRLS
+#endif
+
 IMPLEMENT_WIDGETS_PAGE(NotebookWidgetsPage, _T("Notebook"),
-                       (int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
-                                                     .ElseIf(wxGTK,NATIVE_CTRLS)
-                       | BOOK_CTRLS
+                       FAMILY_CTRLS | BOOK_CTRLS
                        );
 
+void NotebookWidgetsPage::OnPageChanging(wxNotebookEvent& event)
+{
+    wxLogMessage(_T("Notebook page changing from %d to %d (currently %d)."),
+                 event.GetOldSelection(),
+                 event.GetSelection(),
+                 m_book->GetSelection());
+
+    event.Skip();
+}
+
+void NotebookWidgetsPage::OnPageChanged(wxNotebookEvent& event)
+{
+    wxLogMessage(_T("Notebook page changed from %d to %d (currently %d)."),
+                 event.GetOldSelection(),
+                 event.GetSelection(),
+                 m_book->GetSelection());
+
+    event.Skip();
+}
+
 #endif // wxUSE_NOTEBOOK
 
 #if wxUSE_LISTBOOK
@@ -612,6 +611,10 @@ public:
 
 protected:
 
+    // event handlers
+    void OnPageChanging(wxListbookEvent& event);
+    void OnPageChanged(wxListbookEvent& event);
+
     // (re)create book
     virtual wxBookCtrlBase *CreateBook(long flags)
     {
@@ -631,12 +634,34 @@ private:
 // ----------------------------------------------------------------------------
 
 BEGIN_EVENT_TABLE(ListbookWidgetsPage, BookWidgetsPage)
+    EVT_LISTBOOK_PAGE_CHANGING(wxID_ANY, ListbookWidgetsPage::OnPageChanging)
+    EVT_LISTBOOK_PAGE_CHANGED(wxID_ANY, ListbookWidgetsPage::OnPageChanged)
 END_EVENT_TABLE()
 
 IMPLEMENT_WIDGETS_PAGE(ListbookWidgetsPage, _T("Listbook"),
                        GENERIC_CTRLS | BOOK_CTRLS
                        );
 
+void ListbookWidgetsPage::OnPageChanging(wxListbookEvent& event)
+{
+    wxLogMessage(_T("Listbook page changing from %d to %d (currently %d)."),
+                 event.GetOldSelection(),
+                 event.GetSelection(),
+                 m_book->GetSelection());
+
+    event.Skip();
+}
+
+void ListbookWidgetsPage::OnPageChanged(wxListbookEvent& event)
+{
+    wxLogMessage(_T("Listbook page changed from %d to %d (currently %d)."),
+                 event.GetOldSelection(),
+                 event.GetSelection(),
+                 m_book->GetSelection());
+
+    event.Skip();
+}
+
 #endif // wxUSE_LISTBOOK
 
 #if wxUSE_CHOICEBOOK
@@ -661,6 +686,10 @@ public:
 
 protected:
 
+    // event handlers
+    void OnPageChanging(wxChoicebookEvent& event);
+    void OnPageChanged(wxChoicebookEvent& event);
+
     // (re)create book
     virtual wxBookCtrlBase *CreateBook(long flags)
     {
@@ -680,12 +709,34 @@ private:
 // ----------------------------------------------------------------------------
 
 BEGIN_EVENT_TABLE(ChoicebookWidgetsPage, BookWidgetsPage)
+    EVT_CHOICEBOOK_PAGE_CHANGING(wxID_ANY, ChoicebookWidgetsPage::OnPageChanging)
+    EVT_CHOICEBOOK_PAGE_CHANGED(wxID_ANY, ChoicebookWidgetsPage::OnPageChanged)
 END_EVENT_TABLE()
 
 IMPLEMENT_WIDGETS_PAGE(ChoicebookWidgetsPage, _T("Choicebook"),
                        GENERIC_CTRLS | BOOK_CTRLS
                        );
 
+void ChoicebookWidgetsPage::OnPageChanging(wxChoicebookEvent& event)
+{
+    wxLogMessage(_T("Choicebook page changing from %d to %d (currently %d)."),
+                 event.GetOldSelection(),
+                 event.GetSelection(),
+                 m_book->GetSelection());
+
+    event.Skip();
+}
+
+void ChoicebookWidgetsPage::OnPageChanged(wxChoicebookEvent& event)
+{
+    wxLogMessage(_T("Choicebook page changed from %d to %d (currently %d)."),
+                 event.GetOldSelection(),
+                 event.GetSelection(),
+                 m_book->GetSelection());
+
+    event.Skip();
+}
+
 #endif // wxUSE_CHOICEBOOK
 
 #endif // wxUSE_BOOKCTRL
index 1fd80178a4ad536e0ad786533408d9bd11e8fe2f..088da04a98c271e6cb726df049bb800976400a81 100644 (file)
@@ -51,7 +51,7 @@
 // control ids
 enum
 {
-    RadioPage_Reset = 100,
+    RadioPage_Reset = wxID_HIGHEST,
     RadioPage_Update,
     RadioPage_Selection,
     RadioPage_Label,
@@ -173,9 +173,14 @@ END_EVENT_TABLE()
 // implementation
 // ============================================================================
 
+#if defined(__WXUNIVERSAL__)
+    #define FAMILY_CTRLS UNIVERSAL_CTRLS
+#else
+    #define FAMILY_CTRLS NATIVE_CTRLS
+#endif
+
 IMPLEMENT_WIDGETS_PAGE(RadioWidgetsPage, _T("Radio"),
-                       (int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
-                       | WITH_ITEMS_CTRLS
+                       FAMILY_CTRLS | WITH_ITEMS_CTRLS
                        );
 
 RadioWidgetsPage::RadioWidgetsPage(WidgetsBookCtrl *book,
index ce234a2c4d208b1e6ee2fabd1f1baa0b560436ca..75c5839332a503fadf151878711ab63cade465e8 100644 (file)
@@ -198,9 +198,13 @@ END_EVENT_TABLE()
 // implementation
 // ============================================================================
 
-IMPLEMENT_WIDGETS_PAGE(SliderWidgetsPage, _T("Slider"),
-                       (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(SliderWidgetsPage, _T("Slider"), FAMILY_CTRLS );
 
 SliderWidgetsPage::SliderWidgetsPage(WidgetsBookCtrl *book,
                                      wxImageList *imaglist)
index 1b0fbf2055e62ae688765f7b9ed0bd38ec9e4554..9cb2f4615382d0589e18d9ad84a2210bbeb36c06 100644 (file)
@@ -54,7 +54,7 @@
 // control ids
 enum
 {
-    SpinBtnPage_Reset = 100,
+    SpinBtnPage_Reset = wxID_HIGHEST,
     SpinBtnPage_Clear,
     SpinBtnPage_SetValue,
     SpinBtnPage_SetMinAndMax,
@@ -166,9 +166,14 @@ END_EVENT_TABLE()
 // implementation
 // ============================================================================
 
+#if defined(__WXUNIVERSAL__)
+    #define FAMILY_CTRLS UNIVERSAL_CTRLS
+#else
+    #define FAMILY_CTRLS NATIVE_CTRLS
+#endif
+
 IMPLEMENT_WIDGETS_PAGE(SpinBtnWidgetsPage, _T("Spin"),
-                       (int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
-                       | EDITABLE_CTRLS
+                       FAMILY_CTRLS | EDITABLE_CTRLS
                        );
 
 SpinBtnWidgetsPage::SpinBtnWidgetsPage(WidgetsBookCtrl *book,
index 1866e8d469f9b3849e8d7b8b08d547035e7a002d..0082fde6fd9a47cf192976d1c38bf373acafa223 100644 (file)
@@ -51,7 +51,7 @@
 // control ids
 enum
 {
-    StaticPage_Reset = 100,
+    StaticPage_Reset = wxID_HIGHEST,
     StaticPage_BoxText,
     StaticPage_LabelText
 };
index c01eb60d76f7d735a9622815ce05aa1bf08a9dc9..7728ba3cc94a09a48c3b85d89eb3c804ec6c37cc 100644 (file)
@@ -53,7 +53,7 @@
 // control ids
 enum
 {
-    TextPage_Reset = 100,
+    TextPage_Reset = wxID_HIGHEST,
 
     TextPage_Set,
     TextPage_Add,
@@ -329,9 +329,16 @@ END_EVENT_TABLE()
 // implementation
 // ============================================================================
 
+#if defined(__WXX11__)
+    #define FAMILY_CTRLS NATIVE_CTRLS
+#elif defined(__WXUNIVERSAL__)
+    #define FAMILY_CTRLS UNIVERSAL_CTRLS
+#else
+    #define FAMILY_CTRLS NATIVE_CTRLS
+#endif
+
 IMPLEMENT_WIDGETS_PAGE(TextWidgetsPage, _T("Text"),
-                       (int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
-                       | EDITABLE_CTRLS
+                       FAMILY_CTRLS | EDITABLE_CTRLS
                        );
 
 // ----------------------------------------------------------------------------