From 3e4e0908a7c8217f87d1c7a521f590c1de3bc0f9 Mon Sep 17 00:00:00 2001 From: Jaakko Salli Date: Tue, 22 Mar 2011 08:59:59 +0000 Subject: [PATCH] In wxComboCtrlBase::DrawButton(), let the button background rendering changes also apply to buttons with user-defined bitmaps git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67275 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/combocmn.cpp | 54 +++++++++++++++++-------------------------------- 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/src/common/combocmn.cpp b/src/common/combocmn.cpp index 39e2ecb..1432300 100644 --- a/src/common/combocmn.cpp +++ b/src/common/combocmn.cpp @@ -1647,27 +1647,28 @@ void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, int flags ) if ( !enabled ) drawState |= wxCONTROL_DISABLED; - if ( !m_bmpNormal.Ok() ) + // Need to clear button background even if m_btn is present + // and also when using custom bitmap for the button + if ( (flags & Button_PaintBackground) && + (!HasTransparentBackground() || + !(m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE)) ) { - if ( flags & Button_BitmapOnly ) - return; + wxColour bgCol; - // Need to clear button background even if m_btn is present - if ( (flags & Button_PaintBackground) && - (!HasTransparentBackground() || - !(m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE)) ) - { - wxColour bgCol; + if ( m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE ) + bgCol = GetParent()->GetBackgroundColour(); + else + bgCol = GetBackgroundColour(); - if ( m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE ) - bgCol = GetParent()->GetBackgroundColour(); - else - bgCol = GetBackgroundColour(); + dc.SetBrush(bgCol); + dc.SetPen(bgCol); + dc.DrawRectangle(rect); + } - dc.SetBrush(bgCol); - dc.SetPen(bgCol); - dc.DrawRectangle(rect); - } + if ( !m_bmpNormal.Ok() ) + { + if ( flags & Button_BitmapOnly ) + return; // Draw standard button wxRendererNative::Get().DrawComboBoxDropButton(this, @@ -1692,17 +1693,6 @@ void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, int flags ) if ( m_blankButtonBg ) { - // If using blank button background, we need to clear its background - // with button face colour instead of colour for rest of the control. - if ( flags & Button_PaintBackground ) - { - wxColour bgCol = GetParent()->GetBackgroundColour(); //wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE); - //wxColour bgCol = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); - dc.SetPen(bgCol); - dc.SetBrush(bgCol); - dc.DrawRectangle(rect); - } - if ( !(flags & Button_BitmapOnly) ) { wxRendererNative::Get().DrawPushButton(this, @@ -1711,14 +1701,6 @@ void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, int flags ) drawState); } } - else - - { - // Need to clear button background even if m_btn is present - // (assume non-button background was cleared just before this call so brushes are good) - if ( flags & Button_PaintBackground ) - dc.DrawRectangle(rect); - } // Draw bitmap centered in drawRect dc.DrawBitmap(*pBmp, -- 2.7.4