1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mac/carbon/toolbar.cpp
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
16 #include "wx/toolbar.h"
22 #include "wx/mac/uma.h"
23 #include "wx/geometry.h"
27 const short kwxMacToolBarToolDefaultWidth
= 16;
28 const short kwxMacToolBarToolDefaultHeight
= 16;
29 const short kwxMacToolBarTopMargin
= 4;
30 const short kwxMacToolBarLeftMargin
= 4;
31 const short kwxMacToolBorder
= 0;
32 const short kwxMacToolSpacing
= 6;
34 const short kwxMacToolBarToolDefaultWidth
= 24;
35 const short kwxMacToolBarToolDefaultHeight
= 22;
36 const short kwxMacToolBarTopMargin
= 2;
37 const short kwxMacToolBarLeftMargin
= 2;
38 const short kwxMacToolBorder
= 4;
39 const short kwxMacToolSpacing
= 0;
43 IMPLEMENT_DYNAMIC_CLASS(wxToolBar
, wxControl
)
45 BEGIN_EVENT_TABLE(wxToolBar
, wxToolBarBase
)
46 EVT_PAINT( wxToolBar::OnPaint
)
51 #pragma mark Tool Implementation
54 // ----------------------------------------------------------------------------
56 // ----------------------------------------------------------------------------
58 // We have a dual implementation for each tool, ControlRef and HIToolbarItemRef
60 class wxToolBarTool
: public wxToolBarToolBase
66 const wxString
& label
,
67 const wxBitmap
& bmpNormal
,
68 const wxBitmap
& bmpDisabled
,
71 const wxString
& shortHelp
,
72 const wxString
& longHelp
);
74 wxToolBarTool(wxToolBar
*tbar
, wxControl
*control
)
75 : wxToolBarToolBase(tbar
, control
)
79 SetControlHandle( (ControlRef
) control
->GetHandle() );
82 virtual ~wxToolBarTool()
86 #if wxMAC_USE_NATIVE_TOOLBAR
87 if ( m_toolbarItemRef
)
88 CFRelease( m_toolbarItemRef
);
92 WXWidget
GetControlHandle()
94 return (WXWidget
) m_controlHandle
;
97 void SetControlHandle( ControlRef handle
)
99 m_controlHandle
= handle
;
102 void SetPosition( const wxPoint
& position
);
107 if ( m_controlHandle
)
110 DisposeControl( m_controlHandle
);
113 // the embedded control is not under the responsibility of the tool
115 m_controlHandle
= NULL
;
118 #if wxMAC_USE_NATIVE_TOOLBAR
119 m_toolbarItemRef
= NULL
;
123 wxSize
GetSize() const
129 curSize
= GetControl()->GetSize();
131 else if ( IsButton() )
133 curSize
= GetToolBar()->GetToolSize();
138 curSize
= GetToolBar()->GetToolSize();
139 if ( GetToolBar()->GetWindowStyleFlag() & wxTB_VERTICAL
)
148 wxPoint
GetPosition() const
150 return wxPoint( m_x
, m_y
);
153 bool DoEnable( bool enable
);
155 void UpdateToggleImage( bool toggle
);
157 #if wxMAC_USE_NATIVE_TOOLBAR
158 void SetToolbarItemRef( HIToolbarItemRef ref
)
160 if ( m_controlHandle
)
161 HideControl( m_controlHandle
);
162 if ( m_toolbarItemRef
)
163 CFRelease( m_toolbarItemRef
);
165 m_toolbarItemRef
= ref
;
166 if ( m_toolbarItemRef
)
168 HIToolbarItemSetHelpText(
170 wxMacCFStringHolder( GetShortHelp(), GetToolBar()->GetFont().GetEncoding() ),
171 wxMacCFStringHolder( GetLongHelp(), GetToolBar()->GetFont().GetEncoding() ) );
175 HIToolbarItemRef
GetToolbarItemRef() const
177 return m_toolbarItemRef
;
180 void SetIndex( CFIndex idx
)
185 CFIndex
GetIndex() const
194 m_controlHandle
= NULL
;
196 #if wxMAC_USE_NATIVE_TOOLBAR
197 m_toolbarItemRef
= NULL
;
202 ControlRef m_controlHandle
;
206 #if wxMAC_USE_NATIVE_TOOLBAR
207 HIToolbarItemRef m_toolbarItemRef
;
208 // position in its toolbar, -1 means not inserted
213 static const EventTypeSpec eventList
[] =
215 { kEventClassControl
, kEventControlHit
},
217 { kEventClassControl
, kEventControlHitTest
},
221 static pascal OSStatus
wxMacToolBarToolControlEventHandler( EventHandlerCallRef handler
, EventRef event
, void *data
)
223 OSStatus result
= eventNotHandledErr
;
224 ControlRef controlRef
;
225 wxMacCarbonEvent
cEvent( event
);
227 cEvent
.GetParameter( kEventParamDirectObject
, &controlRef
);
229 switch ( GetEventKind( event
) )
231 case kEventControlHit
:
233 wxToolBarTool
*tbartool
= (wxToolBarTool
*)data
;
234 wxToolBar
*tbar
= tbartool
!= NULL
? (wxToolBar
*) (tbartool
->GetToolBar()) : NULL
;
235 if ((tbartool
!= NULL
) && tbartool
->CanBeToggled())
240 shouldToggle
= !tbartool
->IsToggled();
242 shouldToggle
= (GetControl32BitValue( (ControlRef
)(tbartool
->GetControlHandle()) ) != 0);
245 tbar
->ToggleTool( tbartool
->GetId(), shouldToggle
);
248 if (tbartool
!= NULL
)
249 tbar
->OnLeftClick( tbartool
->GetId(), tbartool
->IsToggled() );
255 case kEventControlHitTest
:
257 HIPoint pt
= cEvent
.GetParameter
<HIPoint
>(kEventParamMouseLocation
);
259 HIViewGetBounds( controlRef
, &rect
);
261 ControlPartCode pc
= kControlNoPart
;
262 if ( CGRectContainsPoint( rect
, pt
) )
263 pc
= kControlIconPart
;
264 cEvent
.SetParameter( kEventParamControlPart
, typeControlPartCode
, pc
);
277 static pascal OSStatus
wxMacToolBarToolEventHandler( EventHandlerCallRef handler
, EventRef event
, void *data
)
279 OSStatus result
= eventNotHandledErr
;
281 switch ( GetEventClass( event
) )
283 case kEventClassControl
:
284 result
= wxMacToolBarToolControlEventHandler( handler
, event
, data
);
294 DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacToolBarToolEventHandler
)
296 #if wxMAC_USE_NATIVE_TOOLBAR
298 static const EventTypeSpec toolBarEventList
[] =
300 { kEventClassToolbarItem
, kEventToolbarItemPerformAction
},
303 static pascal OSStatus
wxMacToolBarCommandEventHandler( EventHandlerCallRef handler
, EventRef event
, void *data
)
305 OSStatus result
= eventNotHandledErr
;
307 switch ( GetEventKind( event
) )
309 case kEventToolbarItemPerformAction
:
311 wxToolBarTool
* tbartool
= (wxToolBarTool
*) data
;
312 if ( tbartool
!= NULL
)
314 wxToolBar
*tbar
= (wxToolBar
*)(tbartool
->GetToolBar());
315 int toolID
= tbartool
->GetId();
317 if ( tbartool
->CanBeToggled() )
320 tbar
->ToggleTool(toolID
, !tbartool
->IsToggled() );
324 tbar
->OnLeftClick( toolID
, tbartool
->IsToggled() );
337 static pascal OSStatus
wxMacToolBarEventHandler( EventHandlerCallRef handler
, EventRef event
, void *data
)
339 OSStatus result
= eventNotHandledErr
;
341 switch ( GetEventClass( event
) )
343 case kEventClassToolbarItem
:
344 result
= wxMacToolBarCommandEventHandler( handler
, event
, data
);
354 DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacToolBarEventHandler
)
358 bool wxToolBarTool::DoEnable( bool enable
)
362 GetControl()->Enable( enable
);
364 else if ( IsButton() )
366 #if wxMAC_USE_NATIVE_TOOLBAR
367 if ( m_toolbarItemRef
!= NULL
)
368 HIToolbarItemSetEnabled( m_toolbarItemRef
, enable
);
371 if ( m_controlHandle
!= NULL
)
373 #if TARGET_API_MAC_OSX
375 EnableControl( m_controlHandle
);
377 DisableControl( m_controlHandle
);
380 ActivateControl( m_controlHandle
);
382 DeactivateControl( m_controlHandle
);
390 void wxToolBarTool::SetPosition( const wxPoint
& position
)
395 int mac_x
= position
.x
;
396 int mac_y
= position
.y
;
401 GetControlBounds( m_controlHandle
, &contrlRect
);
402 int former_mac_x
= contrlRect
.left
;
403 int former_mac_y
= contrlRect
.top
;
404 GetToolBar()->GetToolSize();
406 if ( mac_x
!= former_mac_x
|| mac_y
!= former_mac_y
)
408 UMAMoveControl( m_controlHandle
, mac_x
, mac_y
);
411 else if ( IsControl() )
413 // embedded native controls are moved by the OS
414 #if wxMAC_USE_NATIVE_TOOLBAR
415 if ( ((wxToolBar
*)GetToolBar())->MacWantsNativeToolbar() == false )
418 GetControl()->Move( position
);
426 GetControlBounds( m_controlHandle
, &contrlRect
);
427 int former_mac_x
= contrlRect
.left
;
428 int former_mac_y
= contrlRect
.top
;
430 if ( mac_x
!= former_mac_x
|| mac_y
!= former_mac_y
)
431 UMAMoveControl( m_controlHandle
, mac_x
, mac_y
);
436 void wxToolBarTool::UpdateToggleImage( bool toggle
)
441 int w
= m_bmpNormal
.GetWidth();
442 int h
= m_bmpNormal
.GetHeight();
443 wxBitmap
bmp( w
, h
);
446 dc
.SelectObject( bmp
);
447 dc
.SetPen( wxPen(*wxBLACK
) );
448 dc
.SetBrush( wxBrush( *wxLIGHT_GREY
));
449 dc
.DrawRectangle( 0, 0, w
, h
);
450 dc
.DrawBitmap( m_bmpNormal
, 0, 0, true );
451 dc
.SelectObject( wxNullBitmap
);
452 ControlButtonContentInfo info
;
453 wxMacCreateBitmapButton( &info
, bmp
);
454 SetControlData( m_controlHandle
, 0, kControlIconContentTag
, sizeof(info
), (Ptr
)&info
);
455 #if wxMAC_USE_NATIVE_TOOLBAR
456 if (m_toolbarItemRef
!= NULL
)
458 HIToolbarItemSetIconRef( m_toolbarItemRef
, info
.u
.iconRef
);
461 wxMacReleaseBitmapButton( &info
);
465 ControlButtonContentInfo info
;
466 wxMacCreateBitmapButton( &info
, m_bmpNormal
);
467 SetControlData( m_controlHandle
, 0, kControlIconContentTag
, sizeof(info
), (Ptr
)&info
);
468 #if wxMAC_USE_NATIVE_TOOLBAR
469 if (m_toolbarItemRef
!= NULL
)
471 HIToolbarItemSetIconRef( m_toolbarItemRef
, info
.u
.iconRef
);
474 wxMacReleaseBitmapButton( &info
);
477 IconTransformType transform
= toggle
? kTransformSelected
: kTransformNone
;
479 m_controlHandle
, 0, kControlIconTransformTag
,
480 sizeof(transform
), (Ptr
)&transform
);
481 HIViewSetNeedsDisplay( m_controlHandle
, true );
484 ::SetControl32BitValue( m_controlHandle
, toggle
);
488 wxToolBarTool::wxToolBarTool(
491 const wxString
& label
,
492 const wxBitmap
& bmpNormal
,
493 const wxBitmap
& bmpDisabled
,
495 wxObject
*clientData
,
496 const wxString
& shortHelp
,
497 const wxString
& longHelp
)
500 tbar
, id
, label
, bmpNormal
, bmpDisabled
, kind
,
501 clientData
, shortHelp
, longHelp
)
507 #pragma mark Toolbar Implementation
509 wxToolBarToolBase
*wxToolBar::CreateTool(
511 const wxString
& label
,
512 const wxBitmap
& bmpNormal
,
513 const wxBitmap
& bmpDisabled
,
515 wxObject
*clientData
,
516 const wxString
& shortHelp
,
517 const wxString
& longHelp
)
519 return new wxToolBarTool(
520 this, id
, label
, bmpNormal
, bmpDisabled
, kind
,
521 clientData
, shortHelp
, longHelp
);
524 wxToolBarToolBase
* wxToolBar::CreateTool( wxControl
*control
)
526 return new wxToolBarTool( this, control
);
529 void wxToolBar::Init()
533 m_defaultWidth
= kwxMacToolBarToolDefaultWidth
;
534 m_defaultHeight
= kwxMacToolBarToolDefaultHeight
;
536 #if wxMAC_USE_NATIVE_TOOLBAR
537 m_macHIToolbarRef
= NULL
;
538 m_macUsesNativeToolbar
= false;
542 #define kControlToolbarItemClassID CFSTR( "org.wxwidgets.controltoolbaritem" )
544 const EventTypeSpec kEvents
[] =
546 { kEventClassHIObject
, kEventHIObjectConstruct
},
547 { kEventClassHIObject
, kEventHIObjectInitialize
},
548 { kEventClassHIObject
, kEventHIObjectDestruct
},
550 { kEventClassToolbarItem
, kEventToolbarItemCreateCustomView
}
553 const EventTypeSpec kViewEvents
[] =
555 { kEventClassControl
, kEventControlGetSizeConstraints
}
558 struct ControlToolbarItem
560 HIToolbarItemRef toolbarItem
;
562 wxSize lastValidSize
;
565 static pascal OSStatus
ControlToolbarItemHandler( EventHandlerCallRef inCallRef
, EventRef inEvent
, void* inUserData
)
567 OSStatus result
= eventNotHandledErr
;
568 ControlToolbarItem
* object
= (ControlToolbarItem
*)inUserData
;
570 switch ( GetEventClass( inEvent
) )
572 case kEventClassHIObject
:
573 switch ( GetEventKind( inEvent
) )
575 case kEventHIObjectConstruct
:
577 HIObjectRef toolbarItem
;
578 ControlToolbarItem
* item
;
580 GetEventParameter( inEvent
, kEventParamHIObjectInstance
, typeHIObjectRef
, NULL
,
581 sizeof( HIObjectRef
), NULL
, &toolbarItem
);
583 item
= (ControlToolbarItem
*) malloc(sizeof(ControlToolbarItem
)) ;
584 item
->toolbarItem
= toolbarItem
;
585 item
->viewRef
= NULL
;
587 SetEventParameter( inEvent
, kEventParamHIObjectInstance
, typeVoidPtr
, sizeof( void * ), &item
);
593 case kEventHIObjectInitialize
:
594 result
= CallNextEventHandler( inCallRef
, inEvent
);
595 if ( result
== noErr
)
598 GetEventParameter( inEvent
, kEventParamToolbarItemConfigData
, typeCFTypeRef
, NULL
,
599 sizeof( CFTypeRef
), NULL
, &data
);
603 wxASSERT_MSG( CFDataGetLength( data
) == sizeof( viewRef
) , wxT("Illegal Data passed") ) ;
604 memcpy( &viewRef
, CFDataGetBytePtr( data
) , sizeof( viewRef
) ) ;
606 object
->viewRef
= (HIViewRef
) viewRef
;
612 case kEventHIObjectDestruct
:
619 case kEventClassToolbarItem
:
620 switch ( GetEventKind( inEvent
) )
622 case kEventToolbarItemCreateCustomView
:
624 HIViewRef viewRef
= object
->viewRef
;
626 HIViewRemoveFromSuperview( viewRef
) ;
627 HIViewSetVisible(viewRef
, true) ;
628 InstallEventHandler( GetControlEventTarget( viewRef
), ControlToolbarItemHandler
,
629 GetEventTypeCount( kViewEvents
), kViewEvents
, object
, NULL
);
631 result
= SetEventParameter( inEvent
, kEventParamControlRef
, typeControlRef
, sizeof( HIViewRef
), &viewRef
);
637 case kEventClassControl
:
638 switch ( GetEventKind( inEvent
) )
640 case kEventControlGetSizeConstraints
:
642 wxWindow
* wxwindow
= wxFindControlFromMacControl(object
->viewRef
) ;
645 wxSize sz
= wxwindow
->GetSize() ;
646 sz
.x
-= wxwindow
->MacGetLeftBorderSize() + wxwindow
->MacGetRightBorderSize();
647 sz
.y
-= wxwindow
->MacGetTopBorderSize() + wxwindow
->MacGetBottomBorderSize();
648 // during toolbar layout the native window sometimes gets negative sizes
649 // so we always keep the last valid size here, to make sure we survive the
651 if ( sz
.x
> 0 && sz
.y
> 0 )
652 object
->lastValidSize
= sz
;
654 sz
= object
->lastValidSize
;
657 min
.width
= max
.width
= sz
.x
;
658 min
.height
= max
.height
= sz
.y
;
660 result
= SetEventParameter( inEvent
, kEventParamMinimumSize
, typeHISize
,
661 sizeof( HISize
), &min
);
663 result
= SetEventParameter( inEvent
, kEventParamMaximumSize
, typeHISize
,
664 sizeof( HISize
), &max
);
676 void RegisterControlToolbarItemClass()
678 static bool sRegistered
;
682 HIObjectRegisterSubclass( kControlToolbarItemClassID
, kHIToolbarItemClassID
, 0,
683 ControlToolbarItemHandler
, GetEventTypeCount( kEvents
), kEvents
, 0, NULL
);
689 HIToolbarItemRef
CreateControlToolbarItem(CFStringRef inIdentifier
, CFTypeRef inConfigData
)
691 RegisterControlToolbarItemClass();
695 UInt32 options
= kHIToolbarItemAllowDuplicates
;
696 HIToolbarItemRef result
= NULL
;
698 err
= CreateEvent( NULL
, kEventClassHIObject
, kEventHIObjectInitialize
, GetCurrentEventTime(), 0, &event
);
699 require_noerr( err
, CantCreateEvent
);
701 SetEventParameter( event
, kEventParamAttributes
, typeUInt32
, sizeof( UInt32
), &options
);
702 SetEventParameter( event
, kEventParamToolbarItemIdentifier
, typeCFStringRef
, sizeof( CFStringRef
), &inIdentifier
);
705 SetEventParameter( event
, kEventParamToolbarItemConfigData
, typeCFTypeRef
, sizeof( CFTypeRef
), &inConfigData
);
707 err
= HIObjectCreate( kControlToolbarItemClassID
, event
, (HIObjectRef
*)&result
);
710 ReleaseEvent( event
);
715 #if wxMAC_USE_NATIVE_TOOLBAR
716 static const EventTypeSpec kToolbarEvents
[] =
718 { kEventClassToolbar
, kEventToolbarGetDefaultIdentifiers
},
719 { kEventClassToolbar
, kEventToolbarGetAllowedIdentifiers
},
720 { kEventClassToolbar
, kEventToolbarCreateItemWithIdentifier
},
723 static OSStatus
ToolbarDelegateHandler( EventHandlerCallRef inCallRef
, EventRef inEvent
, void* inUserData
)
725 OSStatus result
= eventNotHandledErr
;
727 // wxToolBar* toolbar = (wxToolBar*) inUserData ;
728 CFMutableArrayRef array
;
730 switch ( GetEventKind( inEvent
) )
732 case kEventToolbarGetDefaultIdentifiers
:
734 GetEventParameter( inEvent
, kEventParamMutableArray
, typeCFMutableArrayRef
, NULL
,
735 sizeof( CFMutableArrayRef
), NULL
, &array
);
736 // not implemented yet
737 // GetToolbarDefaultItems( array );
742 case kEventToolbarGetAllowedIdentifiers
:
744 GetEventParameter( inEvent
, kEventParamMutableArray
, typeCFMutableArrayRef
, NULL
,
745 sizeof( CFMutableArrayRef
), NULL
, &array
);
746 // not implemented yet
747 // GetToolbarAllowedItems( array );
751 case kEventToolbarCreateItemWithIdentifier
:
753 HIToolbarItemRef item
= NULL
;
754 CFTypeRef data
= NULL
;
755 CFStringRef identifier
= NULL
;
757 GetEventParameter( inEvent
, kEventParamToolbarItemIdentifier
, typeCFStringRef
, NULL
,
758 sizeof( CFStringRef
), NULL
, &identifier
);
760 GetEventParameter( inEvent
, kEventParamToolbarItemConfigData
, typeCFTypeRef
, NULL
,
761 sizeof( CFTypeRef
), NULL
, &data
);
763 if ( CFStringCompare( kControlToolbarItemClassID
, identifier
, kCFCompareBackwards
) == kCFCompareEqualTo
)
765 item
= CreateControlToolbarItem( kControlToolbarItemClassID
, data
);
768 SetEventParameter( inEvent
, kEventParamToolbarItem
, typeHIToolbarItemRef
,
769 sizeof( HIToolbarItemRef
), &item
);
779 #endif // wxMAC_USE_NATIVE_TOOLBAR
781 // also for the toolbar we have the dual implementation:
782 // only when MacInstallNativeToolbar is called is the native toolbar set as the window toolbar
784 bool wxToolBar::Create(
790 const wxString
& name
)
792 if ( !wxToolBarBase::Create( parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
) )
797 OSStatus err
= noErr
;
799 #if wxMAC_USE_NATIVE_TOOLBAR
800 wxString labelStr
= wxString::Format( wxT("%xd"), (int)this );
801 err
= HIToolbarCreate(
802 wxMacCFStringHolder( labelStr
, wxFont::GetDefaultEncoding() ), 0,
803 (HIToolbarRef
*) &m_macHIToolbarRef
);
805 if (m_macHIToolbarRef
!= NULL
)
807 InstallEventHandler( HIObjectGetEventTarget((HIToolbarRef
)m_macHIToolbarRef
), ToolbarDelegateHandler
,
808 GetEventTypeCount( kToolbarEvents
), kToolbarEvents
, this, NULL
);
810 HIToolbarDisplayMode mode
= kHIToolbarDisplayModeDefault
;
811 HIToolbarDisplaySize displaySize
= kHIToolbarDisplaySizeSmall
;
813 if ( style
& wxTB_NOICONS
)
814 mode
= kHIToolbarDisplayModeLabelOnly
;
815 else if ( style
& wxTB_TEXT
)
816 mode
= kHIToolbarDisplayModeIconAndLabel
;
818 mode
= kHIToolbarDisplayModeIconOnly
;
820 HIToolbarSetDisplayMode( (HIToolbarRef
) m_macHIToolbarRef
, mode
);
821 HIToolbarSetDisplaySize( (HIToolbarRef
) m_macHIToolbarRef
, displaySize
);
825 return (err
== noErr
);
828 wxToolBar::~wxToolBar()
830 #if wxMAC_USE_NATIVE_TOOLBAR
831 if (m_macHIToolbarRef
!= NULL
)
833 // if this is the installed toolbar, then deinstall it
834 if (m_macUsesNativeToolbar
)
835 MacInstallNativeToolbar( false );
837 CFRelease( (HIToolbarRef
)m_macHIToolbarRef
);
838 m_macHIToolbarRef
= NULL
;
843 bool wxToolBar::Show( bool show
)
845 WindowRef tlw
= MAC_WXHWND(MacGetTopLevelWindowRef());
846 bool bResult
= (tlw
!= NULL
);
850 #if wxMAC_USE_NATIVE_TOOLBAR
851 bool ownToolbarInstalled
= false;
852 MacTopLevelHasNativeToolbar( &ownToolbarInstalled
);
853 if (ownToolbarInstalled
)
855 bResult
= (IsWindowToolbarVisible( tlw
) != show
);
857 ShowHideWindowToolbar( tlw
, show
, false );
860 bResult
= wxToolBarBase::Show( show
);
863 bResult
= wxToolBarBase::Show( show
);
870 bool wxToolBar::IsShown() const
874 #if wxMAC_USE_NATIVE_TOOLBAR
875 bool ownToolbarInstalled
;
877 MacTopLevelHasNativeToolbar( &ownToolbarInstalled
);
878 if (ownToolbarInstalled
)
880 WindowRef tlw
= MAC_WXHWND(MacGetTopLevelWindowRef());
881 bResult
= IsWindowToolbarVisible( tlw
);
884 bResult
= wxToolBarBase::IsShown();
887 bResult
= wxToolBarBase::IsShown();
893 void wxToolBar::DoGetSize( int *width
, int *height
) const
895 #if wxMAC_USE_NATIVE_TOOLBAR
897 bool ownToolbarInstalled
;
899 MacTopLevelHasNativeToolbar( &ownToolbarInstalled
);
900 if ( ownToolbarInstalled
)
902 // TODO: is this really a control ?
903 GetControlBounds( (ControlRef
) m_macHIToolbarRef
, &boundsR
);
905 *width
= boundsR
.right
- boundsR
.left
;
906 if ( height
!= NULL
)
907 *height
= boundsR
.bottom
- boundsR
.top
;
910 wxToolBarBase::DoGetSize( width
, height
);
913 wxToolBarBase::DoGetSize( width
, height
);
917 wxSize
wxToolBar::DoGetBestSize() const
921 DoGetSize( &width
, &height
);
923 return wxSize( width
, height
);
926 void wxToolBar::SetWindowStyleFlag( long style
)
928 wxToolBarBase::SetWindowStyleFlag( style
);
930 #if wxMAC_USE_NATIVE_TOOLBAR
931 if (m_macHIToolbarRef
!= NULL
)
933 HIToolbarDisplayMode mode
= kHIToolbarDisplayModeDefault
;
935 if ( style
& wxTB_NOICONS
)
936 mode
= kHIToolbarDisplayModeLabelOnly
;
937 else if ( style
& wxTB_TEXT
)
938 mode
= kHIToolbarDisplayModeIconAndLabel
;
940 mode
= kHIToolbarDisplayModeIconOnly
;
942 HIToolbarSetDisplayMode( (HIToolbarRef
) m_macHIToolbarRef
, mode
);
947 #if wxMAC_USE_NATIVE_TOOLBAR
948 bool wxToolBar::MacWantsNativeToolbar()
950 return m_macUsesNativeToolbar
;
953 bool wxToolBar::MacTopLevelHasNativeToolbar(bool *ownToolbarInstalled
) const
955 bool bResultV
= false;
957 if (ownToolbarInstalled
!= NULL
)
958 *ownToolbarInstalled
= false;
960 WindowRef tlw
= MAC_WXHWND(MacGetTopLevelWindowRef());
963 HIToolbarRef curToolbarRef
= NULL
;
964 OSStatus err
= GetWindowToolbar( tlw
, &curToolbarRef
);
965 bResultV
= ((err
== noErr
) && (curToolbarRef
!= NULL
));
966 if (bResultV
&& (ownToolbarInstalled
!= NULL
))
967 *ownToolbarInstalled
= (curToolbarRef
== m_macHIToolbarRef
);
973 bool wxToolBar::MacInstallNativeToolbar(bool usesNative
)
975 bool bResult
= false;
977 if (usesNative
&& (m_macHIToolbarRef
== NULL
))
980 if (usesNative
&& ((GetWindowStyleFlag() & wxTB_VERTICAL
) != 0))
983 WindowRef tlw
= MAC_WXHWND(MacGetTopLevelWindowRef());
987 // check the existing toolbar
988 HIToolbarRef curToolbarRef
= NULL
;
989 OSStatus err
= GetWindowToolbar( tlw
, &curToolbarRef
);
991 curToolbarRef
= NULL
;
993 m_macUsesNativeToolbar
= usesNative
;
995 if (m_macUsesNativeToolbar
)
997 // only install toolbar if there isn't one installed already
998 if (curToolbarRef
== NULL
)
1002 SetWindowToolbar( tlw
, (HIToolbarRef
) m_macHIToolbarRef
);
1003 ShowHideWindowToolbar( tlw
, true, false );
1004 ChangeWindowAttributes( tlw
, kWindowToolbarButtonAttribute
, 0 );
1005 SetAutomaticControlDragTrackingEnabledForWindow( tlw
, true );
1007 Rect r
= { 0, 0, 0, 0 };
1008 m_peer
->SetRect( &r
);
1009 SetSize( wxSIZE_AUTO_WIDTH
, 0 );
1010 m_peer
->SetVisibility( false, true );
1011 wxToolBarBase::Show( false );
1016 // only deinstall toolbar if this is the installed one
1017 if (m_macHIToolbarRef
== curToolbarRef
)
1021 ShowHideWindowToolbar( tlw
, false, false );
1022 ChangeWindowAttributes( tlw
, 0, kWindowToolbarButtonAttribute
);
1023 SetWindowToolbar( tlw
, NULL
);
1025 m_peer
->SetVisibility( true, true );
1030 InvalidateBestSize();
1032 // wxLogDebug( wxT(" --> [%lx] - result [%s]"), (long)this, bResult ? wxT("T") : wxT("F") );
1037 bool wxToolBar::Realize()
1039 if (m_tools
.GetCount() == 0)
1045 int maxToolWidth
= 0;
1046 int maxToolHeight
= 0;
1048 int x
= m_xMargin
+ kwxMacToolBarLeftMargin
;
1049 int y
= m_yMargin
+ kwxMacToolBarTopMargin
;
1052 GetSize( &tw
, &th
);
1054 // find the maximum tool width and height
1055 wxToolBarTool
*tool
;
1056 wxToolBarToolsList::compatibility_iterator node
= m_tools
.GetFirst();
1057 while ( node
!= NULL
)
1059 tool
= (wxToolBarTool
*) node
->GetData();
1062 wxSize sz
= tool
->GetSize();
1064 if ( sz
.x
> maxToolWidth
)
1065 maxToolWidth
= sz
.x
;
1066 if ( sz
.y
> maxToolHeight
)
1067 maxToolHeight
= sz
.y
;
1070 node
= node
->GetNext();
1073 bool lastIsRadio
= false;
1074 bool curIsRadio
= false;
1076 #if wxMAC_USE_NATIVE_TOOLBAR
1077 CFIndex currentPosition
= 0;
1078 bool insertAll
= false;
1081 node
= m_tools
.GetFirst();
1082 while ( node
!= NULL
)
1084 tool
= (wxToolBarTool
*) node
->GetData();
1087 node
= node
->GetNext();
1091 // set tool position:
1092 // for the moment just perform a single row/column alignment
1093 wxSize cursize
= tool
->GetSize();
1094 if ( x
+ cursize
.x
> maxWidth
)
1095 maxWidth
= x
+ cursize
.x
;
1096 if ( y
+ cursize
.y
> maxHeight
)
1097 maxHeight
= y
+ cursize
.y
;
1099 if ( GetWindowStyleFlag() & wxTB_VERTICAL
)
1101 int x1
= x
+ ( maxToolWidth
- cursize
.x
) / 2;
1102 tool
->SetPosition( wxPoint(x1
, y
) );
1106 int y1
= y
+ ( maxToolHeight
- cursize
.y
) / 2;
1107 tool
->SetPosition( wxPoint(x
, y1
) );
1110 // update the item positioning state
1111 if ( GetWindowStyleFlag() & wxTB_VERTICAL
)
1112 y
+= cursize
.y
+ kwxMacToolSpacing
;
1114 x
+= cursize
.x
+ kwxMacToolSpacing
;
1116 #if wxMAC_USE_NATIVE_TOOLBAR
1117 // install in native HIToolbar
1118 if ( m_macHIToolbarRef
!= NULL
)
1120 HIToolbarItemRef hiItemRef
= tool
->GetToolbarItemRef();
1121 if ( hiItemRef
!= NULL
)
1123 if ( insertAll
|| (tool
->GetIndex() != currentPosition
) )
1125 OSStatus err
= noErr
;
1130 // if this is the first tool that gets newly inserted or repositioned
1131 // first remove all 'old' tools from here to the right, because of this
1132 // all following tools will have to be reinserted (insertAll). i = 100 because there's
1133 // no way to determine how many there are in a toolbar, so just a high number :-(
1134 for ( CFIndex i
= 100; i
>= currentPosition
; --i
)
1136 err
= HIToolbarRemoveItemAtIndex( (HIToolbarRef
) m_macHIToolbarRef
, i
);
1141 wxString errMsg
= wxString::Format( wxT("HIToolbarRemoveItemAtIndex failed [%ld]"), (long)err
);
1142 wxFAIL_MSG( errMsg
.c_str() );
1146 err
= HIToolbarInsertItemAtIndex( (HIToolbarRef
) m_macHIToolbarRef
, hiItemRef
, currentPosition
);
1149 wxString errMsg
= wxString::Format( wxT("HIToolbarInsertItemAtIndex failed [%ld]"), (long)err
);
1150 wxFAIL_MSG( errMsg
.c_str() );
1153 tool
->SetIndex( currentPosition
);
1161 // update radio button (and group) state
1162 lastIsRadio
= curIsRadio
;
1163 curIsRadio
= ( tool
->IsButton() && (tool
->GetKind() == wxITEM_RADIO
) );
1167 if ( tool
->IsToggled() )
1168 DoToggleTool( tool
, true );
1174 if ( tool
->Toggle( true ) )
1176 DoToggleTool( tool
, true );
1179 else if ( tool
->IsToggled() )
1181 if ( tool
->IsToggled() )
1182 DoToggleTool( tool
, true );
1184 wxToolBarToolsList::compatibility_iterator nodePrev
= node
->GetPrevious();
1185 while ( nodePrev
!= NULL
)
1187 wxToolBarToolBase
*toggleTool
= nodePrev
->GetData();
1188 if ( (toggleTool
== NULL
) || !toggleTool
->IsButton() || (toggleTool
->GetKind() != wxITEM_RADIO
) )
1191 if ( toggleTool
->Toggle( false ) )
1192 DoToggleTool( toggleTool
, false );
1194 nodePrev
= nodePrev
->GetPrevious();
1199 node
= node
->GetNext();
1202 if ( GetWindowStyleFlag() & wxTB_HORIZONTAL
)
1204 // if not set yet, only one row
1205 if ( m_maxRows
<= 0 )
1208 m_minWidth
= maxWidth
;
1210 maxHeight
+= m_yMargin
+ kwxMacToolBarTopMargin
;
1211 m_minHeight
= m_maxHeight
= maxHeight
;
1215 // if not set yet, have one column
1216 if ( (GetToolsCount() > 0) && (m_maxRows
<= 0) )
1217 SetRows( GetToolsCount() );
1219 m_minHeight
= maxHeight
;
1221 maxWidth
+= m_xMargin
+ kwxMacToolBarLeftMargin
;
1222 m_minWidth
= m_maxWidth
= maxWidth
;
1226 // FIXME: should this be OSX-only?
1228 bool wantNativeToolbar
, ownToolbarInstalled
;
1230 // attempt to install the native toolbar
1231 wantNativeToolbar
= ((GetWindowStyleFlag() & wxTB_VERTICAL
) == 0);
1232 MacInstallNativeToolbar( wantNativeToolbar
);
1233 (void)MacTopLevelHasNativeToolbar( &ownToolbarInstalled
);
1234 if (!ownToolbarInstalled
)
1236 SetSize( maxWidth
, maxHeight
);
1237 InvalidateBestSize();
1241 SetSize( maxWidth
, maxHeight
);
1242 InvalidateBestSize();
1250 void wxToolBar::SetToolBitmapSize(const wxSize
& size
)
1252 m_defaultWidth
= size
.x
+ kwxMacToolBorder
;
1253 m_defaultHeight
= size
.y
+ kwxMacToolBorder
;
1255 #if wxMAC_USE_NATIVE_TOOLBAR
1256 if (m_macHIToolbarRef
!= NULL
)
1258 int maxs
= wxMax( size
.x
, size
.y
);
1259 HIToolbarDisplaySize sizeSpec
;
1261 sizeSpec
= kHIToolbarDisplaySizeNormal
;
1262 else if ( maxs
> 24 )
1263 sizeSpec
= kHIToolbarDisplaySizeDefault
;
1265 sizeSpec
= kHIToolbarDisplaySizeSmall
;
1267 HIToolbarSetDisplaySize( (HIToolbarRef
) m_macHIToolbarRef
, sizeSpec
);
1272 // The button size is bigger than the bitmap size
1273 wxSize
wxToolBar::GetToolSize() const
1275 return wxSize(m_defaultWidth
+ kwxMacToolBorder
, m_defaultHeight
+ kwxMacToolBorder
);
1278 void wxToolBar::SetRows(int nRows
)
1280 // avoid resizing the frame uselessly
1281 if ( nRows
!= m_maxRows
)
1285 void wxToolBar::MacSuperChangedPosition()
1287 wxWindow::MacSuperChangedPosition();
1289 #if wxMAC_USE_NATIVE_TOOLBAR
1290 if (! m_macUsesNativeToolbar
)
1298 wxToolBarToolBase
*wxToolBar::FindToolForPosition(wxCoord x
, wxCoord y
) const
1300 wxToolBarTool
*tool
;
1301 wxToolBarToolsList::compatibility_iterator node
= m_tools
.GetFirst();
1302 while ( node
!= NULL
)
1304 tool
= (wxToolBarTool
*)node
->GetData();
1307 wxRect2DInt
r( tool
->GetPosition(), tool
->GetSize() );
1308 if ( r
.Contains( wxPoint( x
, y
) ) )
1312 node
= node
->GetNext();
1315 return (wxToolBarToolBase
*)NULL
;
1318 wxString
wxToolBar::MacGetToolTipString( wxPoint
&pt
)
1320 wxToolBarToolBase
*tool
= FindToolForPosition( pt
.x
, pt
.y
);
1322 return tool
->GetShortHelp();
1324 return wxEmptyString
;
1327 void wxToolBar::DoEnableTool(wxToolBarToolBase
*t
, bool enable
)
1330 ((wxToolBarTool
*)t
)->DoEnable( enable
);
1333 void wxToolBar::DoToggleTool(wxToolBarToolBase
*t
, bool toggle
)
1335 wxToolBarTool
*tool
= (wxToolBarTool
*)t
;
1336 if ( ( tool
!= NULL
) && tool
->IsButton() )
1337 tool
->UpdateToggleImage( toggle
);
1340 bool wxToolBar::DoInsertTool(size_t WXUNUSED(pos
), wxToolBarToolBase
*toolBase
)
1342 wxToolBarTool
*tool
= wx_static_cast( wxToolBarTool
*, toolBase
);
1346 WindowRef window
= (WindowRef
) MacGetTopLevelWindowRef();
1347 wxSize toolSize
= GetToolSize();
1348 Rect toolrect
= { 0, 0, toolSize
.y
, toolSize
.x
};
1349 ControlRef controlHandle
= NULL
;
1352 switch (tool
->GetStyle())
1354 case wxTOOL_STYLE_SEPARATOR
:
1356 wxASSERT( tool
->GetControlHandle() == NULL
);
1359 if ( GetWindowStyleFlag() & wxTB_VERTICAL
)
1360 toolrect
.bottom
= toolSize
.y
;
1362 toolrect
.right
= toolSize
.x
;
1364 #ifdef __WXMAC_OSX__
1365 // in flat style we need a visual separator
1366 #if wxMAC_USE_NATIVE_TOOLBAR
1367 HIToolbarItemRef item
;
1368 err
= HIToolbarItemCreate(
1369 kHIToolbarSeparatorIdentifier
,
1370 kHIToolbarItemCantBeRemoved
| kHIToolbarItemIsSeparator
| kHIToolbarItemAllowDuplicates
,
1373 tool
->SetToolbarItemRef( item
);
1376 CreateSeparatorControl( window
, &toolrect
, &controlHandle
);
1377 tool
->SetControlHandle( controlHandle
);
1382 case wxTOOL_STYLE_BUTTON
:
1384 wxASSERT( tool
->GetControlHandle() == NULL
);
1385 ControlButtonContentInfo info
;
1386 wxMacCreateBitmapButton( &info
, tool
->GetNormalBitmap(), kControlContentIconRef
);
1388 if ( UMAGetSystemVersion() >= 0x1000)
1390 CreateIconControl( window
, &toolrect
, &info
, false, &controlHandle
);
1394 SInt16 behaviour
= kControlBehaviorOffsetContents
;
1395 if ( tool
->CanBeToggled() )
1396 behaviour
|= kControlBehaviorToggles
;
1397 err
= CreateBevelButtonControl( window
,
1398 &toolrect
, CFSTR(""), kControlBevelButtonNormalBevel
,
1399 behaviour
, &info
, 0, 0, 0, &controlHandle
);
1402 #if wxMAC_USE_NATIVE_TOOLBAR
1403 HIToolbarItemRef item
;
1404 wxString labelStr
= wxString::Format(wxT("%xd"), (int)tool
);
1405 err
= HIToolbarItemCreate(
1406 wxMacCFStringHolder(labelStr
, wxFont::GetDefaultEncoding()),
1407 kHIToolbarItemCantBeRemoved
| kHIToolbarItemAnchoredLeft
| kHIToolbarItemAllowDuplicates
, &item
);
1410 InstallEventHandler(
1411 HIObjectGetEventTarget(item
), GetwxMacToolBarEventHandlerUPP(),
1412 GetEventTypeCount(toolBarEventList
), toolBarEventList
, tool
, NULL
);
1413 HIToolbarItemSetLabel( item
, wxMacCFStringHolder(tool
->GetLabel(), m_font
.GetEncoding()) );
1414 HIToolbarItemSetIconRef( item
, info
.u
.iconRef
);
1415 HIToolbarItemSetCommandID( item
, kHIToolbarCommandPressAction
);
1416 tool
->SetToolbarItemRef( item
);
1420 wxMacReleaseBitmapButton( &info
);
1423 SetBevelButtonTextPlacement( m_controlHandle
, kControlBevelButtonPlaceBelowGraphic
);
1424 UMASetControlTitle( m_controlHandle
, label
, wxFont::GetDefaultEncoding() );
1427 InstallControlEventHandler(
1428 (ControlRef
) controlHandle
, GetwxMacToolBarToolEventHandlerUPP(),
1429 GetEventTypeCount(eventList
), eventList
, tool
, NULL
);
1431 tool
->SetControlHandle( controlHandle
);
1435 case wxTOOL_STYLE_CONTROL
:
1437 #if wxMAC_USE_NATIVE_TOOLBAR
1439 wxASSERT( tool
->GetControl() != NULL
);
1440 HIToolbarItemRef item
;
1441 HIViewRef viewRef
= (HIViewRef
) tool
->GetControl()->GetHandle() ;
1442 // as this control now is part of both the wxToolBar children and the native toolbar, we have to increase the
1443 // reference count to make sure we are not dealing with zombie controls after the native toolbar has released its views
1444 CFRetain( viewRef
) ;
1445 CFDataRef data
= CFDataCreate( kCFAllocatorDefault
, (UInt8
*) &viewRef
, sizeof(viewRef
) ) ;
1446 err
= HIToolbarCreateItemWithIdentifier((HIToolbarRef
) m_macHIToolbarRef
,kControlToolbarItemClassID
,
1451 tool
->SetToolbarItemRef( item
);
1457 // right now there's nothing to do here
1467 if ( controlHandle
)
1469 ControlRef container
= (ControlRef
) GetHandle();
1470 wxASSERT_MSG( container
!= NULL
, wxT("No valid Mac container control") );
1472 UMAShowControl( controlHandle
);
1473 ::EmbedControl( controlHandle
, container
);
1476 if ( tool
->CanBeToggled() && tool
->IsToggled() )
1477 tool
->UpdateToggleImage( true );
1479 // nothing special to do here - we relayout in Realize() later
1480 tool
->Attach( this );
1481 InvalidateBestSize();
1485 wxString errMsg
= wxString::Format( wxT("wxToolBar::DoInsertTool - failure [%ld]"), (long)err
);
1486 wxFAIL_MSG( errMsg
.c_str() );
1489 return (err
== noErr
);
1492 void wxToolBar::DoSetToggle(wxToolBarToolBase
*WXUNUSED(tool
), bool WXUNUSED(toggle
))
1494 wxFAIL_MSG( wxT("not implemented") );
1497 bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos
), wxToolBarToolBase
*toolbase
)
1499 wxToolBarTool
* tool
= wx_static_cast( wxToolBarTool
*, toolbase
);
1500 wxToolBarToolsList::compatibility_iterator node
;
1501 for ( node
= m_tools
.GetFirst(); node
; node
= node
->GetNext() )
1503 wxToolBarToolBase
*tool2
= node
->GetData();
1504 if ( tool2
== tool
)
1506 // let node point to the next node in the list
1507 node
= node
->GetNext();
1513 wxSize sz
= ((wxToolBarTool
*)tool
)->GetSize();
1517 #if wxMAC_USE_NATIVE_TOOLBAR
1518 CFIndex removeIndex
= tool
->GetIndex();
1521 switch ( tool
->GetStyle() )
1523 case wxTOOL_STYLE_CONTROL
:
1525 tool
->GetControl()->Destroy();
1526 tool
->ClearControl();
1530 case wxTOOL_STYLE_BUTTON
:
1531 case wxTOOL_STYLE_SEPARATOR
:
1532 if ( tool
->GetControlHandle() )
1534 #if wxMAC_USE_NATIVE_TOOLBAR
1535 if ( removeIndex
!= -1 && m_macHIToolbarRef
)
1537 HIToolbarRemoveItemAtIndex( (HIToolbarRef
) m_macHIToolbarRef
, removeIndex
);
1538 tool
->SetIndex( -1 );
1542 tool
->ClearControl();
1550 // and finally reposition all the controls after this one
1552 for ( /* node -> first after deleted */; node
; node
= node
->GetNext() )
1554 wxToolBarTool
*tool2
= (wxToolBarTool
*) node
->GetData();
1555 wxPoint pt
= tool2
->GetPosition();
1557 if ( GetWindowStyleFlag() & wxTB_VERTICAL
)
1562 tool2
->SetPosition( pt
);
1564 #if wxMAC_USE_NATIVE_TOOLBAR
1565 if ( removeIndex
!= -1 && tool2
->GetIndex() > removeIndex
)
1566 tool2
->SetIndex( tool2
->GetIndex() - 1 );
1570 InvalidateBestSize();
1575 void wxToolBar::OnPaint(wxPaintEvent
& event
)
1577 #if wxMAC_USE_NATIVE_TOOLBAR
1578 if ( m_macUsesNativeToolbar
)
1590 bool drawMetalTheme
= MacGetTopLevelWindow()->MacGetMetalAppearance();
1591 bool minimumUmaAvailable
= (UMAGetSystemVersion() >= 0x1030);
1593 #if wxMAC_USE_CORE_GRAPHICS && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
1594 if ( !drawMetalTheme
&& minimumUmaAvailable
)
1596 HIThemePlacardDrawInfo info
;
1597 memset( &info
, 0, sizeof(info
) );
1599 info
.state
= IsEnabled() ? kThemeStateActive
: kThemeStateInactive
;
1601 CGContextRef cgContext
= (CGContextRef
) MacGetCGContextRef();
1602 HIRect rect
= CGRectMake( 0, 0, w
, h
);
1603 HIThemeDrawPlacard( &rect
, &info
, cgContext
, kHIThemeOrientationNormal
);
1607 // leave the background as it is (striped or metal)
1612 const bool drawBorder
= true;
1616 wxMacPortSetter
helper( &dc
);
1618 if ( !drawMetalTheme
|| !minimumUmaAvailable
)
1620 Rect toolbarrect
= { dc
.YLOG2DEVMAC(0), dc
.XLOG2DEVMAC(0),
1621 dc
.YLOG2DEVMAC(h
), dc
.XLOG2DEVMAC(w
) };
1624 if ( toolbarrect
.left
< 0 )
1625 toolbarrect
.left
= 0;
1626 if ( toolbarrect
.top
< 0 )
1627 toolbarrect
.top
= 0;
1630 UMADrawThemePlacard( &toolbarrect
, IsEnabled() ? kThemeStateActive
: kThemeStateInactive
);
1634 #if TARGET_API_MAC_OSX
1635 HIRect hiToolbarrect
= CGRectMake(
1636 dc
.YLOG2DEVMAC(0), dc
.XLOG2DEVMAC(0),
1637 dc
.YLOG2DEVREL(h
), dc
.XLOG2DEVREL(w
) );
1638 CGContextRef cgContext
;
1641 GetPortBounds( (CGrafPtr
) dc
.m_macPort
, &bounds
);
1642 QDBeginCGContext( (CGrafPtr
) dc
.m_macPort
, &cgContext
);
1644 CGContextTranslateCTM( cgContext
, 0, bounds
.bottom
- bounds
.top
);
1645 CGContextScaleCTM( cgContext
, 1, -1 );
1647 HIThemeBackgroundDrawInfo drawInfo
;
1648 drawInfo
.version
= 0;
1649 drawInfo
.state
= kThemeStateActive
;
1650 drawInfo
.kind
= kThemeBackgroundMetal
;
1651 HIThemeApplyBackground( &hiToolbarrect
, &drawInfo
, cgContext
, kHIThemeOrientationNormal
);
1654 QDEndCGContext( (CGrafPtr
) dc
.m_macPort
, &cgContext
);
1664 #endif // wxUSE_TOOLBAR