adding scroll wheel support
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58756 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -182,12 +182,15 @@ bool g_lastButtonWasFakeRight = false ;
|
|||||||
|
|
||||||
void SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEvent )
|
void SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEvent )
|
||||||
{
|
{
|
||||||
|
int eventType = [nsEvent type];
|
||||||
UInt32 modifiers = [nsEvent modifierFlags] ;
|
UInt32 modifiers = [nsEvent modifierFlags] ;
|
||||||
wxPoint screenMouseLocation = wxFromNSPoint( NULL, [nsEvent locationInWindow]);
|
wxPoint screenMouseLocation = wxFromNSPoint( NULL, [nsEvent locationInWindow]);
|
||||||
|
|
||||||
// these parameters are not given for all events
|
// these parameters are not given for all events
|
||||||
UInt32 button = [nsEvent buttonNumber];
|
UInt32 button = [nsEvent buttonNumber];
|
||||||
UInt32 clickCount = [nsEvent clickCount];
|
UInt32 clickCount = 0;
|
||||||
|
if ( eventType != NSScrollWheel )
|
||||||
|
[nsEvent clickCount];
|
||||||
|
|
||||||
wxevent.m_x = screenMouseLocation.x;
|
wxevent.m_x = screenMouseLocation.x;
|
||||||
wxevent.m_y = screenMouseLocation.y;
|
wxevent.m_y = screenMouseLocation.y;
|
||||||
@@ -199,7 +202,6 @@ void SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEvent )
|
|||||||
wxevent.SetTimestamp( [nsEvent timestamp] * 1000.0 ) ;
|
wxevent.SetTimestamp( [nsEvent timestamp] * 1000.0 ) ;
|
||||||
|
|
||||||
UInt32 mouseChord = 0;
|
UInt32 mouseChord = 0;
|
||||||
int eventType = [nsEvent type];
|
|
||||||
|
|
||||||
switch (eventType)
|
switch (eventType)
|
||||||
{
|
{
|
||||||
@@ -313,15 +315,17 @@ void SetupMouseEvent( wxMouseEvent &wxevent , NSEvent * nsEvent )
|
|||||||
case NSScrollWheel :
|
case NSScrollWheel :
|
||||||
{
|
{
|
||||||
wxevent.SetEventType( wxEVT_MOUSEWHEEL ) ;
|
wxevent.SetEventType( wxEVT_MOUSEWHEEL ) ;
|
||||||
/*
|
|
||||||
EventMouseWheelAxis axis = cEvent.GetParameter<EventMouseWheelAxis>(kEventParamMouseWheelAxis, typeMouseWheelAxis) ;
|
|
||||||
SInt32 delta = cEvent.GetParameter<SInt32>(kEventParamMouseWheelDelta, typeSInt32) ;
|
|
||||||
*/
|
|
||||||
wxevent.m_wheelRotation = 10; // delta;
|
|
||||||
wxevent.m_wheelDelta = 1;
|
wxevent.m_wheelDelta = 1;
|
||||||
wxevent.m_linesPerAction = 1;
|
wxevent.m_linesPerAction = 1;
|
||||||
if ( 0 /* axis == kEventMouseWheelAxisX*/ )
|
if ( abs([nsEvent deltaX]) > abs([nsEvent deltaY]) )
|
||||||
|
{
|
||||||
wxevent.m_wheelAxis = 1;
|
wxevent.m_wheelAxis = 1;
|
||||||
|
wxevent.m_wheelRotation = [nsEvent deltaX] > 0.0 ? 1 : -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxevent.m_wheelRotation = [nsEvent deltaY] > 0.0 ? 1 : -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user