Avoid drawing selection rectangle when not selected
The draw used wxTRANSPARENT_BRUSH in that case, so it was a no-op, but better to not do it at all
This commit is contained in:
parent
419f899b3d
commit
4eeae960a3
@ -363,26 +363,18 @@ void wxRendererMSWBase::DrawItemSelectionRect(wxWindow *win,
|
||||
return;
|
||||
}
|
||||
|
||||
wxBrush brush;
|
||||
if ( flags & wxCONTROL_SELECTED )
|
||||
{
|
||||
if ( flags & wxCONTROL_FOCUSED )
|
||||
wxColour color(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
|
||||
if ((flags & wxCONTROL_FOCUSED) == 0)
|
||||
{
|
||||
brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
|
||||
color = wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE);
|
||||
}
|
||||
else // !focused
|
||||
{
|
||||
brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||
}
|
||||
}
|
||||
else // !selected
|
||||
{
|
||||
brush = *wxTRANSPARENT_BRUSH;
|
||||
}
|
||||
|
||||
wxDCBrushChanger setBrush(dc, brush);
|
||||
wxDCPenChanger setPen(dc, *wxTRANSPARENT_PEN);
|
||||
dc.DrawRectangle( rect );
|
||||
wxDCBrushChanger setBrush(dc, wxBrush(color));
|
||||
wxDCPenChanger setPen(dc, *wxTRANSPARENT_PEN);
|
||||
dc.DrawRectangle(rect);
|
||||
}
|
||||
|
||||
if ((flags & wxCONTROL_FOCUSED) && (flags & wxCONTROL_CURRENT))
|
||||
DrawFocusRect( win, dc, rect, flags );
|
||||
|
Loading…
Reference in New Issue
Block a user