]> git.saurik.com Git - wxWidgets.git/commitdiff
To have better support for themed and custom backgrounds for wxMSW wxComboCtrl, use...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Tue, 22 Mar 2011 09:56:40 +0000 (09:56 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Tue, 22 Mar 2011 09:56:40 +0000 (09:56 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67276 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/combo.h
src/msw/combo.cpp

index c5b27687d72b9ff5451e992cbfa062c82bb773b9..f30bc1a30993cc0629a52c38fb8096de21240dc3 100644 (file)
@@ -94,6 +94,8 @@ protected:
     void OnPaintEvent( wxPaintEvent& event );
     void OnMouseEvent( wxMouseEvent& event );
 
+    virtual bool HasTransparentBackground() { return IsDoubleBuffered(); }
+
 private:
     void Init();
 
index b85366b78c4a9aaaa69a88d8631a5e6fdbbfeace..1e59def4d8714cd8fac1cc11bcbf2bc3f5624762 100644 (file)
@@ -202,15 +202,18 @@ bool wxComboCtrl::Create(wxWindow *parent,
     if ( style & wxCC_STD_BUTTON )
         m_iFlags |= wxCC_POPUP_ON_MOUSE_UP;
 
+    // Prepare background for double-buffering or better background theme
+    // support, whichever is possible.
+    SetDoubleBuffered(true);
+    if ( !IsDoubleBuffered() )
+        SetBackgroundStyle( wxBG_STYLE_PAINT );
+
     // Create textctrl, if necessary
     CreateTextCtrl( wxNO_BORDER );
 
     // Add keyboard input handlers for main control and textctrl
     InstallInputHandlers();
 
-    // Prepare background for double-buffering
-    SetBackgroundStyle( wxBG_STYLE_CUSTOM );
-
     // SetInitialSize should be called last
     SetInitialSize(size);
 
@@ -434,7 +437,8 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
     // TODO: Convert drawing in this function to Windows API Code
 
     wxSize sz = GetClientSize();
-    wxAutoBufferedPaintDC dc(this);
+    wxDC* dcPtr = wxAutoBufferedPaintDCFactory(this);
+    wxDC& dc = *dcPtr;
 
     const wxRect& rectButton = m_btnArea;
     wxRect rectTextField = m_tcArea;
@@ -640,6 +644,8 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
         else
             wxComboPopup::DefaultPaintComboControl(this,dc,rectTextField);
     }
+
+    delete dcPtr;
 }
 
 void wxComboCtrl::OnMouseEvent( wxMouseEvent& event )