+static const EventTypeSpec eventList[] =
+{
+ { kEventClassControl , kEventControlHit } ,
+} ;
+
+static pascal OSStatus wxMacToolBarToolControlEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
+{
+ OSStatus result = eventNotHandledErr ;
+
+ wxMacCarbonEvent cEvent( event ) ;
+
+ ControlRef controlRef ;
+
+ cEvent.GetParameter( kEventParamDirectObject , &controlRef ) ;
+
+ switch( GetEventKind( event ) )
+ {
+ case kEventControlHit :
+ {
+ wxToolBarTool* tbartool = (wxToolBarTool*)data ;
+ if ( tbartool->CanBeToggled() )
+ {
+ tbartool->Toggle( GetControl32BitValue( (ControlRef) tbartool->GetControlHandle() ) ) ;
+ }
+ ((wxToolBar*)tbartool->GetToolBar())->OnLeftClick( tbartool->GetId() , tbartool -> IsToggled() ) ;
+
+ result = noErr;
+ }
+ break ;
+ default :
+ break ;
+ }
+ return result ;
+}
+
+pascal OSStatus wxMacToolBarToolEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
+{
+ OSStatus result = eventNotHandledErr ;
+
+ switch ( GetEventClass( event ) )
+ {
+ case kEventClassControl :
+ result = wxMacToolBarToolControlEventHandler( handler, event, data ) ;
+ break ;
+ default :
+ break ;
+ }
+ return result ;
+}
+
+DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacToolBarToolEventHandler )
+