Only draw selection rectangle for selected items in wxVListBox
Closes #22562. Closes #23641.
This commit is contained in:
parent
f8af562b20
commit
11ee5b4df5
1 changed files with 9 additions and 4 deletions
|
|
@ -418,14 +418,19 @@ wxVListBox::DoDrawSolidBackground(const wxColour& col,
|
|||
void wxVListBox::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const
|
||||
{
|
||||
// use wxRendererNative for more native look unless we use custom bg colour
|
||||
if ( !DoDrawSolidBackground(m_colBgSel, dc, rect, n) )
|
||||
if ( DoDrawSolidBackground(m_colBgSel, dc, rect, n) )
|
||||
return;
|
||||
|
||||
const bool isSelected = IsSelected(n),
|
||||
isCurrent = IsCurrent(n);
|
||||
if ( isSelected || isCurrent )
|
||||
{
|
||||
int flags = 0;
|
||||
if ( IsSelected(n) )
|
||||
if ( isSelected )
|
||||
flags |= wxCONTROL_SELECTED;
|
||||
if ( IsCurrent(n) )
|
||||
if ( isCurrent )
|
||||
flags |= wxCONTROL_CURRENT;
|
||||
if ( wxWindow::FindFocus() == const_cast<wxVListBox*>(this) )
|
||||
if ( HasFocus() )
|
||||
flags |= wxCONTROL_FOCUSED;
|
||||
|
||||
wxRendererNative::Get().DrawItemSelectionRect(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue