]> git.saurik.com Git - wxWidgets.git/commitdiff
Make wxRenderer::DrawItemSelectionRect() draw a focus outline of wxCONTROL_CURRENT...
authorRobert Roebling <robert@roebling.de>
Wed, 17 Oct 2007 20:57:01 +0000 (20:57 +0000)
committerRobert Roebling <robert@roebling.de>
Wed, 17 Oct 2007 20:57:01 +0000 (20:57 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49204 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/datavgen.cpp
src/generic/listctrl.cpp
src/generic/renderg.cpp
src/gtk/renderer.cpp
src/mac/carbon/renderer.cpp
src/msw/renderer.cpp

index f91f29dc78e6d33dc1e69d6a19c26651f84165ff..dfc95dbb3facb92cc0baac8a838dd0968bc0c61c 100644 (file)
@@ -2351,7 +2351,6 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
                     x, item_last * m_lineHeight);
     }
 
-    bool has_focus = (FindFocus() == this);
     // redraw the background for the items which are selected/current
     for (unsigned int item = item_start; item < item_last; item++)
     {
@@ -2359,7 +2358,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
         if (selected || item == m_currentRow)
         {
             int flags = selected ? (int)wxCONTROL_SELECTED : 0;
-            if ((item == m_currentRow) && has_focus)
+            if (item == m_currentRow)
                 flags |= wxCONTROL_CURRENT;
             if (m_hasFocus)
                 flags |= wxCONTROL_FOCUSED;
index b316c39ea9b3a34cc5007d14195d60178d3cc121..7e1830b570fd622376510d10ff1a2197a612b0ec 100644 (file)
@@ -1541,11 +1541,7 @@ void wxListLineData::DrawInReportMode( wxDC *dc,
         if (highlighted)
         {
             int flags = wxCONTROL_SELECTED;
-            if (m_owner->HasFocus()
-#ifdef __WXMAC__
-                && IsControlActive( (ControlRef)m_owner->GetHandle() )
-#endif
-            )
+            if (m_owner->HasFocus())
                 flags |= wxCONTROL_FOCUSED;
             wxRendererNative::Get().DrawItemSelectionRect( m_owner, *dc, rectHL, flags );
         }
index 7c07f55ff12bc04631ae571662d67b25008c1df8..0dba0f18d3e0da434e7ae8d194f65adb778f4aed 100644 (file)
 #include "wx/splitter.h"
 #include "wx/dcmirror.h"
 
+#ifdef __WXMAC__
+    #include "wx/mac/private.h"
+#endif
+
 // ----------------------------------------------------------------------------
 // wxRendererGeneric: our wxRendererNative implementation
 // ----------------------------------------------------------------------------
@@ -635,10 +639,17 @@ wxRendererGeneric::DrawPushButton(wxWindow *win,
 }
 
 void
+#ifdef __WXMAC__
+wxRendererGeneric::DrawItemSelectionRect(wxWindow * win,
+                                         wxDC& dc,
+                                         const wxRect& rect,
+                                         int flags)
+#else
 wxRendererGeneric::DrawItemSelectionRect(wxWindow * WXUNUSED(win),
                                          wxDC& dc,
                                          const wxRect& rect,
                                          int flags)
+#endif
 {
     wxBrush brush;
     if ( flags & wxCONTROL_SELECTED )
@@ -658,7 +669,14 @@ wxRendererGeneric::DrawItemSelectionRect(wxWindow * WXUNUSED(win),
     }
 
     dc.SetBrush(brush);
-    dc.SetPen(flags & wxCONTROL_CURRENT ? *wxBLACK_PEN : *wxTRANSPARENT_PEN);
+    if ((flags & wxCONTROL_CURRENT) && (flags & wxCONTROL_FOCUSED)
+#ifdef __WXMAC__
+                && IsControlActive( (ControlRef)win->GetHandle() )
+#endif
+    )
+        dc.SetPen( *wxBLACK_PEN );
+    else
+        dc.SetPen( *wxTRANSPARENT_PEN );
 
     dc.DrawRectangle( rect );
 }
index 0e945d4d1e50399919757c1fbfe4e49ea4f955cb..5be8e518065a023d006c2c96cfbdb9af769c2d37 100644 (file)
@@ -619,7 +619,7 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow *win,
         state = GTK_STATE_NORMAL;
     }
 
-    if (flags & wxCONTROL_CURRENT)
+    if ((flags & wxCONTROL_CURRENT) && (flags & wxCONTROL_FOCUSED))
     {
         gtk_paint_focus( win->m_widget->style,
                          gdk_window,
index e0f9bc23e2f4734b4eb8e1cac2bf0d7226c5f01e..1a58d904af5a4e1c33cfe7e2d1ae62a62cca4c78 100644 (file)
@@ -374,6 +374,12 @@ wxRendererMac::DrawItemSelectionRect(wxWindow *win,
 {
     if ( !(flags & wxCONTROL_SELECTED) )
         return;
+        
+    if (flags & wxCONTROL_FOCUSED)
+    {
+        if (!IsControlActive( (ControlRef)win->GetHandle() ))
+            flags = wxCONTROL_SELECTED;
+    }
 
     RGBColor selColor;
     GetThemeBrushAsColor(flags & wxCONTROL_FOCUSED
index b1a3c77ff67301be52bcb48d5b3a7c5fe3f22d07..101f7ca658a0d38bd6ee49f13c504d63d9ef8bb5 100644 (file)
@@ -534,7 +534,7 @@ wxRendererXP::DrawPushButton(wxWindow * win,
 }
 
 void
-wxRendererXP::DrawItemSelectionRect(wxWindow * WXUNUSED(win),
+wxRendererXP::DrawItemSelectionRect(wxWindow *win,
                                     wxDC& dc,
                                     const wxRect& rect,
                                     int flags)
@@ -557,12 +557,11 @@ wxRendererXP::DrawItemSelectionRect(wxWindow * WXUNUSED(win),
     }
 
     dc.SetBrush(brush);
-
-    // unlike for wxRendererGeneric, on windows we _never_ want to draw
-    // the outline of the rectangle:
     dc.SetPen(*wxTRANSPARENT_PEN);
-
     dc.DrawRectangle( rect );
+    
+    if ((flags & wxCONTROL_FOCUSED) && (flags & wxCONTROL_CURRENT))
+        DrawFocusRect( win, dc, rect, flags );
 }