blip  0.1
MotionEvent Class Reference

A motion input event. More...

#include <MotionEvent.hpp>

Inheritance diagram for MotionEvent:

Public Types

enum  Action {
  Action_Unknown = -1, Action_Down = 0, Action_Up, Action_Move,
  Action_Cancel, Action_Outside, Action_PointerDown, Action_PointerUp,
  Action_HoverMove, Action_Scroll, Action_HoverEnter, Action_HoverExit
}
 Motion actions. More...
 
enum  Axis {
  Axis_X = 0, Axis_Y = 1, Axis_Z = 11, Axis_Pressure = 2,
  Axis_Size = 3, Axis_TouchMajor = 4, Axis_TouchMinor = 5, Axis_ToolMajor = 6,
  Axis_ToolMinor = 7, Axis_Orientation = 8, Axis_HorizontalScroll = 10, Axis_VerticalScroll = 9,
  Axis_RotationX = 12, Axis_RotationY = 13, Axis_RotationZ = 14, Axis_HatX = 15,
  Axis_HatY = 16, Axis_LeftTrigger = 17, Axis_RightTrigger = 18, Axis_Throttle = 19,
  Axis_Rudder = 20, Axis_Wheel = 21, Axis_Gas = 22, Axis_Brake = 23,
  Axis_Distance = 24, Axis_Tilt = 25, Axis_Generic1 = 32, Axis_Generic2 = 33,
  Axis_Generic3 = 34, Axis_Generic4 = 35, Axis_Generic5 = 36, Axis_Generic6 = 37,
  Axis_Generic7 = 38, Axis_Generic8 = 39, Axis_Generic9 = 40, Axis_Generic10 = 41,
  Axis_Generic11 = 42, Axis_Generic12 = 43, Axis_Generic13 = 44, Axis_Generic14 = 45,
  Axis_Generic15 = 46, Axis_Generic16 = 47
}
 Axis types. More...
 
enum  ToolType {
  ToolType_Unknown = -1, ToolType_Finger = 1, ToolType_Stylus = 2, ToolType_Mouse = 3,
  ToolType_Eraser = 4
}
 Pointer tool types. More...
 
enum  Button {
  Button_Primary = 1, Button_Secondary, Button_Tertiary, Button_Back,
  Button_Forward
}
 Button states TODO; should be mask. More...
 
enum  Source {
  Source_Unknown = -1, Source_Keyboard = 1, Source_DPad = 2, Source_GamePad = 3,
  Source_TouchScreen = 4, Source_Mouse = 5, Source_Stylus = 6, Source_Trackball = 7,
  Source_TouchPad = 8, Source_TouchNavigation = 9, Source_Joystick = 10, Source_Any = 0
}
 User input event sources. More...
 
enum  Class {
  Class_Unknown = - 1, Class_None = 0, Class_Button = 1, Class_Pointer = 2,
  Class_Navigation = 3, Class_Position = 4, Class_Joystick = 5
}
 Input event classes. More...
 
enum  Type { Type_Key, Type_Motion, Type_Sensor, Type_Timer }
 Event types. More...
 

Public Member Functions

virtual ~MotionEvent ()
 Destructor. More...
 
Action getAction () const
 Get the motion action for this event. More...
 
int getActionPointerIndex () const
 If the motion action was Action_Up or Action_Down, returns the pointer index for that action, otherwise returns -1. More...
 
const ccxx::Flags< uint32_t > getFlags () const
 Get the flags associated with this event. More...
 
uint32_t getMetaState () const
 Get the state of any modifier keys at the time of this event. More...
 
const ccxx::Flags< uint32_t > getButtonState () const
 TODO. More...
 
const ccxx::Flags< uint32_t > getEdgeFlags () const
 Get a bitmask indicating which edges, if any, were touched during this event. More...
 
time_ms_t getDownTime () const
 Get the time at which the user first pressed down to begin a stream of position events. More...
 
virtual time_ms_t getEventTime () const
 Get the time at which this event occurred. More...
 
float getXOffset () const
 Get the X-coordinate offset. More...
 
float getYOffset () const
 Get the Y-coordinate offset. More...
 
float getXPrecision () const
 Get the precision of the X-coordinates being reported. More...
 
float getYPrecision () const
 Get the precision of the Y-coordinates being reported. More...
 
int getPointerCount () const
 Get the number of distinct pointers being reported in this event. More...
 
int32_t getPointerID (int pointerIndex) const
 Get the pointer identifier associated with a particular pointer data index is this event. More...
 
ToolType getToolType (int pointerIndex) const
 Get the tool type of a pointer. More...
 
float getRawX (int pointerIndex) const
 Get the raw X-coordinate of this event for the given pointer index. More...
 
float getRawY (int pointerIndex) const
 Get the raw Y-coordinate of this event for the given pointer index. More...
 
float getX (int pointerIndex) const
 Get the current X-coordinate of this event for the given pointer index. More...
 
float getY (int pointerIndex) const
 Get the current Y-coordinate of this event for the given pointer index. More...
 
float getPressure (int pointerIndex) const
 Get the current pressure of this event for the given pointer index. More...
 
float getSize (int pointerIndex) const
 Get the current scaled value of the approximate size for the given pointer index. More...
 
float getOrientation (int pointerIndex) const
 Get the current orientation of the touch area and tool area in radians clockwise from vertical for the given pointer index. More...
 
float getTouchMinor (int pointerIndex) const
 Get the current length of the minor axis of an ellipse that describes the touch area at the point of contact for the given pointer index. More...
 
float getTouchMajor (int pointerIndex) const
 Get the current length of the major axis of an ellipse that describes the touch area at the point of contact for the given pointer index. More...
 
float getToolMinor (int pointerIndex) const
 Get the current length of the minor axis of an ellipse that describes the size of the approaching tool for the given pointer index. More...
 
float getToolMajor (int pointerIndex) const
 Get the current length of the major axis of an ellipse that describes the size of the approaching tool for the given pointer index. More...
 
float getAxisValue (Axis axis, int pointerIndex) const
 Get the value of the requested axis. More...
 
uint_t getHistorySize () const
 Get the number of historical points in this event. More...
 
time_ms_t getHistoricalEventTime (int historyIndex) const
 Get the amount of time that elapsed between this event and the previous event, in nanoseconds. More...
 
float getHistoricalRawX (int historyIndex, int pointerIndex) const
 Get the historical raw X-coordinate of this event for the given pointer index. More...
 
float getHistoricalRawY (int historyIndex, int pointerIndex) const
 Get the historical raw Y-coordinate of this event for the given pointer index. More...
 
float getHistoricalX (int historyIndex, int pointerIndex) const
 Get the historical X-coordinate of this event for the given pointer index. More...
 
float getHistoricalY (int historyIndex, int pointerIndex) const
 Get the historical Y-coordinate of this event for the given pointer index. More...
 
float getHistoricalPressure (int historyIndex, int pointerIndex) const
 Get the current pressure of this event for the given pointer index. More...
 
float getHistoricalSize (int historyIndex, int pointerIndex) const
 Get the historical scaled value of the approximate size for the given pointer index. More...
 
float getHistoricalOrientation (int historyIndex, int pointerIndex) const
 Get the historical orientation of the touch area and tool area in radians clockwise from vertical for the given pointer index. More...
 
float getHistoricalTouchMinor (int historyIndex, int pointerIndex) const
 Get the historical length of the minor axis of an ellipse that describes the touch area for the given pointer index. More...
 
float getHistoricalTouchMajor (int historyIndex, int pointerIndex) const
 Get the historical length of the major axis of an ellipse that describes the touch area for the given pointer index. More...
 
float getHistoricalToolMinor (int historyIndex, int pointerIndex) const
 Get the historical length of the minor axis of an ellipse that describes the size of the approaching tool for the given pointer index. More...
 
float getHistoricalToolMajor (int historyIndex, int pointerIndex) const
 Get the historical length of the major axis of an ellipse that describes the size of the approaching tool for the given pointer index. More...
 
float getHistoricalAxisValue (int historyIndex, Axis axis, int pointerIndex) const
 Get the historical value of the requested axis. More...
 
int32_t getDeviceID () const
 Get the ID of the input device which is the source of this event. More...
 
virtual Source getSource () const
 Get the source of this event. More...
 
Class getClass () const
 Get the class of this event. More...
 
Type getType () const
 Get the event type. More...
 

Static Public Attributes

static const uint32_t FLAG_WINDOW_IS_OBSCURED = AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED
 A flag indicating that the window that received the event is partially or completely obscured. More...
 
static const uint32_t EDGE_TOP_MASK = AMOTION_EVENT_EDGE_FLAG_TOP
 A bitmask for testing if the motion event intersected the top edge of the screen. More...
 
static const uint32_t EDGE_BOTTOM_MASK = AMOTION_EVENT_EDGE_FLAG_BOTTOM
 A bitmask for testing if the motion event intersected the bottom edge of the screen. More...
 
static const uint32_t EDGE_LEFT_MASK = AMOTION_EVENT_EDGE_FLAG_LEFT
 A bitmask for testing if the motion event intersected the left edge of the screen. More...
 
static const uint32_t EDGE_RIGHT_MASK = AMOTION_EVENT_EDGE_FLAG_RIGHT
 A bitmask for testing if the motion event intersected the right edge of the screen. More...
 

Detailed Description

A motion input event.

Motion events include multi-touch events and mouse or trackball events.

Author
Mark Lindner

Member Enumeration Documentation

◆ Action

enum Action

Motion actions.

Enumerator
Action_Unknown 

Unknown action type.

Action_Down 

A pressure gesture has started.

Action_Up 

A pressure gesture has completed.

Action_Move 

A movement has occurred during a pressure gesture.

Action_Cancel 

A pressure gesture has bene cancelldd.

Action_Outside 

A movement has occurred outside the bounds of the UI element or screen.

Action_PointerDown 

A non-primary pointer has gone down.

Action_PointerUp 

A non-primary pointer has gone up.

Action_HoverMove 

A change happened but the pointer is not down.

Action_Scroll 

The motion event contains relative horizontal and/or vertical scroll offsets.

Action_HoverEnter 

The pointer is not down but has entered the boundaries of a window or view.

Action_HoverExit 

The pointer is not down but has exited the boundaries of a window or view.

◆ Axis

enum Axis

Axis types.

Enumerator
Axis_X 
Axis_Y 
Axis_Z 
Axis_Pressure 
Axis_Size 
Axis_TouchMajor 
Axis_TouchMinor 
Axis_ToolMajor 
Axis_ToolMinor 
Axis_Orientation 
Axis_HorizontalScroll 
Axis_VerticalScroll 
Axis_RotationX 
Axis_RotationY 
Axis_RotationZ 
Axis_HatX 
Axis_HatY 
Axis_LeftTrigger 
Axis_RightTrigger 
Axis_Throttle 
Axis_Rudder 
Axis_Wheel 
Axis_Gas 
Axis_Brake 
Axis_Distance 
Axis_Tilt 
Axis_Generic1 
Axis_Generic2 
Axis_Generic3 
Axis_Generic4 
Axis_Generic5 
Axis_Generic6 
Axis_Generic7 
Axis_Generic8 
Axis_Generic9 
Axis_Generic10 
Axis_Generic11 
Axis_Generic12 
Axis_Generic13 
Axis_Generic14 
Axis_Generic15 
Axis_Generic16 

◆ Button

enum Button

Button states TODO; should be mask.

Enumerator
Button_Primary 
Button_Secondary 
Button_Tertiary 
Button_Back 
Button_Forward 

◆ Class

enum Class
inherited

Input event classes.

Enumerator
Class_Unknown 
Class_None 
Class_Button 
Class_Pointer 
Class_Navigation 
Class_Position 
Class_Joystick 

◆ Source

enum Source
inherited

User input event sources.

Enumerator
Source_Unknown 
Source_Keyboard 
Source_DPad 
Source_GamePad 
Source_TouchScreen 
Source_Mouse 
Source_Stylus 
Source_Trackball 
Source_TouchPad 
Source_TouchNavigation 
Source_Joystick 
Source_Any 

◆ ToolType

enum ToolType

Pointer tool types.

Enumerator
ToolType_Unknown 
ToolType_Finger 
ToolType_Stylus 
ToolType_Mouse 
ToolType_Eraser 

◆ Type

enum Type
inherited

Event types.

Enumerator
Type_Key 

Key input events.

Type_Motion 

Motion input events.

Type_Sensor 

Sensor events.

Type_Timer 

Timer events.

Constructor & Destructor Documentation

◆ ~MotionEvent()

~MotionEvent ( )
virtual

Destructor.

Member Function Documentation

◆ getAction()

MotionEvent::Action getAction ( ) const

Get the motion action for this event.

◆ getActionPointerIndex()

int getActionPointerIndex ( ) const

If the motion action was Action_Up or Action_Down, returns the pointer index for that action, otherwise returns -1.

◆ getAxisValue()

float getAxisValue ( Axis  axis,
int  pointerIndex 
) const

Get the value of the requested axis.

Parameters
axisThe axis.
pointerIndexThe pointer index.

◆ getButtonState()

const Flags< uint32_t > getButtonState ( ) const

TODO.

◆ getClass()

InputEvent::Class getClass ( ) const
inherited

Get the class of this event.

◆ getDeviceID()

int32_t getDeviceID ( ) const
inherited

Get the ID of the input device which is the source of this event.

◆ getDownTime()

time_ms_t getDownTime ( ) const

Get the time at which the user first pressed down to begin a stream of position events.

◆ getEdgeFlags()

const Flags< uint32_t > getEdgeFlags ( ) const

Get a bitmask indicating which edges, if any, were touched during this event.

This is only meaningful for ACTION_DOWN events.

◆ getEventTime()

time_ms_t getEventTime ( ) const
virtual

Get the time at which this event occurred.

Implements InputEvent.

◆ getFlags()

const Flags< uint32_t > getFlags ( ) const

Get the flags associated with this event.

◆ getHistoricalAxisValue()

float getHistoricalAxisValue ( int  historyIndex,
Axis  axis,
int  pointerIndex 
) const

Get the historical value of the requested axis.

See getAxisValue() for details.

Parameters
historyIndexThe index into the event history.
axisThe axis.
pointerIndexThe pointer index.

◆ getHistoricalEventTime()

time_ms_t getHistoricalEventTime ( int  historyIndex) const

Get the amount of time that elapsed between this event and the previous event, in nanoseconds.

Only applies to MotionEvent::Action_Move events.

◆ getHistoricalOrientation()

float getHistoricalOrientation ( int  historyIndex,
int  pointerIndex 
) const

Get the historical orientation of the touch area and tool area in radians clockwise from vertical for the given pointer index.

See getOrientation() for more details.

Parameters
historyIndexThe index into the event history.
pointerIndexThe pointer index.

◆ getHistoricalPressure()

float getHistoricalPressure ( int  historyIndex,
int  pointerIndex 
) const

Get the current pressure of this event for the given pointer index.

The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), however values higher than 1 may be generated depending on the calibration of the input device. See getPressure() for more details.

Parameters
historyIndexThe index into the event history.
pointerIndexThe pointer index.

◆ getHistoricalRawX()

float getHistoricalRawX ( int  historyIndex,
int  pointerIndex 
) const

Get the historical raw X-coordinate of this event for the given pointer index.

See getRawX() for more details.

Parameters
historyIndexThe index into the event history.
pointerIndexThe pinter index.

◆ getHistoricalRawY()

float getHistoricalRawY ( int  historyIndex,
int  pointerIndex 
) const

Get the historical raw Y-coordinate of this event for the given pointer index.

See getRawY() for more details.

Parameters
historyIndexThe index into the event history.
pointerIndexThe pinter index.

◆ getHistoricalSize()

float getHistoricalSize ( int  historyIndex,
int  pointerIndex 
) const

Get the historical scaled value of the approximate size for the given pointer index.

see getSize() for more details.

Parameters
historyIndexThe index into the event history.
pointerIndexThe pointer index.

◆ getHistoricalToolMajor()

float getHistoricalToolMajor ( int  historyIndex,
int  pointerIndex 
) const

Get the historical length of the major axis of an ellipse that describes the size of the approaching tool for the given pointer index.

See getToolMajor() for details.

Parameters
historyIndexThe index into the event history.
pointerIndexThe pointer index.

◆ getHistoricalToolMinor()

float getHistoricalToolMinor ( int  historyIndex,
int  pointerIndex 
) const

Get the historical length of the minor axis of an ellipse that describes the size of the approaching tool for the given pointer index.

See getToolMinor() for details.

Parameters
historyIndexThe index into the event history.
pointerIndexThe pointer index.

◆ getHistoricalTouchMajor()

float getHistoricalTouchMajor ( int  historyIndex,
int  pointerIndex 
) const

Get the historical length of the major axis of an ellipse that describes the touch area for the given pointer index.

See getTouchMajor() for details.

Parameters
historyIndexThe index into the event history.
pointerIndexThe pointer index.

◆ getHistoricalTouchMinor()

float getHistoricalTouchMinor ( int  historyIndex,
int  pointerIndex 
) const

Get the historical length of the minor axis of an ellipse that describes the touch area for the given pointer index.

See getTouchMinor() for details.

Parameters
historyIndexThe index into the event history.
pointerIndexThe pointer index.

◆ getHistoricalX()

float getHistoricalX ( int  historyIndex,
int  pointerIndex 
) const

Get the historical X-coordinate of this event for the given pointer index.

See getX() for more details.

Parameters
historyIndexThe index into the event history.
pointerIndexThe pointer index.

◆ getHistoricalY()

float getHistoricalY ( int  historyIndex,
int  pointerIndex 
) const

Get the historical Y-coordinate of this event for the given pointer index.

See getY() for more details.

Parameters
historyIndexThe index into the event history.
pointerIndexThe pointer index.

◆ getHistorySize()

uint_t getHistorySize ( ) const

Get the number of historical points in this event.

These are movements that have occurred between this event and the previous event. This only applies to MotionEvent::Action_Move events – all other actions will have a size of 0. Historical samples are indexed from oldest to newest.

◆ getMetaState()

uint32_t getMetaState ( ) const

Get the state of any modifier keys at the time of this event.

See KeyEvent for a collection of bitmasks that may be used to test for individual modifier keys.

◆ getOrientation()

float getOrientation ( int  pointerIndex) const

Get the current orientation of the touch area and tool area in radians clockwise from vertical for the given pointer index.

An angle of 0 degrees indicates that the major axis of contact is oriented upwards, is perfectly circular or is of unknown orientation. A positive angle indicates that the major axis of contact is oriented to the right. A negative angle indicates that the major axis of contact is oriented to the left. The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians (finger pointing fully right).

Parameters
pointerIndexThe pointer index.

◆ getPointerCount()

int getPointerCount ( ) const

Get the number of distinct pointers being reported in this event.

◆ getPointerID()

int32_t getPointerID ( int  pointerIndex) const

Get the pointer identifier associated with a particular pointer data index is this event.

The identifier indicates the actual pointer number associated with the data, accounting for individual pointers going up and down since the start of the current gesture.

Parameters
pointerIndexThe pointer index.

◆ getPressure()

float getPressure ( int  pointerIndex) const

Get the current pressure of this event for the given pointer index.

The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), however values higher than 1 may be generated depending on the calibration of the input device.

Parameters
pointerIndexThe pointer index.

◆ getRawX()

float getRawX ( int  pointerIndex) const

Get the raw X-coordinate of this event for the given pointer index.

For touch events on the screen, this is the original location of the event on the screen, before it had been adjusted for the containing window and views.

Parameters
pointerIndexThe pointer index.

◆ getRawY()

float getRawY ( int  pointerIndex) const

Get the raw Y-coordinate of this event for the given pointer index.

For touch events on the screen, this is the original location of the event on the screen, before it had been adjusted for the containing window and views.

Parameters
pointerIndexThe pointer index.

◆ getSize()

float getSize ( int  pointerIndex) const

Get the current scaled value of the approximate size for the given pointer index.

This represents some approximation of the area of the screen being pressed; the actual value in pixels corresponding to the touch is normalized with the device specific range of values and scaled to a value between 0 and 1. The value of size can be used to determine fat touch events.

Parameters
pointerIndexThe pointer index.

◆ getSource()

InputEvent::Source getSource ( ) const
virtualinherited

Get the source of this event.

◆ getToolMajor()

float getToolMajor ( int  pointerIndex) const

Get the current length of the major axis of an ellipse that describes the size of the approaching tool for the given pointer index.

The tool area represents the estimated size of the finger or pen that is touching the device independent of its actual touch area at the point of contact.

Parameters
pointerIndexThe pointer index.

◆ getToolMinor()

float getToolMinor ( int  pointerIndex) const

Get the current length of the minor axis of an ellipse that describes the size of the approaching tool for the given pointer index.

The tool area represents the estimated size of the finger or pen that is touching the device independent of its actual touch area at the point of contact.

Parameters
pointerIndexThe pointer index.

◆ getToolType()

MotionEvent::ToolType getToolType ( int  pointerIndex) const

Get the tool type of a pointer.

The tool type indicates the type of tool used to make contact, such as a finger or stylus, if known.

Parameters
pointerIndexThe pointer index.

◆ getTouchMajor()

float getTouchMajor ( int  pointerIndex) const

Get the current length of the major axis of an ellipse that describes the touch area at the point of contact for the given pointer index.

Parameters
pointerIndexThe pointer index.

◆ getTouchMinor()

float getTouchMinor ( int  pointerIndex) const

Get the current length of the minor axis of an ellipse that describes the touch area at the point of contact for the given pointer index.

Parameters
pointerIndexThe pointer index.

◆ getType()

Type getType ( ) const
inlineinherited

Get the event type.

◆ getX()

float getX ( int  pointerIndex) const

Get the current X-coordinate of this event for the given pointer index.

Whole numbers are pixels; the value may have a fraction for input devices that are sub-pixel precise.

Parameters
pointerIndexThe pointer index.

◆ getXOffset()

float getXOffset ( ) const

Get the X-coordinate offset.

For touch events on the screen, this is the delta that was added to the raw screen coordinates to adjust for the absolute position of the containing windows and views.

◆ getXPrecision()

float getXPrecision ( ) const

Get the precision of the X-coordinates being reported.

This value may be multiplied with an X-coordinate sample to find the actual hardware value of the X-coordinate.

◆ getY()

float getY ( int  pointerIndex) const

Get the current Y-coordinate of this event for the given pointer index.

Whole numbers are pixels; the value may have a fraction for input devices that are sub-pixel precise.

Parameters
pointerIndexThe pointer index.

◆ getYOffset()

float getYOffset ( ) const

Get the Y-coordinate offset.

For touch events on the screen, this is the delta that was added to the raw screen coordinates to adjust for the absolute position of the containing windows and views.

◆ getYPrecision()

float getYPrecision ( ) const

Get the precision of the Y-coordinates being reported.

This value may be multiplied with a Y-coordinate sample to find the actual hardware value of the Y-coordinate.

Member Data Documentation

◆ EDGE_BOTTOM_MASK

const uint32_t EDGE_BOTTOM_MASK = AMOTION_EVENT_EDGE_FLAG_BOTTOM
static

A bitmask for testing if the motion event intersected the bottom edge of the screen.

◆ EDGE_LEFT_MASK

const uint32_t EDGE_LEFT_MASK = AMOTION_EVENT_EDGE_FLAG_LEFT
static

A bitmask for testing if the motion event intersected the left edge of the screen.

◆ EDGE_RIGHT_MASK

const uint32_t EDGE_RIGHT_MASK = AMOTION_EVENT_EDGE_FLAG_RIGHT
static

A bitmask for testing if the motion event intersected the right edge of the screen.

◆ EDGE_TOP_MASK

const uint32_t EDGE_TOP_MASK = AMOTION_EVENT_EDGE_FLAG_TOP
static

A bitmask for testing if the motion event intersected the top edge of the screen.

◆ FLAG_WINDOW_IS_OBSCURED

const uint32_t FLAG_WINDOW_IS_OBSCURED = AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED
static

A flag indicating that the window that received the event is partially or completely obscured.


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