two-level switch statement for event types

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28020 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2004-06-25 09:21:15 +00:00
parent 4e4e6dce5b
commit 90ff87d7b0

View File

@@ -306,29 +306,38 @@ static void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent )
break ; break ;
} }
} }
// determinate the correct click button // translate into wx types
if ( button == kEventMouseButtonSecondary ) switch ( cEvent.GetKind() )
{ {
if (cEvent.GetKind() == kEventMouseDown ) case kEventMouseDown :
wxevent.SetEventType( clickCount > 1 ? wxEVT_RIGHT_DCLICK : wxEVT_RIGHT_DOWN ) ; switch( button )
else if ( cEvent.GetKind() == kEventMouseUp ) {
wxevent.SetEventType(wxEVT_RIGHT_UP ) ; case kEventMouseButtonPrimary :
} wxevent.SetEventType(clickCount > 1 ? wxEVT_LEFT_DCLICK : wxEVT_LEFT_DOWN ) ;
else if ( button == kEventMouseButtonTertiary ) break ;
{ case kEventMouseButtonSecondary :
if (cEvent.GetKind() == kEventMouseDown ) wxevent.SetEventType( clickCount > 1 ? wxEVT_RIGHT_DCLICK : wxEVT_RIGHT_DOWN ) ;
wxevent.SetEventType(clickCount > 1 ? wxEVT_MIDDLE_DCLICK : wxEVT_MIDDLE_DOWN ) ; break ;
else if ( cEvent.GetKind() == kEventMouseUp ) case kEventMouseButtonTertiary :
wxevent.SetEventType(wxEVT_MIDDLE_UP ) ; wxevent.SetEventType(clickCount > 1 ? wxEVT_MIDDLE_DCLICK : wxEVT_MIDDLE_DOWN ) ;
} break ;
else }
{ break ;
if (cEvent.GetKind() == kEventMouseDown ) case kEventMouseUp :
wxevent.SetEventType(clickCount > 1 ? wxEVT_LEFT_DCLICK : wxEVT_LEFT_DOWN ) ; switch( button )
else if ( cEvent.GetKind() == kEventMouseUp ) {
wxevent.SetEventType(wxEVT_LEFT_UP ) ; case kEventMouseButtonPrimary :
else if ( cEvent.GetKind() == kEventMouseWheelMoved ) wxevent.SetEventType( wxEVT_LEFT_UP ) ;
{ break ;
case kEventMouseButtonSecondary :
wxevent.SetEventType( wxEVT_RIGHT_UP ) ;
break ;
case kEventMouseButtonTertiary :
wxevent.SetEventType( wxEVT_MIDDLE_UP ) ;
break ;
}
break ;
case kEventMouseWheelMoved :
wxevent.SetEventType(wxEVT_MOUSEWHEEL ) ; wxevent.SetEventType(wxEVT_MOUSEWHEEL ) ;
// EventMouseWheelAxis axis = cEvent.GetParameter<EventMouseWheelAxis>(kEventParamMouseWheelAxis, typeMouseWheelAxis) ; // EventMouseWheelAxis axis = cEvent.GetParameter<EventMouseWheelAxis>(kEventParamMouseWheelAxis, typeMouseWheelAxis) ;
@@ -337,9 +346,10 @@ static void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent )
wxevent.m_wheelRotation = delta; wxevent.m_wheelRotation = delta;
wxevent.m_wheelDelta = 1; wxevent.m_wheelDelta = 1;
wxevent.m_linesPerAction = 1; wxevent.m_linesPerAction = 1;
} break ;
else default :
wxevent.SetEventType(wxEVT_MOTION ) ; wxevent.SetEventType(wxEVT_MOTION ) ;
break ;
} }
} }