Allow enabling individual touch gesture events

Implement support for enabling just some gesture events instead of
having to choose between getting none or all of them.

Also make wxTOUCH_NONE really disable the gestures events generation
instead of just doing nothing as before.
This commit is contained in:
Vadim Zeitlin
2017-11-21 22:46:56 +01:00
parent 842dd1cfd9
commit a8dfaa569b
5 changed files with 356 additions and 87 deletions

View File

@@ -52,6 +52,68 @@ enum wxShowEffect
};
/**
Values for wxWindow::EnableTouchEvents() mask.
The values other than ::wxTOUCH_NONE and ::wxTOUCH_ALL_GESTURES can be
combined together to request enabling events for the specified gestures and
for them only.
@since 3.1.1
*/
enum
{
/**
Don't generate any touch events.
*/
wxTOUCH_NONE,
/**
Generate wxPanGestureEvent for vertical pans.
Note that under macOS horizontal pan events are also enabled when this
flag is specified.
*/
wxTOUCH_VERTICAL_PAN_GESTURE,
/**
Generate wxPanGestureEvent for horizontal pans.
Note that under macOS vertical pan events are also enabled when this
flag is specified.
*/
wxTOUCH_HORIZONTAL_PAN_GESTURE,
/**
Generate wxPanGestureEvent for any pans.
This is just a convenient combination of wxTOUCH_VERTICAL_PAN_GESTURE
and wxTOUCH_HORIZONTAL_PAN_GESTURE.
*/
wxTOUCH_PAN_GESTURES,
/**
Generate wxZoomGestureEvent.
*/
wxTOUCH_ZOOM_GESTURE,
/**
Generate wxRotateGestureEvent.
*/
wxTOUCH_ROTATE_GESTURE,
/**
Generate events for press or tap gestures such as wxTwoFingerTapEvent,
wxLongPressEvent and wxPressAndTapEvent.
*/
wxTOUCH_PRESS_GESTURES,
/**
Enable all supported gesture events.
*/
wxTOUCH_ALL_GESTURES
};
/**
flags for SendSizeEvent()
*/
@@ -3427,6 +3489,15 @@ public:
/**
Request generation of touch events for this window.
Each call to this function supersedes the previous ones, i.e. if you
want to receive events for both zoom and rotate gestures, you need to
call
@code
EnableTouchEvents(wxTOUCH_ZOOM_GESTURE | wxTOUCH_ROTATE_GESTURE);
@endcode
instead of calling it twice in a row as the second call would disable
the first gesture.
@param eventsMask Either wxTOUCH_NONE or wxTOUCH_ALL_GESTURES to
disable or enable gesture events for this window.