Restore drawing item focus rectangle in generic wxDataViewCtrl

The current, but not selected, item was not visually marked in any way
since the changes of 4ac0250f90 which
replaced the calls to wxRendererNative::DrawFocusRect() with the calls
to DrawItemSelectionRect() which is not called when the item is not
selected.

Restore DrawFocusRect() call in this case and also pass
wxCONTROL_FOCUSED to DrawItemSelectionRect() even though this doesn't
seem to change much in practice.

Closes https://github.com/wxWidgets/wxWidgets/pull/1089

Closes #18304.
This commit is contained in:
Vadim Zeitlin 2018-12-20 02:00:05 +01:00
parent 288d26598c
commit f09b3de914

View File

@ -2455,6 +2455,24 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
colRect.x += colRect.width;
}
}
else // Not using column focus.
{
flags |= wxCONTROL_CURRENT | wxCONTROL_FOCUSED;
// We still need to show the current item if it's not
// selected.
if ( !selected )
{
wxRendererNative::Get().DrawFocusRect
(
this,
dc,
rowRect,
flags
);
}
//else: The current item is selected, will be drawn below.
}
}
// draw selection and whole-item focus:
@ -2465,7 +2483,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
this,
dc,
rowRect,
flags | wxCONTROL_CURRENT
flags
);
}
}