]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/renderg.cpp
fixed another pointer-to-int-of-lesser-size conversion warning
[wxWidgets.git] / src / generic / renderg.cpp
index 7c07f55ff12bc04631ae571662d67b25008c1df8..16915dc55f70f91322891ee027faea9204474184 100644 (file)
 #include "wx/splitter.h"
 #include "wx/dcmirror.h"
 
+#ifdef __WXMAC__
+    #include "wx/mac/private.h"
+#endif
+
 // ----------------------------------------------------------------------------
 // wxRendererGeneric: our wxRendererNative implementation
 // ----------------------------------------------------------------------------
@@ -214,8 +218,6 @@ wxRendererGeneric::DrawHeaderButton(wxWindow* win,
                                     wxHeaderSortIconType sortArrow,
                                     wxHeaderButtonParams* params)
 {
-    const int CORNER = 1;
-
     const wxCoord x = rect.x,
                   y = rect.y,
                   w = rect.width,
@@ -228,18 +230,16 @@ wxRendererGeneric::DrawHeaderButton(wxWindow* win,
     dc.SetBrush(*wxTRANSPARENT_BRUSH);
 
     dc.SetPen(m_penBlack);
-    dc.DrawLine( x+w-CORNER+1, y, x+w, y+h );  // right (outer)
-    dc.DrawRectangle( x, y+h, w+1, 1 );        // bottom (outer)
+    dc.DrawLine( x+w-1, y, x+w-1, y+h );  // right (outer)
+    dc.DrawLine( x, y+h-1, x+w, y+h-1 );  // bottom (outer)
 
     dc.SetPen(m_penDarkGrey);
-    dc.DrawLine( x+w-CORNER, y, x+w-1, y+h );  // right (inner)
-    dc.DrawRectangle( x+1, y+h-1, w-2, 1 );    // bottom (inner)
+    dc.DrawLine( x+w-2, y+1, x+w-2, y+h-1 );  // right (inner)
+    dc.DrawLine( x+1, y+h-2, x+w-1, y+h-2 );  // bottom (inner)
 
     dc.SetPen(m_penHighlight);
-    dc.DrawRectangle( x, y, w-CORNER+1, 1 );   // top (outer)
-    dc.DrawRectangle( x, y, 1, h );            // left (outer)
-    dc.DrawLine( x, y+h-1, x+1, y+h-1 );
-    dc.DrawLine( x+w-1, y, x+w-1, y+1 );
+    dc.DrawLine( x, y, x, y+h-1 ); // left (outer)
+    dc.DrawLine( x, y, x+w-1, y ); // top (outer)
 
     return DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params);
 }
@@ -333,7 +333,7 @@ wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win,
 
         dc.SetFont(font);
         dc.SetTextForeground(clr);
-        dc.SetBackgroundMode(wxTRANSPARENT);
+        dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
 
         int tw, th, td, x, y;
         dc.GetTextExtent( label, &tw, &th, &td);
@@ -635,10 +635,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 +665,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)
+#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__)
+                && IsControlActive( (ControlRef)win->GetHandle() )
+#endif
+    )
+        dc.SetPen( *wxBLACK_PEN );
+    else
+        dc.SetPen( *wxTRANSPARENT_PEN );
 
     dc.DrawRectangle( rect );
 }