From 32fc355f09c485ea0294c8a7aebf930598d67d31 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sun, 25 Jan 2009 20:22:37 +0000 Subject: [PATCH] Finally corrected drawing of wxListCtrl selection rect for GTK+ git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58415 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/listctrl.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index f33e2b1437..ef431f2f9b 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -358,7 +358,8 @@ public: void DrawInReportMode( wxDC *dc, const wxRect& rect, const wxRect& rectHL, - bool highlighted ); + bool highlighted, + bool current ); private: // set the line to contain num items (only can be > 1 in report mode) @@ -1537,7 +1538,8 @@ void wxListLineData::Draw( wxDC *dc ) void wxListLineData::DrawInReportMode( wxDC *dc, const wxRect& rect, const wxRect& rectHL, - bool highlighted ) + bool highlighted, + bool current ) { // TODO: later we should support setting different attributes for // different columns - to do it, just add "col" argument to @@ -1555,6 +1557,8 @@ void wxListLineData::DrawInReportMode( wxDC *dc, int flags = wxCONTROL_SELECTED; if (m_owner->HasFocus()) flags |= wxCONTROL_FOCUSED; + if (current) + flags |= wxCONTROL_CURRENT; wxRendererNative::Get().DrawItemSelectionRect( m_owner, *dc, rectHL, flags ); } else @@ -2807,7 +2811,8 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) GetLine(line)->DrawInReportMode( &dc, rectLine, GetLineHighlightRect(line), - IsHighlighted(line) ); + IsHighlighted(line), + line == m_current ); } if ( HasFlag(wxLC_HRULES) ) @@ -2867,21 +2872,17 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) } } -#ifndef __WXMAC__ +#if !defined( __WXMAC__) && !defined(__WXGTK20__) // Don't draw rect outline under Mac at all. + // Draw it elsewhere under GTK. if ( HasCurrent() ) { if ( m_hasFocus ) { wxRect rect( GetLineHighlightRect( m_current ) ); -#ifndef __WXGTK20__ dc.SetPen( *wxBLACK_PEN ); dc.SetBrush( *wxTRANSPARENT_BRUSH ); dc.DrawRectangle( rect ); -#else - wxRendererNative::Get().DrawItemSelectionRect( this, dc, rect, wxCONTROL_CURRENT|wxCONTROL_FOCUSED ); - -#endif } } #endif -- 2.45.2