]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/combo/combo.cpp
reSWIGged
[wxWidgets.git] / samples / combo / combo.cpp
index 6b5ced6c6ea24e81c3b7803fdf65a97ca77aa3b8..5f8e7fea591c87fcaeeac2dcf82873aa8f80d9be 100644 (file)
@@ -228,8 +228,10 @@ public:
                                    int item, int flags ) const
     {
 
-        // If item is selected or even, 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) ||
              (item & 1) == 0 )
         {
             wxOwnerDrawnComboBox::OnDrawBackground(dc,rect,item,flags);
@@ -557,6 +559,11 @@ public:
         }
     }
 
+    // Implement empty DoSetPopupControl to prevent assertion failure.
+    virtual void DoSetPopupControl(wxComboPopup* WXUNUSED(popup))
+    {
+    }
+
 private:
     void Init()
     {
@@ -694,8 +701,11 @@ MyFrame::MyFrame(const wxString& title)
 
 
     odc->SetSelection(0);
-    odc->SetButtonPosition(-2, // width adjustment
-                           -6, // height adjustment
+
+    // Use button size that is slightly smaller than the default.
+    wxSize butSize = odc->GetButtonSize();
+    odc->SetButtonPosition(butSize.x - 2, // button width
+                           butSize.y - 6, // button height
                            wxLEFT, // side
                            2 // horizontal spacing
                           );
@@ -764,8 +774,8 @@ MyFrame::MyFrame(const wxString& title)
     gcc->SetValue(wxT("Subitem 05"));
 
     // Move button to left - it makes more sense for a tree ctrl
-    gcc->SetButtonPosition(0, // width adjustment
-                           0, // height adjustment
+    gcc->SetButtonPosition(-1, // button width
+                           -1, // button height
                            wxLEFT, // side
                            0 // horizontal spacing
                           );