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
This commit is contained in:
Jaakko Salli
2011-03-22 08:59:59 +00:00
parent ef72c99e5b
commit 3e4e0908a7

View File

@@ -1647,28 +1647,29 @@ void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, int flags )
if ( !enabled ) if ( !enabled )
drawState |= wxCONTROL_DISABLED; drawState |= wxCONTROL_DISABLED;
// 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)) )
{
wxColour bgCol;
if ( m_iFlags & wxCC_IFLAG_BUTTON_OUTSIDE )
bgCol = GetParent()->GetBackgroundColour();
else
bgCol = GetBackgroundColour();
dc.SetBrush(bgCol);
dc.SetPen(bgCol);
dc.DrawRectangle(rect);
}
if ( !m_bmpNormal.Ok() ) if ( !m_bmpNormal.Ok() )
{ {
if ( flags & Button_BitmapOnly ) if ( flags & Button_BitmapOnly )
return; return;
// 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();
dc.SetBrush(bgCol);
dc.SetPen(bgCol);
dc.DrawRectangle(rect);
}
// Draw standard button // Draw standard button
wxRendererNative::Get().DrawComboBoxDropButton(this, wxRendererNative::Get().DrawComboBoxDropButton(this,
dc, dc,
@@ -1692,17 +1693,6 @@ void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, int flags )
if ( m_blankButtonBg ) 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) ) if ( !(flags & Button_BitmapOnly) )
{ {
wxRendererNative::Get().DrawPushButton(this, wxRendererNative::Get().DrawPushButton(this,
@@ -1711,14 +1701,6 @@ void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, int flags )
drawState); 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 // Draw bitmap centered in drawRect
dc.DrawBitmap(*pBmp, dc.DrawBitmap(*pBmp,