From f09b3de914286e163e6ffa494389e4f295ad65fa Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 20 Dec 2018 02:00:05 +0100 Subject: [PATCH] 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 4ac0250f9030b30140976198094413a7c55c3f4a 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. --- src/generic/datavgen.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 38ab4f7a60..21b4bc02de 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -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 ); } }