]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/renderer.cpp
Document lack of wxEVT_COMMAND_DATAVIEW_COLUMN_HEADER_CLICK under OS X.
[wxWidgets.git] / src / osx / carbon / renderer.cpp
index 7e5c766acc0ed44525afb9607103e9dcd51759c2..343cf63f442a96e19751a4323ddef2b41fedc5cc 100644 (file)
@@ -31,6 +31,7 @@
 #include "wx/renderer.h"
 #include "wx/graphics.h"
 #include "wx/dcgraph.h"
 #include "wx/renderer.h"
 #include "wx/graphics.h"
 #include "wx/dcgraph.h"
+#include "wx/splitter.h"
 #include "wx/osx/private.h"
 
 #ifdef wxHAS_DRAW_TITLE_BAR_BITMAP
 #include "wx/osx/private.h"
 
 #ifdef wxHAS_DRAW_TITLE_BAR_BITMAP
@@ -123,6 +124,8 @@ public:
                                     int flags = 0);
 #endif // wxHAS_DRAW_TITLE_BAR_BITMAP
 
                                     int flags = 0);
 #endif // wxHAS_DRAW_TITLE_BAR_BITMAP
 
+    virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win);
+
 private:
     void DrawMacThemeButton(wxWindow *win,
                             wxDC& dc,
 private:
     void DrawMacThemeButton(wxWindow *win,
                             wxDC& dc,
@@ -182,7 +185,7 @@ int wxRendererMac::DrawHeaderButton( wxWindow *win,
             drawInfo.version = 0;
             drawInfo.kind = kThemeListHeaderButton;
             drawInfo.state = (flags & wxCONTROL_DISABLED) ? kThemeStateInactive : kThemeStateActive;
             drawInfo.version = 0;
             drawInfo.kind = kThemeListHeaderButton;
             drawInfo.state = (flags & wxCONTROL_DISABLED) ? kThemeStateInactive : kThemeStateActive;
-            drawInfo.value = (flags & wxCONTROL_SELECTED) ? kThemeButtonOn : kThemeButtonOff;
+            drawInfo.value = (flags & wxCONTROL_PRESSED) ? kThemeButtonOn : kThemeButtonOff;
             drawInfo.adornment = kThemeAdornmentNone;
 
             // The down arrow is drawn automatically, change it to an up arrow if needed.
             drawInfo.adornment = kThemeAdornmentNone;
 
             // The down arrow is drawn automatically, change it to an up arrow if needed.
@@ -192,7 +195,7 @@ int wxRendererMac::DrawHeaderButton( wxWindow *win,
             HIThemeDrawButton( &headerRect, &drawInfo, cgContext, kHIThemeOrientationNormal, &labelRect );
 
             // If we don't want any arrows we need to draw over the one already there
             HIThemeDrawButton( &headerRect, &drawInfo, cgContext, kHIThemeOrientationNormal, &labelRect );
 
             // If we don't want any arrows we need to draw over the one already there
-            if ( (flags & wxCONTROL_SELECTED) && (sortArrow == wxHDR_SORT_ICON_NONE) )
+            if ( (flags & wxCONTROL_PRESSED) && (sortArrow == wxHDR_SORT_ICON_NONE) )
             {
                 // clip to the header rectangle
                 CGContextSaveGState( cgContext );
             {
                 // clip to the header rectangle
                 CGContextSaveGState( cgContext );
@@ -208,12 +211,12 @@ int wxRendererMac::DrawHeaderButton( wxWindow *win,
     // Reserve room for the arrows before writing the label, and turn off the
     // flags we've already handled
     wxRect newRect(rect);
     // Reserve room for the arrows before writing the label, and turn off the
     // flags we've already handled
     wxRect newRect(rect);
-    if ( (flags & wxCONTROL_SELECTED) && (sortArrow != wxHDR_SORT_ICON_NONE) )
+    if ( (flags & wxCONTROL_PRESSED) && (sortArrow != wxHDR_SORT_ICON_NONE) )
     {
         newRect.width -= 12;
         sortArrow = wxHDR_SORT_ICON_NONE;
     }
     {
         newRect.width -= 12;
         sortArrow = wxHDR_SORT_ICON_NONE;
     }
-    flags &= ~wxCONTROL_SELECTED;
+    flags &= ~wxCONTROL_PRESSED;
 
     return DrawHeaderButtonContents(win, dc, newRect, flags, sortArrow, params);
 }
 
     return DrawHeaderButtonContents(win, dc, newRect, flags, sortArrow, params);
 }
@@ -279,6 +282,37 @@ void wxRendererMac::DrawTreeItemButton( wxWindow *win,
     }
 }
 
     }
 }
 
+wxSplitterRenderParams
+wxRendererMac::GetSplitterParams(const wxWindow *win)
+{
+    // see below
+    SInt32 sashWidth,
+            border;
+#if wxOSX_USE_COCOA
+    if ( win->HasFlag(wxSP_3DSASH) )
+        GetThemeMetric( kThemeMetricPaneSplitterHeight, &sashWidth ); // Cocoa == Carbon == 7
+    else if ( win->HasFlag(wxSP_NOSASH) ) // actually Cocoa doesn't allow 0
+        sashWidth = 0;
+    else // no 3D effect - Cocoa [NSSplitView dividerThickNess] for NSSplitViewDividerStyleThin
+        sashWidth = 1;
+#else // Carbon
+    if ( win->HasFlag(wxSP_3DSASH) )
+        GetThemeMetric( kThemeMetricPaneSplitterHeight, &sashWidth );
+    else if ( win->HasFlag(wxSP_NOSASH) )
+        sashWidth = 0;
+    else // no 3D effect
+        GetThemeMetric( kThemeMetricSmallPaneSplitterHeight, &sashWidth );
+#endif // Cocoa/Carbon
+
+    if ( win->HasFlag(wxSP_3DBORDER) )
+        border = 2;
+    else // no 3D effect
+        border = 0;
+
+    return wxSplitterRenderParams(sashWidth, border, false);
+}
+
+
 void wxRendererMac::DrawSplitterSash( wxWindow *win,
     wxDC& dc,
     const wxSize& size,
 void wxRendererMac::DrawSplitterSash( wxWindow *win,
     wxDC& dc,
     const wxSize& size,
@@ -288,7 +322,9 @@ void wxRendererMac::DrawSplitterSash( wxWindow *win,
 {
     bool hasMetal = win->MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL;
     SInt32 height;
 {
     bool hasMetal = win->MacGetTopLevelWindow()->GetExtraStyle() & wxFRAME_EX_METAL;
     SInt32 height;
-    GetThemeMetric( kThemeMetricSmallPaneSplitterHeight, &height );
+
+    height = wxRendererNative::Get().GetSplitterParams(win).widthSash;
+
     HIRect splitterRect;
     if (orient == wxVERTICAL)
         splitterRect = CGRectMake( position, 0, height, size.y );
     HIRect splitterRect;
     if (orient == wxVERTICAL)
         splitterRect = CGRectMake( position, 0, height, size.y );
@@ -323,11 +359,14 @@ void wxRendererMac::DrawSplitterSash( wxWindow *win,
             CGContextFillRect(cgContext,splitterRect);
         }
 
             CGContextFillRect(cgContext,splitterRect);
         }
 
-        HIThemeSplitterDrawInfo drawInfo;
-        drawInfo.version = 0;
-        drawInfo.state = kThemeStateActive;
-        drawInfo.adornment = hasMetal ? kHIThemeSplitterAdornmentMetal : kHIThemeSplitterAdornmentNone;
-        HIThemeDrawPaneSplitter( &splitterRect, &drawInfo, cgContext, kHIThemeOrientationNormal );
+        if ( win->HasFlag(wxSP_3DSASH) )
+        {
+            HIThemeSplitterDrawInfo drawInfo;
+            drawInfo.version = 0;
+            drawInfo.state = kThemeStateActive;
+            drawInfo.adornment = hasMetal ? kHIThemeSplitterAdornmentMetal : kHIThemeSplitterAdornmentNone;
+            HIThemeDrawPaneSplitter( &splitterRect, &drawInfo, cgContext, kHIThemeOrientationNormal );
+        }
     }
 }
 
     }
 }
 
@@ -385,7 +424,7 @@ wxRendererMac::DrawMacThemeButton(wxWindow *win,
         drawInfo.version = 0;
         drawInfo.kind = kind;
         drawInfo.state = (flags & wxCONTROL_DISABLED) ? kThemeStateInactive : kThemeStateActive;
         drawInfo.version = 0;
         drawInfo.kind = kind;
         drawInfo.state = (flags & wxCONTROL_DISABLED) ? kThemeStateInactive : kThemeStateActive;
-        drawInfo.value = (flags & wxCONTROL_SELECTED) ? kThemeButtonOn : kThemeButtonOff;
+        drawInfo.value = (flags & wxCONTROL_PRESSED) ? kThemeButtonOn : kThemeButtonOff;
         if (flags & wxCONTROL_UNDETERMINED)
             drawInfo.value = kThemeButtonMixed;
         drawInfo.adornment = adornment;
         if (flags & wxCONTROL_UNDETERMINED)
             drawInfo.value = kThemeButtonMixed;
         drawInfo.adornment = adornment;
@@ -403,7 +442,7 @@ wxRendererMac::DrawCheckBox(wxWindow *win,
                             int flags)
 {
     if (flags & wxCONTROL_CHECKED)
                             int flags)
 {
     if (flags & wxCONTROL_CHECKED)
-        flags |= wxCONTROL_SELECTED;
+        flags |= wxCONTROL_PRESSED;
 
     int kind;
 
 
     int kind;
 
@@ -555,7 +594,7 @@ void wxRendererMac::DrawRadioBitmap(wxWindow* win, wxDC& dc,
         kind = kThemeRadioButton;
 
     if (flags & wxCONTROL_CHECKED)
         kind = kThemeRadioButton;
 
     if (flags & wxCONTROL_CHECKED)
-        flags |= wxCONTROL_SELECTED;
+        flags |= wxCONTROL_PRESSED;
 
     DrawMacThemeButton(win, dc, rect, flags,
                           kind, kThemeAdornmentNone);
 
     DrawMacThemeButton(win, dc, rect, flags,
                           kind, kThemeAdornmentNone);