]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/odcombobox.cpp
fixing infinite recursion for rotated text, introduced in cleanup r57915
[wxWidgets.git] / samples / widgets / odcombobox.cpp
index 92823d895dd2ea68f98b32ea3e0041fd00795205..34d90347a7e1e5a77e6ae6fc637fae01b7c1e06b 100644 (file)
@@ -45,6 +45,7 @@
 #include "wx/odcombo.h"
 
 
 #include "wx/odcombo.h"
 
 
+#include "itemcontainer.h"
 #include "widgets.h"
 
 #include "icons/odcombobox.xpm"
 #include "widgets.h"
 
 #include "icons/odcombobox.xpm"
@@ -76,7 +77,8 @@ enum
     ODComboPage_Delete,
     ODComboPage_DeleteText,
     ODComboPage_DeleteSel,
     ODComboPage_Delete,
     ODComboPage_DeleteText,
     ODComboPage_DeleteSel,
-    ODComboPage_Combo
+    ODComboPage_Combo,
+    ODComboPage_ContainerTests
 };
 
 
 };
 
 
@@ -84,12 +86,15 @@ enum
 // ODComboboxWidgetsPage
 // ----------------------------------------------------------------------------
 
 // ODComboboxWidgetsPage
 // ----------------------------------------------------------------------------
 
-class ODComboboxWidgetsPage : public WidgetsPage
+class ODComboboxWidgetsPage : public ItemContainerWidgetsPage
 {
 public:
     ODComboboxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
 
     virtual wxControl *GetWidget() const { return m_combobox; }
 {
 public:
     ODComboboxWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
 
     virtual wxControl *GetWidget() const { return m_combobox; }
+    virtual wxTextEntryBase *GetTextEntry() const
+        { return m_combobox ? m_combobox->GetTextCtrl() : NULL; }
+    virtual wxItemContainer* GetContainer() const { return m_combobox; }
     virtual void RecreateWidget() { CreateCombo(); }
 
     // lazy creation of the content
     virtual void RecreateWidget() { CreateCombo(); }
 
     // lazy creation of the content
@@ -188,6 +193,7 @@ BEGIN_EVENT_TABLE(ODComboboxWidgetsPage, WidgetsPage)
     EVT_BUTTON(ODComboPage_Add, ODComboboxWidgetsPage::OnButtonAdd)
     EVT_BUTTON(ODComboPage_AddSeveral, ODComboboxWidgetsPage::OnButtonAddSeveral)
     EVT_BUTTON(ODComboPage_AddMany, ODComboboxWidgetsPage::OnButtonAddMany)
     EVT_BUTTON(ODComboPage_Add, ODComboboxWidgetsPage::OnButtonAdd)
     EVT_BUTTON(ODComboPage_AddSeveral, ODComboboxWidgetsPage::OnButtonAddSeveral)
     EVT_BUTTON(ODComboPage_AddMany, ODComboboxWidgetsPage::OnButtonAddMany)
+    EVT_BUTTON(ODComboPage_ContainerTests, ItemContainerWidgetsPage::OnButtonTestItemContainer)
 
     EVT_TEXT_ENTER(ODComboPage_InsertText, ODComboboxWidgetsPage::OnButtonInsert)
     EVT_TEXT_ENTER(ODComboPage_AddText, ODComboboxWidgetsPage::OnButtonAdd)
 
     EVT_TEXT_ENTER(ODComboPage_InsertText, ODComboboxWidgetsPage::OnButtonInsert)
     EVT_TEXT_ENTER(ODComboPage_AddText, ODComboboxWidgetsPage::OnButtonAdd)
@@ -264,8 +270,7 @@ public:
 
         // If item is selected or even, or we are painting the
         // combo control itself, use the default rendering.
 
         // If item is selected or even, or we are painting the
         // combo control itself, use the default rendering.
-        if ( GetVListBoxComboPopup()->IsCurrent((size_t)item) ||
-             (flags & wxODCB_PAINTING_CONTROL) ||
+        if ( (flags & (wxODCB_PAINTING_CONTROL|wxODCB_PAINTING_SELECTED)) ||
              (item & 1) == 0 )
         {
             wxOwnerDrawnComboBox::OnDrawBackground(dc,rect,item,flags);
              (item & 1) == 0 )
         {
             wxOwnerDrawnComboBox::OnDrawBackground(dc,rect,item,flags);
@@ -297,7 +302,7 @@ IMPLEMENT_WIDGETS_PAGE(ODComboboxWidgetsPage, _T("OwnerDrawnCombobox"),
 
 ODComboboxWidgetsPage::ODComboboxWidgetsPage(WidgetsBookCtrl *book,
                                              wxImageList *imaglist)
 
 ODComboboxWidgetsPage::ODComboboxWidgetsPage(WidgetsBookCtrl *book,
                                              wxImageList *imaglist)
-                  : WidgetsPage(book, imaglist, odcombobox_xpm)
+                  : ItemContainerWidgetsPage(book, imaglist, odcombobox_xpm)
 {
     // init everything
     m_chkSort =
 {
     // init everything
     m_chkSort =
@@ -395,6 +400,9 @@ void ODComboboxWidgetsPage::CreateContent()
         _T("&Change combobox contents"));
     wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
 
         _T("&Change combobox contents"));
     wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
 
+    btn = new wxButton(this, ODComboPage_ContainerTests, _T("Run &tests"));
+    sizerMiddle->Add(btn, 0, wxALL | wxGROW, 5);
+
     sizerRow = CreateSizerWithTextAndLabel(_T("Current selection"),
                                            ODComboPage_CurText,
                                            &text);
     sizerRow = CreateSizerWithTextAndLabel(_T("Current selection"),
                                            ODComboPage_CurText,
                                            &text);
@@ -465,8 +473,6 @@ void ODComboboxWidgetsPage::CreateContent()
     Reset();
 
     SetSizer(sizerTop);
     Reset();
 
     SetSizer(sizerTop);
-
-    sizerTop->Fit(this);
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------