Merge multi-touch gestures event branch

This is a squashed commit of the SOC2017_GESTURES branch from
https://github.com/prashantkn94/wxWidgets.git

Closes https://github.com/wxWidgets/wxWidgets/pull/551
This commit is contained in:
prashantkn94
2017-09-10 21:13:32 +05:30
committed by Vadim Zeitlin
parent aef4edb969
commit 261b04b5a3
21 changed files with 2318 additions and 10 deletions

View File

@@ -3644,6 +3644,257 @@ public:
void SetPosition(int pos);
};
/** @class wxGestureEvent
This is the base class for all supported gesture events.
@library{wxcore}
@category{events}
@see wxPanGestureEvent, wxZoomGestureEvent, wxRotateGestureEvent
@since 3.1.1
*/
class wxGestureEvent : public wxEvent
{
public:
/**
Constructor.
*/
wxGestureEvent(wxWindowID winid = 0, wxEventType type = wxEVT_NULL);
/**
Returns the position where the event took effect, in client coordinates: position of Pan event,
center of zoom for Zoom event, center of rotation for Rotate event, center of box formed by 2 fingers
for Two Finger Tap event and position of the pressed finger for Press and Tap Event.
*/
const wxPoint& GetPosition() const;
/**
Returns true if the event was the first in a gesture sequence.
*/
bool IsGestureStart() const;
/**
Returns true if the event was the last in a gesture sequence.
*/
bool IsGestureEnd() const;
/**
Sets the position where the event took effect, in client coordinates: position of Pan event,
center of zoom for Zoom event, center of rotation for Rotate event.
*/
void SetPosition(const wxPoint& pos);
/**
Sets the event to be the first in a gesture sequence.
*/
void SetGestureStart(bool isStart = true);
/**
Sets the event to be the last in a gesture sequence.
*/
void SetGestureEnd(bool isEnd = true);
};
/** @class wxPanGestureEvent
This event is generated when the user moves a finger on the surface.
wxGTK also generates this event during mouse dragging (mouse motion while a left mouse button is depressed).
Note that OSX requires the primary mouse button to be pressed while performing the finger movement.
@beginEventTable{wxPanGestureEvent}
@event{EVT_GESTURE_PAN(id, func)}
Process a @c wxEVT_GESTURE_PAN.
@endEventTable
@library{wxcore}
@category{events}
@since 3.1.1
*/
class wxPanGestureEvent : class wxGestureEvent
{
public:
/**
Constructor.
*/
wxPanGestureEvent(wxWindowID winid = 0);
/**
Returns the horizontal component of the distance covered since the previous Pan event.
*/
int GetDeltaX() const;
/**
Returns the vertical component of the distance covered since the previous Pan event.
*/
int GetDeltaY() const;
/**
Sets the horizontal component of the distance covered since the previous Pan event.
*/
int SetDeltaX(int DeltaX);
/**
Sets the vertical component of the distance covered since the previous Pan event.
*/
int SetDeltaY(int DeltaY);
};
/** @class wxZoomGestureEvent
This event is generated when two fingers pinch the surface to zoom in or out.
@beginEventTable{wxZoomGestureEvent}
@event{EVT_GESTURE_ZOOM(id, func)}
Process a @c wxEVT_GESTURE_ZOOM.
@endEventTable
@library{wxcore}
@category{events}
@since 3.1.1
*/
class wxZoomGestureEvent : public wxGestureEvent
{
public:
/**
Constructor.
*/
wxZoomGestureEvent(wxWindowID windid = 0);
/**
Returns the zoom Factor since the gesture started. Hence, starting of the gesture
is considered as 1:1. A value greater than 1.0 means we should enlarge
(or zoom in), a value less than 1.0 means we should shrink (or zoom out).
*/
double GetZoomFactor() const;
/**
Sets the zoom Factor.
*/
double SetZoomFactor() const;
};
/** @class wxRotateGestureEvent
This event is generated when two fingers move in opposite directions on the surface.
@beginEventTable{wxRotateGestureEvent}
@event{EVT_GESTURE_ROTATE(id, func)}
Process a @c wxEVT_GESTURE_ROTATE.
@endEventTable
@library{wxcore}
@category{events}
@since 3.1.1
*/
class wxRotateGestureEvent : public wxGestureEvent
{
public:
/**
Constructor.
*/
wxRotateGestureEvent(wxWindowID windid = 0);
/**
Returns the total angle of rotation in radians in clockwise direction since the
gesture was first started i.e. when IsGestureStart() returned true. This value is always
greater than or equal to zero.
*/
double GetRotationAngle() const;
/**
Sets the total angle of rotation in radians in clockwise direction since the
gesture was first started i.e. when IsGestureStart() returned true. This value is always
greater than or equal to zero.
*/
void SetRotationAngle(double rotationAngle);
};
/** @class wxTwoFingerTapEvent
This event is generated when two fingers touch the surface at the same time.
@beginEventTable{wxTwoFingerTapEvent}
@event{EVT_TWO_FINGER_TAP(id, func)}
Process a @c wxEVT_TWO_FINGER_TAP.
@endEventTable
@library{wxcore}
@category{events}
@since 3.1.1
*/
class wxTwoFingerTapEvent : public wxGestureEvent
{
public:
/**
Constructor.
*/
wxTwoFingerTapEvent(wxWindowID windid = 0);
};
/** @class wxLongPressEvent
This event is generated when one finger touches the surface and remains stationary.
Note that currently it is only generated under wxGTK and wxOSX.
wxGTK also generates this event when left mouse button is being pressed for some minimum duration of time.
@beginEventTable{wxLongPressEvent}
@event{EVT_LONG_PRESS(id, func)}
Process a @c wxEVT_LONG_PRESS.
@endEventTable
@library{wxcore}
@category{events}
@since 3.1.1
*/
class wxLongPressEvent : public wxGestureEvent
{
public:
/**
Constructor.
*/
wxLongPressEvent(wxWindowID windid = 0);
};
/** @class wxPressAndTapEvent
This event is generated when the user press the surface with one finger and taps with another.
Note that once started the event will also be generated when the finger that was pressed moves on surface.
@beginEventTable{wxPressAndTapEvent}
@event{EVT_PRESS_AND_TAP(id, func)}
Process a @c wxEVT_PRESS_AND_TAP.
@endEventTable
@library{wxcore}
@category{events}
@since 3.1.1
*/
class wxPressAndTapEvent : public wxGestureEvent
{
public:
/**
Constructor.
*/
wxPressAndTapEvent(wxWindowID windid = 0);
};
#endif // wxUSE_GUI
#if wxUSE_BASE