- if ( m_macControl == NULL )
- {
- event.Skip() ;
- return ;
- }
-
- if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
- {
-
- int x = event.m_x ;
- int y = event.m_y ;
-
- MacClientToRootWindow( &x , &y ) ;
-
- ControlHandle control ;
- Point localwhere ;
- SInt16 controlpart ;
- WindowRef window = GetMacRootWindow() ;
-
- localwhere.h = x ;
- localwhere.v = y ;
-
- short modifiers = 0;
-
- if ( !event.m_leftDown && !event.m_rightDown )
- modifiers |= btnState ;
-
- if ( event.m_shiftDown )
- modifiers |= shiftKey ;
-
- if ( event.m_controlDown )
- modifiers |= controlKey ;
-
- if ( event.m_altDown )
- modifiers |= optionKey ;
-
- if ( event.m_metaDown )
- modifiers |= cmdKey ;
-
- controlpart = FindControl( localwhere , window , &control ) ;
- {
- /*
- if ( AcceptsFocus() && FindFocus() != this )
- {
- SetFocus() ;
- }
- */
- if ( control && UMAIsControlActive( control ) )
- {
- {
- if ( controlpart == kControlIndicatorPart && !UMAHasAppearance() )
- controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) NULL ) ;
- else
- controlpart = UMAHandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
- wxTheApp->s_lastMouseDown = 0 ;
- if ( controlpart && ! ( ( UMAHasAppearance() || (controlpart != kControlIndicatorPart) )
- && (IsKindOf( CLASSINFO( wxScrollBar ) ) ) ) ) // otherwise we will get the event twice
- {
- MacHandleControlClick( control , controlpart ) ;
- }
- }
- }
- }
- }
+ if ( (ControlHandle) m_macControl == NULL )
+ {
+ event.Skip() ;
+ return ;
+ }
+
+ if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
+ {
+
+ int x = event.m_x ;
+ int y = event.m_y ;
+
+ MacClientToRootWindow( &x , &y ) ;
+
+ ControlHandle control ;
+ Point localwhere ;
+ SInt16 controlpart ;
+ WindowRef window = (WindowRef) MacGetRootWindow() ;
+
+ localwhere.h = x ;
+ localwhere.v = y ;
+
+ short modifiers = 0;
+
+ if ( !event.m_leftDown && !event.m_rightDown )
+ modifiers |= btnState ;
+
+ if ( event.m_shiftDown )
+ modifiers |= shiftKey ;
+
+ if ( event.m_controlDown )
+ modifiers |= controlKey ;
+
+ if ( event.m_altDown )
+ modifiers |= optionKey ;
+
+ if ( event.m_metaDown )
+ modifiers |= cmdKey ;
+/*
+#if TARGET_CARBON
+ control = FindControlUnderMouse( localwhere , window , &controlpart ) ;
+#else
+ controlpart = FindControl( localwhere , window , &control ) ;
+#endif
+*/
+ {
+ /*
+ if ( AcceptsFocus() && FindFocus() != this )
+ {
+ SetFocus() ;
+ }
+ */
+ control = (ControlHandle) m_macControl ;
+ if ( control && ::IsControlActive( control ) )
+ {
+ {
+ controlpart = ::HandleControlClick( control , localwhere , modifiers , (ControlActionUPP) -1 ) ;
+ wxTheApp->s_lastMouseDown = 0 ;
+ if ( control && controlpart != kControlNoPart &&
+ ! IsKindOf( CLASSINFO( wxScrollBar ) )
+ ) // otherwise we will get the event twice for scrollbar
+ {
+ MacHandleControlClick( control , controlpart ) ;
+ }
+ }
+ }
+ }
+ }