To have better support for themed and custom backgrounds for wxMSW wxComboCtrl, use WS_EX_COMPOSITED and wxBG_STYLE_ERASE instead of custom double-buffering (when made possible by the OS version)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67276 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -94,6 +94,8 @@ protected:
|
|||||||
void OnPaintEvent( wxPaintEvent& event );
|
void OnPaintEvent( wxPaintEvent& event );
|
||||||
void OnMouseEvent( wxMouseEvent& event );
|
void OnMouseEvent( wxMouseEvent& event );
|
||||||
|
|
||||||
|
virtual bool HasTransparentBackground() { return IsDoubleBuffered(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
@@ -202,15 +202,18 @@ bool wxComboCtrl::Create(wxWindow *parent,
|
|||||||
if ( style & wxCC_STD_BUTTON )
|
if ( style & wxCC_STD_BUTTON )
|
||||||
m_iFlags |= wxCC_POPUP_ON_MOUSE_UP;
|
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
|
// Create textctrl, if necessary
|
||||||
CreateTextCtrl( wxNO_BORDER );
|
CreateTextCtrl( wxNO_BORDER );
|
||||||
|
|
||||||
// Add keyboard input handlers for main control and textctrl
|
// Add keyboard input handlers for main control and textctrl
|
||||||
InstallInputHandlers();
|
InstallInputHandlers();
|
||||||
|
|
||||||
// Prepare background for double-buffering
|
|
||||||
SetBackgroundStyle( wxBG_STYLE_CUSTOM );
|
|
||||||
|
|
||||||
// SetInitialSize should be called last
|
// SetInitialSize should be called last
|
||||||
SetInitialSize(size);
|
SetInitialSize(size);
|
||||||
|
|
||||||
@@ -434,7 +437,8 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
|
|||||||
// TODO: Convert drawing in this function to Windows API Code
|
// TODO: Convert drawing in this function to Windows API Code
|
||||||
|
|
||||||
wxSize sz = GetClientSize();
|
wxSize sz = GetClientSize();
|
||||||
wxAutoBufferedPaintDC dc(this);
|
wxDC* dcPtr = wxAutoBufferedPaintDCFactory(this);
|
||||||
|
wxDC& dc = *dcPtr;
|
||||||
|
|
||||||
const wxRect& rectButton = m_btnArea;
|
const wxRect& rectButton = m_btnArea;
|
||||||
wxRect rectTextField = m_tcArea;
|
wxRect rectTextField = m_tcArea;
|
||||||
@@ -640,6 +644,8 @@ void wxComboCtrl::OnPaintEvent( wxPaintEvent& WXUNUSED(event) )
|
|||||||
else
|
else
|
||||||
wxComboPopup::DefaultPaintComboControl(this,dc,rectTextField);
|
wxComboPopup::DefaultPaintComboControl(this,dc,rectTextField);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete dcPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxComboCtrl::OnMouseEvent( wxMouseEvent& event )
|
void wxComboCtrl::OnMouseEvent( wxMouseEvent& event )
|
||||||
|
Reference in New Issue
Block a user