Kanzi 3.9.10
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.
 
const TouchPointgetTouchPointByIndex (size_t index) const
 Returns the reference to the touch point at a given index.
 
size_t getTouchPointCount () const
 Returns the number of touch points that the event holds.
 
bool isFromPointer () const
 Returns whether a touch event is a pointer event.
 
bool isMovementOnly () const
 Returns true if the touch event is a movement event only.
 
 TouchEvent (TouchState state, const list< TouchEvent::TouchPoint > &points)
 Creates a touch event with a list of points and an overall touch state.
 
 TouchEvent (TouchState state, const TouchEvent::TouchPoint &point)
 Creates a touch event with a single touch point.
 
 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.
 
UniqueEventPtr transform (const Matrix3x3 &transformationMatrix) const
 Transforms the touch event using the given transformationMatrix.
 
- Public Member Functions inherited from kanzi::InputEvent
Type getType () const
 Returns the type of the event.
 
 InputEvent (Type type)
 Constructs an event with a given type.
 
bool isHandled () const
 Returns true if the event is handled, false if not.
 
void markHandled ()
 Marks the event as handled.
 
virtual ~InputEvent ()
 Destructor.
 

Static Public Member Functions

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

Protected Types

typedef vector< TouchPointTouchPointContainer
 The touch point container type.
 

Protected Attributes

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

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

◆ TouchPointContainer

The touch point container type.

Constructor & Destructor Documentation

◆ TouchEvent() [1/3]

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.

◆ TouchEvent() [2/3]

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.

◆ TouchEvent() [3/3]

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

◆ getTouchPointCount()

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

Returns the number of touch points that the event holds.

◆ getState()

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

Returns the overall state of the touch event.

◆ getTouchPointByIndex()

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.

◆ isMovementOnly()

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.

◆ transform()

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.

◆ isFromPointer()

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.

◆ isPointerId()

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

◆ m_points

TouchPointContainer kanzi::TouchEvent::m_points
protected

Container with the touch points.

◆ m_state

TouchState kanzi::TouchEvent::m_state
protected

The overall state of the touch event.


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