Kanzi  3.9.7
Kanzi Engine API
kanzi::TouchEvent Class Reference

The event holds the information about a touch event occurrence. More...

#include <kanzi/core.ui/platform/input/common/events.hpp>

Inheritance diagram for kanzi::TouchEvent:
[legend]

Classes

class  TouchPoint
 The TouchPoint class holds information about a touch point, such as a finger. More...
 

Public Member Functions

TouchState getState () const
 Returns the overall state of the touch event. More...
 
const TouchPointgetTouchPointByIndex (size_t index) const
 Returns the reference to the touch point at a given index. More...
 
size_t getTouchPointCount () const
 Returns the number of touch points that the event holds. More...
 
bool isFromPointer () const
 Returns whether a touch event is a pointer event. More...
 
bool isMovementOnly () const
 Returns true if the touch event is a movement event only. More...
 
 TouchEvent (TouchState state, const list< TouchEvent::TouchPoint > &points)
 Creates a touch event with a list of points and an overall touch state. More...
 
 TouchEvent (TouchState state, size_t id, TouchPointState pointState, float x, float y, float pressure=1.0f, float radius=1.0f)
 Creates a touch event with a single touch point. More...
 
 TouchEvent (TouchState state, const TouchEvent::TouchPoint &point)
 Creates a touch event with a single touch point. More...
 
UniqueEventPtr transform (const Matrix3x3 &transformationMatrix) const
 Transforms the touch event using the given transformationMatrix. More...
 
- Public Member Functions inherited from kanzi::InputEvent
Type getType () const
 Returns the type of the event. More...
 
 InputEvent (Type type)
 Constructs an event with a given type. More...
 
bool isHandled () const
 Returns true if the event is handled, false if not. More...
 
void markHandled ()
 Marks the event as handled. More...
 
virtual ~InputEvent ()
 Destructor. More...
 

Static Public Member Functions

static bool isPointerId (int id)
 Returns whether the given id is equal to the ID reserved for mouse pointer events. More...
 

Protected Types

typedef vector< TouchPointTouchPointContainer
 The touch point container type. More...
 

Protected Attributes

TouchPointContainer m_points
 Container with the touch points. More...
 
TouchState m_state
 The overall state of the touch event. More...
 

Additional Inherited Members

- Public Types inherited from kanzi::InputEvent
enum  Type {
  Key, Pointer, Touch, WindowResized,
  WindowResizeRequest, WindowFocusLost, WindowFocusGained, WindowHidden,
  WindowResourcesLost, WindowOrientationChanged, WindowRedrawRequest, WindowPlacement,
  WindowClosed, ApplicationPaused, ApplicationSleep, ApplicationWakeup,
  DebugToggleHud, DebugSetHud, UserEvent
}
 InputEvent type enumeration. More...
 

Detailed Description

The event holds the information about a touch event occurrence.

A touch event can have several touch points. Each touch point has information like identifier, state, coordinates, pressure, and radius. The touch point state specifies whether the touch point is down, has moved, or is released. Beside these, the touch event has an overall state that specifies whether the touch event holds the first finger of the kind, an update on the events, or holds the last finger of a gesture.

The type of the event is InputEvent::Touch.

Member Typedef Documentation

The touch point container type.

Constructor & Destructor Documentation

kanzi::TouchEvent::TouchEvent ( TouchState  state,
const list< TouchEvent::TouchPoint > &  points 
)
explicit

Creates a touch event with a list of points and an overall touch state.

Parameters
stateThe overall touch event state.
pointsThe list of touch points held by the touch event.
kanzi::TouchEvent::TouchEvent ( TouchState  state,
size_t  id,
TouchPointState  pointState,
float  x,
float  y,
float  pressure = 1.0f,
float  radius = 1.0f 
)
explicit

Creates a touch event with a single touch point.

Parameters
stateThe overall touch event state.
idThe touch point identifier.
pointStateThe touch point state.
xThe x axis coordinate of the touch point.
yThe y axis coordinate of the touch point.
pressureThe pressure of the touch point. The default value is 1.0.
radiusThe radius of the touch point. The default value is 1.0.
kanzi::TouchEvent::TouchEvent ( TouchState  state,
const TouchEvent::TouchPoint point 
)
explicit

Creates a touch event with a single touch point.

Parameters
stateThe overall touch event state.
pointThe touch point data.

Member Function Documentation

size_t kanzi::TouchEvent::getTouchPointCount ( ) const
inline

Returns the number of touch points that the event holds.

TouchState kanzi::TouchEvent::getState ( ) const
inline

Returns the overall state of the touch event.

const TouchPoint& kanzi::TouchEvent::getTouchPointByIndex ( size_t  index) const

Returns the reference to the touch point at a given index.

If the index is larger than number of the touch points held by the touch event, the method asserts.

Parameters
indexThe index of the touch point.
Returns
Const reference to the touch point held.
bool kanzi::TouchEvent::isMovementOnly ( ) const

Returns true if the touch event is a movement event only.

This means that the touch event contains touch points with moving state.

UniqueEventPtr kanzi::TouchEvent::transform ( const Matrix3x3 transformationMatrix) const

Transforms the touch event using the given transformationMatrix.

Parameters
transformationMatrixThe transformation matrix to apply on the touch points.
bool kanzi::TouchEvent::isFromPointer ( ) const

Returns whether a touch event is a pointer event.

Returns
If the event is generated from a pointer, true. If the event is a native touch event, false.
static bool kanzi::TouchEvent::isPointerId ( int  id)
static

Returns whether the given id is equal to the ID reserved for mouse pointer events.

Parameters
idThe ID to check.
Returns
If the given id is the mouse pointer ID, true, otherwise false.

Member Data Documentation

TouchPointContainer kanzi::TouchEvent::m_points
protected

Container with the touch points.

TouchState kanzi::TouchEvent::m_state
protected

The overall state of the touch event.


The documentation for this class was generated from the following file: