Added Multigesture support
This commit is contained in:
parent
61ba9d1aaf
commit
cebcbd8117
@ -1473,6 +1473,28 @@ bool TBWidget::InvokeWheel(int x, int y, int delta_x, int delta_y, MODIFIER_KEYS
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TBWidget::InvokeMultiGesture (float dTheta, float dDist, int x, int y, uint16 numFingers)
|
||||
{
|
||||
SetHoveredWidget(GetWidgetAt(x,y,true), true);
|
||||
|
||||
TBWidget *target = captured_widget ? captured_widget : hovered_widget;
|
||||
if (target)
|
||||
{
|
||||
target->ConvertFromRoot(x,y);
|
||||
TBWidgetEvent ev (EVENT_TYPE_MULTI_GESTURE, x, y, true);
|
||||
ev.dTheta = dTheta;
|
||||
ev.dDist = dDist;
|
||||
ev.numFingers = numFingers;
|
||||
target->InvokeEvent(ev);
|
||||
|
||||
// Return true when we have a target instead of InvokeEvent result. If a widget is
|
||||
// hit is more interesting for callers than if the event was handled or not.
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TBWidget::InvokeKey(int key, SPECIAL_KEY special_key, MODIFIER_KEYS modifierkeys, bool down)
|
||||
{
|
||||
bool handled = false;
|
||||
|
@ -57,6 +57,8 @@ enum EVENT_TYPE {
|
||||
EVENT_TYPE_POINTER_MOVE,
|
||||
EVENT_TYPE_WHEEL,
|
||||
|
||||
EVENT_TYPE_MULTI_GESTURE,
|
||||
|
||||
/** Invoked after changing text in a TBTextField, changing selected item
|
||||
in a TBSelectList etc. Invoking this event trigs synchronization with
|
||||
connected TBWidgetValue and other widgets connected to it. */
|
||||
@ -120,6 +122,9 @@ public:
|
||||
TBID ref_id; ///< Sometimes (when documented) events have a ref_id (The id that caused this event)
|
||||
bool touch; ///< Set for pointer events. True if the event is a touch event (finger or pen on screen)
|
||||
///< False if mouse or other cursor input.
|
||||
float dTheta; ///< Set for multigesture events. the amount that the fingers rotated during this motion
|
||||
float dDist; ///< Set for multigesture events. the amount that the fingers pinched during this motion
|
||||
uint16 numFingers; ///< Set for multigesture events. the number of fingers used in the gesture
|
||||
|
||||
TBOBJECT_SUBCLASS(TBWidgetEvent, TBTypedObject);
|
||||
|
||||
@ -925,6 +930,8 @@ public:
|
||||
void InvokePointerMove(int x, int y, MODIFIER_KEYS modifierkeys, bool touch);
|
||||
bool InvokeWheel(int x, int y, int delta_x, int delta_y, MODIFIER_KEYS modifierkeys);
|
||||
|
||||
bool InvokeMultiGesture (float dTheta, float dDist, int x, int y, uint16 numFingers);
|
||||
|
||||
/** Invoke the EVENT_TYPE_KEY_DOWN and EVENT_TYPE_KEY_UP events on the currently focused widget.
|
||||
This will also do some generic key handling, such as cycling focus on tab etc. */
|
||||
bool InvokeKey(int key, SPECIAL_KEY special_key, MODIFIER_KEYS modifierkeys, bool down);
|
||||
|
Loading…
Reference in New Issue
Block a user