]> git.saurik.com Git - wxWidgets.git/commitdiff
metal appearance supported under 10.3
authorStefan Csomor <csomor@advancedconcepts.ch>
Sun, 29 Aug 2004 18:25:35 +0000 (18:25 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sun, 29 Aug 2004 18:25:35 +0000 (18:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28958 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/toolbar.cpp

index e445850c6061701dd81c7ea39f88fe257868801d..0ae7bed16ee73de01b88d0a755b169988d6dedb7 100644 (file)
@@ -551,8 +551,41 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
     if ( toolbarrect.top < 0 )
         toolbarrect.top = 0 ;
 */
-    UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
+    if ( !MacGetTopLevelWindow()->MacGetMetalAppearance() )
+    {
+        UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
+    }
+    else
+    {
+#if TARGET_API_MAC_OSX
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
+    if ( UMAGetSystemVersion() >= 0x1030 )
+    {
+        HIRect hiToolbarrect = CGRectMake( dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) , 
+        dc.YLOG2DEVREL(h) , dc.XLOG2DEVREL(w) );
+        CGContextRef cgContext ;
+        Rect bounds ;
+        GetPortBounds( (CGrafPtr) dc.m_macPort , &bounds ) ;
+        QDBeginCGContext( (CGrafPtr) dc.m_macPort , &cgContext ) ;
+        CGContextTranslateCTM( cgContext , 0 , bounds.bottom - bounds.top ) ;
+        CGContextScaleCTM( cgContext , 1 , -1 ) ;
 
+        {
+            HIThemeBackgroundDrawInfo drawInfo ;
+            drawInfo.version = 0 ;
+            drawInfo.state = kThemeStateActive ;
+            drawInfo.kind = kThemeBackgroundMetal ;
+            HIThemeApplyBackground( &hiToolbarrect, &drawInfo , cgContext,kHIThemeOrientationNormal) ;
+        }
+        QDEndCGContext( (CGrafPtr) dc.m_macPort , &cgContext ) ;
+    }
+    else
+#endif
+    {
+        UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ;
+    }
+#endif
+    }
     event.Skip() ;
 }