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
This commit is contained in:
Robert Roebling
2009-01-25 20:22:37 +00:00
parent ec676e4ff1
commit 32fc355f09

View File

@@ -358,7 +358,8 @@ public:
void DrawInReportMode( wxDC *dc, void DrawInReportMode( wxDC *dc,
const wxRect& rect, const wxRect& rect,
const wxRect& rectHL, const wxRect& rectHL,
bool highlighted ); bool highlighted,
bool current );
private: private:
// set the line to contain num items (only can be > 1 in report mode) // 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, void wxListLineData::DrawInReportMode( wxDC *dc,
const wxRect& rect, const wxRect& rect,
const wxRect& rectHL, const wxRect& rectHL,
bool highlighted ) bool highlighted,
bool current )
{ {
// TODO: later we should support setting different attributes for // TODO: later we should support setting different attributes for
// different columns - to do it, just add "col" argument to // different columns - to do it, just add "col" argument to
@@ -1555,6 +1557,8 @@ void wxListLineData::DrawInReportMode( wxDC *dc,
int flags = wxCONTROL_SELECTED; int flags = wxCONTROL_SELECTED;
if (m_owner->HasFocus()) if (m_owner->HasFocus())
flags |= wxCONTROL_FOCUSED; flags |= wxCONTROL_FOCUSED;
if (current)
flags |= wxCONTROL_CURRENT;
wxRendererNative::Get().DrawItemSelectionRect( m_owner, *dc, rectHL, flags ); wxRendererNative::Get().DrawItemSelectionRect( m_owner, *dc, rectHL, flags );
} }
else else
@@ -2807,7 +2811,8 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
GetLine(line)->DrawInReportMode( &dc, GetLine(line)->DrawInReportMode( &dc,
rectLine, rectLine,
GetLineHighlightRect(line), GetLineHighlightRect(line),
IsHighlighted(line) ); IsHighlighted(line),
line == m_current );
} }
if ( HasFlag(wxLC_HRULES) ) 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. // Don't draw rect outline under Mac at all.
// Draw it elsewhere under GTK.
if ( HasCurrent() ) if ( HasCurrent() )
{ {
if ( m_hasFocus ) if ( m_hasFocus )
{ {
wxRect rect( GetLineHighlightRect( m_current ) ); wxRect rect( GetLineHighlightRect( m_current ) );
#ifndef __WXGTK20__
dc.SetPen( *wxBLACK_PEN ); dc.SetPen( *wxBLACK_PEN );
dc.SetBrush( *wxTRANSPARENT_BRUSH ); dc.SetBrush( *wxTRANSPARENT_BRUSH );
dc.DrawRectangle( rect ); dc.DrawRectangle( rect );
#else
wxRendererNative::Get().DrawItemSelectionRect( this, dc, rect, wxCONTROL_CURRENT|wxCONTROL_FOCUSED );
#endif
} }
} }
#endif #endif