#include "wx/geometry.h"
#ifdef __WXMAC_OSX__
-const short kwxMacToolBarToolDefaultWidth = 24 ;
-const short kwxMacToolBarToolDefaultHeight = 24 ;
+const short kwxMacToolBarToolDefaultWidth = 16 ;
+const short kwxMacToolBarToolDefaultHeight = 16 ;
const short kwxMacToolBarTopMargin = 4 ;
const short kwxMacToolBarLeftMargin = 4 ;
const short kwxMacToolBorder = 0 ;
m_x = position.x;
m_y = position.y;
- if ( IsButton() )
+ int x , y ;
+ x = y = 0 ;
+ int mac_x = position.x ;
+ int mac_y = position.y ;
+
+ if ( ! GetToolBar()->MacGetTopLevelWindow()->MacUsesCompositing() )
{
- int x , y ;
- x = y = 0 ;
- int mac_x = position.x ;
- int mac_y = position.y ;
-#ifdef __WXMAC_OSX__
- // already correctly set up
-#else
- WindowRef rootwindow = (WindowRef) GetToolBar()->MacGetTopLevelWindowRef() ;
GetToolBar()->MacWindowToRootWindow( &x , &y ) ;
mac_x += x;
mac_y += y;
-#endif
+ }
+
+ if ( IsButton() )
+ {
Rect contrlRect ;
GetControlBounds( m_controlHandle , &contrlRect ) ;
int former_mac_x = contrlRect.left ;
{
// separator
#ifdef __WXMAC_OSX__
- int x , y ;
- x = y = 0 ;
- int mac_x = position.x ;
- int mac_y = position.y ;
-
Rect contrlRect ;
GetControlBounds( m_controlHandle , &contrlRect ) ;
int former_mac_x = contrlRect.left ;
else
{
ControlButtonContentInfo info ;
- wxMacCreateBitmapButton( &info , GetNormalBitmap() ) ;
+ wxMacCreateBitmapButton( &info , GetNormalBitmap() , kControlContentIconRef ) ;
#ifdef __WXMAC_OSX__
CreateIconControl( window , &toolrect , &info , false , &m_controlHandle ) ;
tool->Detach();
+ wxToolBarTool* tl = wx_static_cast( wxToolBarTool* , tool ) ;
+ switch ( tool->GetStyle() )
+ {
+ case wxTOOL_STYLE_CONTROL:
+ tool->GetControl()->Destroy();
+ break;
+
+ case wxTOOL_STYLE_BUTTON:
+ case wxTOOL_STYLE_SEPARATOR:
+ if ( tl->GetControlHandle() )
+ {
+ DisposeControl( (ControlRef) tl->GetControlHandle() ) ;
+ tl->SetControlHandle( (ControlRef) NULL ) ;
+ }
+ break;
+ }
+
// and finally reposition all the controls after this one
for ( /* node -> first after deleted */ ; node; node = node->GetNext() )
void wxToolBar::OnPaint(wxPaintEvent& event)
{
wxPaintDC dc(this) ;
-#if wxMAC_USE_CORE_GRAPHICS
- // leave the background as it is (striped or metal)
-#else
- wxMacPortSetter helper(&dc) ;
+
int w, h ;
GetSize( &w , &h ) ;
+#if wxMAC_USE_CORE_GRAPHICS && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
+ if ( !MacGetTopLevelWindow()->MacGetMetalAppearance() )
+ {
+ if ( UMAGetSystemVersion() >= 0x1030 )
+ {
+ HIThemePlacardDrawInfo info ;
+ memset( &info, 0 , sizeof( info ) ) ;
+ info.version = 0 ;
+ info.state = IsEnabled() ? kThemeStateActive : kThemeStateInactive ;
+
+ CGContextRef cgContext = (CGContextRef) MacGetCGContextRef() ;
+ HIRect rect = CGRectMake( 0 , 0 , w , h ) ;
+ HIThemeDrawPlacard( &rect , & info , cgContext, kHIThemeOrientationNormal) ;
+ }
+ }
+ else
+ {
+ // leave the background as it is (striped or metal)
+ }
+#else
+ wxMacPortSetter helper(&dc) ;
Rect toolbarrect = { dc.YLOG2DEVMAC(0) , dc.XLOG2DEVMAC(0) ,
dc.YLOG2DEVMAC(h) , dc.XLOG2DEVMAC(w) } ;