]> git.saurik.com Git - wxWidgets.git/commitdiff
Small devices adjustements.
authorWłodzimierz Skiba <abx@abx.art.pl>
Fri, 26 May 2006 14:07:47 +0000 (14:07 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Fri, 26 May 2006 14:07:47 +0000 (14:07 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39344 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

15 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
samples/widgets/toggle.cpp
samples/widgets/widgets.cpp
samples/widgets/widgets.h

index 1c2304b364a315f128cd7aafa166779aea47f937..7c4dd08266772b523ebb9e58cb85ec108d818678 100644 (file)
@@ -164,10 +164,8 @@ IMPLEMENT_WIDGETS_PAGE(ButtonWidgetsPage, _T("Button"), FAMILY_CTRLS );
 
 ButtonWidgetsPage::ButtonWidgetsPage(WidgetsBookCtrl *book,
                                      wxImageList *imaglist)
-                  : WidgetsPage(book)
+                  : WidgetsPage(book, imaglist, button_xpm)
 {
-    imaglist->Add(wxBitmap(button_xpm));
-
     // init everything
     m_chkBitmap =
     m_chkImage =
index 375a7a370fb0ce37a5bf646c332f8c8c1bb12a55..384d4156e810c25dc5e8078a4c4f253ca66d97a4 100644 (file)
@@ -158,10 +158,8 @@ 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));
-
     wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
 
     // left pane
index aa9a6a8a0596a1221b521b419e22ddd6902b4d47..77e8962012ff2fe1cb6886760a94b5a0b05ba844 100644 (file)
@@ -204,7 +204,7 @@ IMPLEMENT_WIDGETS_PAGE(ComboboxWidgetsPage, _T("Combobox"),
 
 ComboboxWidgetsPage::ComboboxWidgetsPage(WidgetsBookCtrl *book,
                                          wxImageList *imaglist)
-                  : WidgetsPage(book)
+                  : WidgetsPage(book, imaglist, combobox_xpm)
 {
     // init everything
     m_chkSort =
@@ -213,8 +213,6 @@ ComboboxWidgetsPage::ComboboxWidgetsPage(WidgetsBookCtrl *book,
     m_combobox = (wxComboBox *)NULL;
     m_sizerCombo = (wxSizer *)NULL;
 
-    imaglist->Add(wxBitmap(combobox_xpm));
-
     /*
        What we create here is a frame having 3 panes: style pane is the
        leftmost one, in the middle the pane with buttons allowing to perform
index 9babbf8c0226ceb76e94467407a3b158b1714abb..65c5f84b8732b8689ec52743b02741e7873c0e0a 100644 (file)
@@ -131,10 +131,8 @@ IMPLEMENT_WIDGETS_PAGE(DatePickerWidgetsPage, wxT("DatePicker"),
 
 DatePickerWidgetsPage::DatePickerWidgetsPage(WidgetsBookCtrl *book,
                                          wxImageList *imaglist)
-                      :WidgetsPage(book)
+                      :WidgetsPage(book, imaglist, datepick_xpm)
 {
-    imaglist->Add(wxBitmap(datepick_xpm));
-
     wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
 
     // left pane
index 4affd9ab33769dca7aaa11b07dd1ef5c1d88310e..f7cd1bb582c17749ff2f5ae9cc7469f7684b6456 100644 (file)
@@ -167,10 +167,8 @@ IMPLEMENT_WIDGETS_PAGE(GaugeWidgetsPage, _T("Gauge"), FAMILY_CTRLS );
 
 GaugeWidgetsPage::GaugeWidgetsPage(WidgetsBookCtrl *book,
                                    wxImageList *imaglist)
-                 :WidgetsPage(book)
+                 :WidgetsPage(book, imaglist, gauge_xpm)
 {
-    imaglist->Add(wxBitmap(gauge_xpm));
-
     // init everything
     m_range = 100;
 
index 90de90af978ff3dcacfd60bf4172c59c48a064d6..82e6021245bebede1edc338fea6425569ac1c60d 100644 (file)
@@ -205,10 +205,8 @@ IMPLEMENT_WIDGETS_PAGE(ListboxWidgetsPage, _T("Listbox"),
 
 ListboxWidgetsPage::ListboxWidgetsPage(WidgetsBookCtrl *book,
                                        wxImageList *imaglist)
-                  : WidgetsPage(book)
+                  : WidgetsPage(book, imaglist, listbox_xpm)
 {
-    imaglist->Add(wxBitmap(listbox_xpm));
-
     // init everything
     m_radioSelMode = (wxRadioBox *)NULL;
 
index 357ac05684e63077e43b332b48b85438447c1229..add4b52b3de5ec8258083e824262261cefa31490 100644 (file)
@@ -44,6 +44,7 @@
 #include "wx/sizer.h"
 #include "wx/bookctrl.h"
 #include "wx/artprov.h"
+#include "wx/imaglist.h"
 
 #include "widgets.h"
 
@@ -85,7 +86,7 @@ enum Orient
 class BookWidgetsPage : public WidgetsPage
 {
 public:
-    BookWidgetsPage(WidgetsBookCtrl *book);
+    BookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, char* icon[]);
     virtual ~BookWidgetsPage();
 
     virtual wxControl *GetWidget() const { return m_book; }
@@ -184,8 +185,8 @@ END_EVENT_TABLE()
 // implementation
 // ============================================================================
 
-BookWidgetsPage::BookWidgetsPage(WidgetsBookCtrl *book)
-                :WidgetsPage(book)
+BookWidgetsPage::BookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, char* icon[])
+                :WidgetsPage(book, imaglist, icon)
 {
     // init everything
     m_chkImages = NULL;
@@ -519,9 +520,8 @@ class NotebookWidgetsPage : public BookWidgetsPage
 {
 public:
     NotebookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
-        : BookWidgetsPage(book)
+        : BookWidgetsPage(book, imaglist, notebook_xpm)
     {
-        imaglist->Add(wxBitmap(notebook_xpm));
         RecreateBook();
     }
     virtual ~NotebookWidgetsPage() {}
@@ -602,9 +602,8 @@ class ListbookWidgetsPage : public BookWidgetsPage
 {
 public:
     ListbookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
-        : BookWidgetsPage(book)
+        : BookWidgetsPage(book, imaglist, listbook_xpm)
     {
-        imaglist->Add(wxBitmap(listbook_xpm));
         RecreateBook();
     }
     virtual ~ListbookWidgetsPage() {}
@@ -677,9 +676,8 @@ class ChoicebookWidgetsPage : public BookWidgetsPage
 {
 public:
     ChoicebookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
-        : BookWidgetsPage(book)
+        : BookWidgetsPage(book, imaglist, choicebk_xpm)
     {
-        imaglist->Add(wxBitmap(choicebk_xpm));
         RecreateBook();
     }
     virtual ~ChoicebookWidgetsPage() {}
index 088da04a98c271e6cb726df049bb800976400a81..9f647fd92eb0eb6f14b8a2851093232370a97c1a 100644 (file)
@@ -185,10 +185,8 @@ IMPLEMENT_WIDGETS_PAGE(RadioWidgetsPage, _T("Radio"),
 
 RadioWidgetsPage::RadioWidgetsPage(WidgetsBookCtrl *book,
                                    wxImageList *imaglist)
-                  : WidgetsPage(book)
+                  : WidgetsPage(book, imaglist, radio_xpm)
 {
-    imaglist->Add(wxBitmap(radio_xpm));
-
     // init everything
     m_chkVert = (wxCheckBox *)NULL;
     m_chkEnableItem = (wxCheckBox *)NULL;
index 75c5839332a503fadf151878711ab63cade465e8..4502d6c87148532835d9472670bbe48310091a51 100644 (file)
@@ -208,10 +208,8 @@ IMPLEMENT_WIDGETS_PAGE(SliderWidgetsPage, _T("Slider"), FAMILY_CTRLS );
 
 SliderWidgetsPage::SliderWidgetsPage(WidgetsBookCtrl *book,
                                      wxImageList *imaglist)
-                  : WidgetsPage(book)
+                  : WidgetsPage(book, imaglist, slider_xpm)
 {
-    imaglist->Add(wxBitmap(slider_xpm));
-
     // init everything
     m_min = 0;
     m_max = 100;
index 9cb2f4615382d0589e18d9ad84a2210bbeb36c06..125d533bf3dd43f446d282e1eff40af4737cdb6f 100644 (file)
@@ -178,7 +178,7 @@ IMPLEMENT_WIDGETS_PAGE(SpinBtnWidgetsPage, _T("Spin"),
 
 SpinBtnWidgetsPage::SpinBtnWidgetsPage(WidgetsBookCtrl *book,
                                        wxImageList *imaglist)
-                  : WidgetsPage(book)
+                  : WidgetsPage(book, imaglist, spinbtn_xpm)
 {
     m_chkVert = NULL;
     m_chkWrap = NULL;
@@ -187,7 +187,6 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(WidgetsBookCtrl *book,
     m_textValue = NULL;
     m_textMin = NULL;
     m_textMax = NULL;
-    imaglist->Add(wxBitmap(spinbtn_xpm));
 
     // init everything
     m_min = 0;
index 0082fde6fd9a47cf192976d1c38bf373acafa223..05c13669092853523c59821707015315528d1710 100644 (file)
@@ -210,10 +210,8 @@ IMPLEMENT_WIDGETS_PAGE(StaticWidgetsPage, _T("Static"),
 
 StaticWidgetsPage::StaticWidgetsPage(WidgetsBookCtrl *book,
                                      wxImageList *imaglist)
-                  : WidgetsPage(book)
+                  : WidgetsPage(book, imaglist, statbox_xpm)
 {
-    imaglist->Add(wxBitmap(statbox_xpm));
-
     // init everything
     m_chkVert =
     m_chkAutoResize = (wxCheckBox *)NULL;
index 7728ba3cc94a09a48c3b85d89eb3c804ec6c37cc..87bf0c0cfa1b6120b3a75f0122a4399b75c891b2 100644 (file)
@@ -346,10 +346,8 @@ IMPLEMENT_WIDGETS_PAGE(TextWidgetsPage, _T("Text"),
 // ----------------------------------------------------------------------------
 
 TextWidgetsPage::TextWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
-               : WidgetsPage(book)
+               : WidgetsPage(book, imaglist, text_xpm)
 {
-    imaglist->Add(wxBitmap(text_xpm));
-
     // init everything
 #ifdef __WXMSW__
     m_radioKind =
index 626bc0c2bb4af89d39390b6b8b5f26ddb2e0473a..214474f7ade23e565e24397ee4e3b6764f905119 100644 (file)
@@ -34,6 +34,7 @@
 #ifndef WX_PRECOMP
     #include "wx/sizer.h"
     #include "wx/statbox.h"
+    #include "wx/textctrl.h"
 #endif
 
 #include "icons/toggle.xpm"
@@ -114,10 +115,8 @@ IMPLEMENT_WIDGETS_PAGE(ToggleWidgetsPage, wxT("ToggleButton"),
 
 ToggleWidgetsPage::ToggleWidgetsPage(WidgetsBookCtrl *book,
                                      wxImageList *imaglist)
-                      :WidgetsPage(book)
+                      :WidgetsPage(book, imaglist, toggle_xpm)
 {
-    imaglist->Add(wxBitmap(toggle_xpm));
-
     wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
 
     // left pane
index 1a371f0bd9f5ba4dbee78c7cea91f72130f5d32a..533b35e8190e470c94f417d3ba6bac436d99d5c1 100644 (file)
@@ -47,6 +47,7 @@
 #include "wx/colordlg.h"
 #include "wx/fontdlg.h"
 #include "wx/textdlg.h"
+#include "wx/imaglist.h"
 
 #include "widgets.h"
 
@@ -380,7 +381,7 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
     // we have 2 panes: book with pages demonstrating the controls in the
     // upper one and the log window with some buttons in the lower
 
-    int style = wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN|wxBK_DEFAULT;
+    int style = wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN|WidgetBookStyle;
     // Uncomment to suppress page theme (draw in solid colour)
     //style |= wxNB_NOPAGETHEME;
 
@@ -393,7 +394,7 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
         style);
     InitBook();
 
-#ifndef __SMARTPHONE__
+#ifndef __WXHANDHELD__
     // the lower one only has the log listbox and a button to clear it
 #if USE_LOG
     wxSizer *sizerDown = new wxStaticBoxSizer(
@@ -423,11 +424,11 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
     sizerTop->Add(0, 5, 0, wxGROW); // spacer in between
     sizerTop->Add(sizerDown, 0,  wxGROW | (wxALL & ~wxTOP), 10);
 
-#else // !__SMARTPHONE__/__SMARTPHONE__
+#else // !__WXHANDHELD__/__WXHANDHELD__
 
     sizerTop->Add(m_book, 1, wxGROW | wxALL );
 
-#endif // __SMARTPHONE__
+#endif // __WXHANDHELD__
 
     m_panel->SetSizer(sizerTop);
 
@@ -445,9 +446,13 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
 
 void WidgetsFrame::InitBook()
 {
+#if USE_ICONS_IN_BOOK
     wxImageList *imageList = new wxImageList(32, 32);
 
     imageList->Add(wxBitmap(sample_xpm));
+#else
+    wxImageList *imageList = NULL;
+#endif
 
 #if !USE_TREEBOOK
     WidgetsBookCtrl *books[MAX_PAGES];
@@ -469,7 +474,11 @@ void WidgetsFrame::InitBook()
 #if USE_TREEBOOK
         nPage++; // increase for parent page
 #else
-        books[cat] = new WidgetsBookCtrl( m_book, wxID_ANY );
+        books[cat] = new WidgetsBookCtrl(m_book,
+                                         wxID_ANY,
+                                         wxDefaultPosition,
+                                         wxDefaultSize,
+                                         WidgetBookStyle);
 #endif
 
         for ( WidgetsPageInfo *info = WidgetsPage::ms_widgetPages;
@@ -517,7 +526,9 @@ void WidgetsFrame::InitBook()
 
     GetMenuBar()->Append(menuPages, _T("&Page"));
 
+#if USE_ICONS_IN_BOOK
     m_book->AssignImageList(imageList);
+#endif
 
     for ( cat = 0; cat < MAX_PAGES; cat++ )
     {
@@ -525,7 +536,9 @@ void WidgetsFrame::InitBook()
         m_book->AddPage(NULL,WidgetsCategories[cat],false,0);
 #else
         m_book->AddPage(books[cat],WidgetsCategories[cat],false,0);
+#if USE_ICONS_IN_BOOK
         books[cat]->SetImageList(imageList);
+#endif
 #endif
 
         // now do add them
@@ -816,13 +829,21 @@ WidgetsPageInfo::WidgetsPageInfo(Constructor ctor, const wxChar *label, int cate
 int WidgetsPage::ms_defaultFlags = wxBORDER_DEFAULT;
 WidgetsPageInfo *WidgetsPage::ms_widgetPages = NULL;
 
-WidgetsPage::WidgetsPage(WidgetsBookCtrl *book)
+WidgetsPage::WidgetsPage(WidgetsBookCtrl *book,
+                         wxImageList *imaglist,
+                         char* icon[])
            : wxPanel(book, wxID_ANY,
                      wxDefaultPosition, wxDefaultSize,
                      wxNO_FULL_REPAINT_ON_RESIZE |
                      wxCLIP_CHILDREN |
                      wxTAB_TRAVERSAL)
 {
+#if USE_ICONS_IN_BOOK
+    imaglist->Add(wxBitmap(icon));
+#else
+    wxUnusedVar(imaglist);
+    wxUnusedVar(icon);
+#endif
 }
 
 wxSizer *WidgetsPage::CreateSizerWithText(wxControl *control,
index c1abc26796ba7d1b44dffd38b6228bdcbd9b73a3..ca2a8e7cca83e89bd529bc22102d3cd0f18c84c4 100644 (file)
     #define WidgetsBookCtrl wxTreebook
     #define WidgetsBookCtrlEvent wxTreebookEvent
     #define EVT_WIDGETS_PAGE_CHANGED(id,func) EVT_TREEBOOK_PAGE_CHANGED(id,func)
+    #define WidgetBookStyle (wxBK_DEFAULT)
 #else
     #include "wx/bookctrl.h"
     #define USE_TREEBOOK 0
     #define WidgetsBookCtrl wxBookCtrl
     #define WidgetsBookCtrlEvent wxBookCtrlEvent
     #define EVT_WIDGETS_PAGE_CHANGED(id,func) EVT_BOOKCTRL_PAGE_CHANGED(id,func)
+    #ifdef __POCKETPC__
+        #define WidgetBookStyle (wxBK_BOTTOM|wxNB_FLAT)
+    #else
+        #define WidgetBookStyle (wxBK_DEFAULT)
+    #endif
 #endif
 
-#if wxUSE_LOG && !defined(__SMARTPHONE__)
+#if wxUSE_LOG && !defined(__WXHANDHELD__)
     #define USE_LOG 1
 #else
     #define USE_LOG 0
 #endif
 
+#if defined(__WXHANDHELD__)
+    #define USE_ICONS_IN_BOOK 0
+#else
+    #define USE_ICONS_IN_BOOK 1
+#endif
+
 class WXDLLEXPORT wxCheckBox;
 class WXDLLEXPORT wxSizer;
+class WXDLLEXPORT wxImageList;
 class WXDLLEXPORT wxTextCtrl;
 class WXDLLEXPORT WidgetsBookCtrl;
 
@@ -41,9 +54,6 @@ class WidgetsPageInfo;
 
 #include "wx/panel.h"
 
-// all source files use wxImageList
-#include "wx/imaglist.h"
-
 // INTRODUCING NEW PAGES DON'T FORGET TO ADD ENTRIES TO 'WidgetsCategories'
 enum
 {
@@ -81,7 +91,9 @@ enum
 class WidgetsPage : public wxPanel
 {
 public:
-    WidgetsPage(WidgetsBookCtrl *book);
+    WidgetsPage(WidgetsBookCtrl *book,
+                wxImageList *imaglist,
+                char* icon[]);
 
     // return the control shown by this page
     virtual wxControl *GetWidget() const = 0;