]> git.saurik.com Git - wxWidgets.git/commitdiff
draw solid focus rectangle in mono theme and don't do it at all for selected items...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 30 Sep 2006 18:30:00 +0000 (18:30 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 30 Sep 2006 18:30:00 +0000 (18:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41535 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/univ/renderer.h
include/wx/univ/stdrend.h
src/univ/stdrend.cpp
src/univ/themes/gtk.cpp
src/univ/themes/mono.cpp

index 330ca33843b30ee6f4032230db621e975ef08a00..225c71b9c6b70a340a7e2533274a0196366de968 100644 (file)
@@ -93,7 +93,9 @@ public:
 
 
     // draw the focus rectangle around the label contained in the given rect
-    virtual void DrawFocusRect(wxDC& dc, const wxRect& rect) = 0;
+    //
+    // only wxCONTROL_SELECTED makes sense in flags here
+    virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0) = 0;
 
     // draw the label inside the given rectangle with the specified alignment
     // and optionally emphasize the character with the given index
@@ -536,8 +538,8 @@ public:
                                    const wxRect& rect,
                                    int flags)
         { m_renderer->DrawButtonSurface(dc, col, rect, flags); }
-    virtual void DrawFocusRect(wxDC& dc, const wxRect& rect)
-        { m_renderer->DrawFocusRect(dc, rect); }
+    virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0)
+        { m_renderer->DrawFocusRect(dc, rect, flags); }
     virtual void DrawLabel(wxDC& dc,
                            const wxString& label,
                            const wxRect& rect,
index 5c02eea79ae64aa3ef052720242737251c6bf2ae..4fe5ab07faf826f3cd0dc49d883b700035eaa31c 100644 (file)
@@ -38,7 +38,7 @@ public:
                                    int flags);
 
 
-    virtual void DrawFocusRect(wxDC& dc, const wxRect& rect);
+    virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0);
     virtual void DrawLabel(wxDC& dc,
                            const wxString& label,
                            const wxRect& rect,
index 147fcd0639fd037adf01c7451eb8a9d376df3872..255092ca4419231d87abcc5f1e30248d7a1780aa 100644 (file)
@@ -184,7 +184,8 @@ void wxStdRenderer::DrawButtonSurface(wxDC& dc,
 // text
 // ----------------------------------------------------------------------------
 
-void wxStdRenderer::DrawFocusRect(wxDC& dc, const wxRect& rect)
+void
+wxStdRenderer::DrawFocusRect(wxDC& dc, const wxRect& rect, int WXUNUSED(flags))
 {
     // draw the pixels manually because the "dots" in wxPen with wxDOT style
     // may be short traits and not really dots
@@ -615,7 +616,7 @@ void wxStdRenderer::DrawItem(wxDC& dc,
 
     if ( flags & wxCONTROL_FOCUSED )
     {
-        DrawFocusRect(dc, rect);
+        DrawFocusRect(dc, rect, flags);
     }
 }
 
index f2ec37267cd6914bcc656939d5b2a1f46723b733..1b66387049f7857fe1ef91a8a1c66883fb203818 100644 (file)
@@ -84,7 +84,7 @@ public:
     wxGTKRenderer(const wxColourScheme *scheme);
 
     // wxRenderer methods
-    virtual void DrawFocusRect(wxDC& dc, const wxRect& rect);
+    virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0);
     virtual void DrawTextBorder(wxDC& dc,
                                 wxBorder border,
                                 const wxRect& rect,
@@ -834,7 +834,8 @@ void wxGTKRenderer::DrawSunkenBorder(wxDC& dc, wxRect *rect)
     DrawShadedRect(dc, rect, m_penBlack, m_penLightGrey);
 }
 
-void wxGTKRenderer::DrawFocusRect(wxDC& dc, const wxRect& rect)
+void
+wxGTKRenderer::DrawFocusRect(wxDC& dc, const wxRect& rect, int WXUNUSED(flags))
 {
     dc.SetBrush(*wxTRANSPARENT_BRUSH);
     wxRect rectFocus = rect;
index c769427651fa0d198cd48a518141f7e3c48bb04e..dcba79f7b0c5adbfe3ff07bfe3a64224c8c91b68 100644 (file)
@@ -62,6 +62,8 @@ public:
                                  int indexAccel = -1,
                                  wxRect *rectBounds = NULL);
 
+    virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0);
+
     virtual void DrawButtonBorder(wxDC& dc,
                                   const wxRect& rect,
                                   int flags = 0,
@@ -699,6 +701,18 @@ wxMonoRenderer::DrawVerticalLine(wxDC& dc, wxCoord x, wxCoord y1, wxCoord y2)
     dc.DrawLine(x, y1, x, y2 + 1);
 }
 
+void wxMonoRenderer::DrawFocusRect(wxDC& dc, const wxRect& rect, int flags)
+{
+    // no need to draw the focus rect for selected items, it would be invisible
+    // anyhow
+    if ( !(flags & wxCONTROL_SELECTED) )
+    {
+        dc.SetPen(m_penFg);
+        dc.SetBrush(*wxTRANSPARENT_BRUSH);
+        dc.DrawRectangle(rect);
+    }
+}
+
 // ----------------------------------------------------------------------------
 // label
 // ----------------------------------------------------------------------------