+// so we can check for column clicks
+static const EventTypeSpec eventList[] =
+{
+ { kEventClassControl, kEventControlHit },
+};
+
+static pascal OSStatus wxMacListCtrlEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
+{
+ OSStatus result = eventNotHandledErr ;
+
+ wxMacCarbonEvent cEvent( event ) ;
+
+ ControlRef controlRef ;
+ cEvent.GetParameter( kEventParamDirectObject , &controlRef ) ;
+
+ wxListCtrl *window = (wxListCtrl*) data ;
+ wxListEvent le( wxEVT_COMMAND_LIST_COL_CLICK, window->GetId() );
+ le.SetEventObject( window );
+
+ switch ( GetEventKind( event ) )
+ {
+ // check if the column was clicked on and fire an event if so
+ case kEventControlHit :
+ {
+ ControlPartCode result = cEvent.GetParameter<ControlPartCode>(kEventParamControlPart, typeControlPartCode) ;
+ if (result == kControlButtonPart){
+ DataBrowserPropertyID col;
+ GetDataBrowserSortProperty(controlRef, &col);
+ int column = col - kMinColumnId;
+ le.m_col = column;
+ window->GetEventHandler()->ProcessEvent( le );
+ }
+ result = CallNextEventHandler(handler, event);
+ break;
+ }
+ default :
+ break ;
+ }
+
+
+ return result ;
+}
+
+DEFINE_ONE_SHOT_HANDLER_GETTER( wxMacListCtrlEventHandler )
+