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:
@@ -1647,28 +1647,29 @@ void wxComboCtrlBase::DrawButton( wxDC& dc, const wxRect& rect, int flags )
|
||||
if ( !enabled )
|
||||
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 ( flags & Button_BitmapOnly )
|
||||
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
|
||||
wxRendererNative::Get().DrawComboBoxDropButton(this,
|
||||
dc,
|
||||
@@ -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,
|
||||
|
Reference in New Issue
Block a user