]> git.saurik.com Git - wxWidgets.git/commitdiff
Finally corrected drawing of wxListCtrl selection rect for GTK+
authorRobert Roebling <robert@roebling.de>
Sun, 25 Jan 2009 20:22:37 +0000 (20:22 +0000)
committerRobert Roebling <robert@roebling.de>
Sun, 25 Jan 2009 20:22:37 +0000 (20:22 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58415 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/listctrl.cpp

index f33e2b1437adc2b1757254fee60d8a0dd947126b..ef431f2f9bc9b8e3dd68a37c719134cb258cbf43 100644 (file)
@@ -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