blip  0.1
MotionEvent.hpp
Go to the documentation of this file.
1 #ifndef __blip_MotionEvent_hpp
2 #define __blip_MotionEvent_hpp
3 
4 #include <blip/Blip.hpp>
5 #include <blip/InputEvent.hpp>
6 
7 #include <commonc++/Flags.h++>
8 
9 namespace blip {
10 
11 class InputQueue;
12 
19 // TODO: The documentation on the event times is totally
20 // confusing. For the hisorical events, is it an absolute time? or a
21 // delta from the previous event?
22 class MotionEvent : public InputEvent
23 {
24  friend class InputEventQueue;
25 
26  public:
27 
29  enum Action {
61  };
62 
64  enum Axis {
65  Axis_X = 0,
66  Axis_Y = 1,
67  Axis_Z = 11,
69  Axis_Size = 3,
80  Axis_HatX = 15,
81  Axis_HatY = 16,
86  Axis_Wheel = 21,
87  Axis_Gas = 22,
88  Axis_Brake = 23,
90  Axis_Tilt = 25,
107  };
108 
110  enum ToolType {
116  };
117 
119  enum Button {
125  };
126 
128  virtual ~MotionEvent();
129 
131  Action getAction() const;
132 
136  int getActionPointerIndex() const;
137 
139  const ccxx::Flags<uint32_t> getFlags() const;
140 
145  uint32_t getMetaState() const;
146 
148  const ccxx::Flags<uint32_t> getButtonState() const;
149 
153  const ccxx::Flags<uint32_t> getEdgeFlags() const;
154 
158  time_ms_t getDownTime() const;
159 
160  // TODO: this is in nanotime, not a wall time
161  virtual time_ms_t getEventTime() const;
162 
168  float getXOffset() const;
169 
175  float getYOffset() const;
176 
181  float getXPrecision() const;
182 
187  float getYPrecision() const;
188 
190  int getPointerCount() const;
191 
199  int32_t getPointerID(int pointerIndex) const;
200 
206  ToolType getToolType(int pointerIndex) const;
207 
215  float getRawX(int pointerIndex) const;
216 
224  float getRawY(int pointerIndex) const;
225 
232  float getX(int pointerIndex) const;
233 
240  float getY(int pointerIndex) const;
241 
249  float getPressure(int pointerIndex) const;
250 
260  float getSize(int pointerIndex) const;
261 
274  float getOrientation(int pointerIndex) const;
275 
282  float getTouchMinor(int pointerIndex) const;
283 
290  float getTouchMajor(int pointerIndex) const;
291 
300  float getToolMinor(int pointerIndex) const;
301 
310  float getToolMajor(int pointerIndex) const;
311 
317  float getAxisValue(Axis axis, int pointerIndex) const;
318 
325  uint_t getHistorySize() const;
326 
330  time_ms_t getHistoricalEventTime(int historyIndex) const;
331 
338  float getHistoricalRawX(int historyIndex, int pointerIndex) const;
339 
346  float getHistoricalRawY(int historyIndex, int pointerIndex) const;
347 
354  float getHistoricalX(int historyIndex, int pointerIndex) const;
355 
362  float getHistoricalY(int historyIndex, int pointerIndex) const;
363 
373  float getHistoricalPressure(int historyIndex, int pointerIndex)
374  const;
375 
382  float getHistoricalSize(int historyIndex, int pointerIndex) const;
383 
391  float getHistoricalOrientation(int historyIndex, int pointerIndex)
392  const;
393 
401  float getHistoricalTouchMinor(int historyIndex, int pointerIndex)
402  const;
403 
411  float getHistoricalTouchMajor(int historyIndex, int pointerIndex)
412  const;
413 
421  float getHistoricalToolMinor(int historyIndex, int pointerIndex) const;
422 
430  float getHistoricalToolMajor(int historyIndex, int pointerIndex) const;
431 
439  float getHistoricalAxisValue(int historyIndex, Axis axis, int pointerIndex)
440  const;
441 
445  static const uint32_t FLAG_WINDOW_IS_OBSCURED;
446 
450  static const uint32_t EDGE_TOP_MASK;
451 
455  static const uint32_t EDGE_BOTTOM_MASK;
456 
460  static const uint32_t EDGE_LEFT_MASK;
461 
465  static const uint32_t EDGE_RIGHT_MASK;
466 
467  protected:
468 
470  MotionEvent(AInputEvent* event);
473  private:
474 
475  CCXX_COPY_DECLS(MotionEvent);
476 };
477 
478 } // namespace blip
479 
480 #endif // __blip_MotionEvent_hpp
Definition: MotionEvent.hpp:104
ToolType
Pointer tool types.
Definition: MotionEvent.hpp:110
uint32_t getMetaState() const
Get the state of any modifier keys at the time of this event.
Definition: MotionEvent.cpp:108
int getPointerCount() const
Get the number of distinct pointers being reported in this event.
Definition: MotionEvent.cpp:180
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 ...
Definition: MotionEvent.cpp:324
Definition: MotionEvent.hpp:105
Definition: MotionEvent.hpp:77
Definition: MotionEvent.hpp:89
Definition: MotionEvent.hpp:79
float getHistoricalRawY(int historyIndex, int pointerIndex) const
Get the historical raw Y-coordinate of this event for the given pointer index.
Definition: MotionEvent.cpp:411
float getPressure(int pointerIndex) const
Get the current pressure of this event for the given pointer index.
Definition: MotionEvent.cpp:277
Definition: MotionEvent.hpp:115
Definition: MotionEvent.hpp:91
float getHistoricalRawX(int historyIndex, int pointerIndex) const
Get the historical raw X-coordinate of this event for the given pointer index.
Definition: MotionEvent.cpp:393
Definition: MotionEvent.hpp:124
float getY(int pointerIndex) const
Get the current Y-coordinate of this event for the given pointer index.
Definition: MotionEvent.cpp:265
Definition: MotionEvent.hpp:94
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 ...
Definition: MotionEvent.cpp:558
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...
Definition: MotionEvent.cpp:501
An abstract base class for user input events.
Definition: InputEvent.hpp:17
A pressure gesture has started.
Definition: MotionEvent.hpp:33
A pressure gesture has completed.
Definition: MotionEvent.hpp:35
ToolType getToolType(int pointerIndex) const
Get the tool type of a pointer.
Definition: MotionEvent.cpp:201
Definition: MotionEvent.hpp:93
Definition: MotionEvent.hpp:111
Definition: MotionEvent.hpp:74
Definition: MotionEvent.hpp:71
const ccxx::Flags< uint32_t > getButtonState() const
TODO.
Definition: MotionEvent.cpp:116
float getHistoricalOrientation(int historyIndex, int pointerIndex) const
Get the historical orientation of the touch area and tool area in radians clockwise from vertical for...
Definition: MotionEvent.cpp:482
Definition: MotionEvent.hpp:96
float getHistoricalSize(int historyIndex, int pointerIndex) const
Get the historical scaled value of the approximate size for the given pointer index.
Definition: MotionEvent.cpp:469
Definition: MotionEvent.hpp:69
Definition: MotionEvent.hpp:67
Definition: MotionEvent.hpp:106
Definition: MotionEvent.hpp:88
Definition: MotionEvent.hpp:113
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 ...
Definition: MotionEvent.cpp:312
Definition: MotionEvent.hpp:123
static const uint32_t EDGE_LEFT_MASK
A bitmask for testing if the motion event intersected the left edge of the screen.
Definition: MotionEvent.hpp:460
float getYPrecision() const
Get the precision of the Y-coordinates being reported.
Definition: MotionEvent.cpp:172
Button
Button states TODO; should be mask.
Definition: MotionEvent.hpp:119
Definition: MotionEvent.hpp:102
Definition: MotionEvent.hpp:81
static const uint32_t EDGE_TOP_MASK
A bitmask for testing if the motion event intersected the top edge of the screen. ...
Definition: MotionEvent.hpp:450
Action
Motion actions.
Definition: MotionEvent.hpp:29
time_ms_t getHistoricalEventTime(int historyIndex) const
Get the amount of time that elapsed between this event and the previous event, in nanoseconds...
Definition: MotionEvent.cpp:381
A non-primary pointer has gone down.
Definition: MotionEvent.hpp:44
Definition: MotionEvent.hpp:68
Definition: MotionEvent.hpp:95
Definition: MotionEvent.hpp:90
A movement has occurred during a pressure gesture.
Definition: MotionEvent.hpp:37
Definition: MotionEvent.hpp:75
float getHistoricalAxisValue(int historyIndex, Axis axis, int pointerIndex) const
Get the historical value of the requested axis.
Definition: MotionEvent.cpp:573
static const uint32_t EDGE_RIGHT_MASK
A bitmask for testing if the motion event intersected the right edge of the screen.
Definition: MotionEvent.hpp:465
float getXOffset() const
Get the X-coordinate offset.
Definition: MotionEvent.cpp:148
A movement has occurred outside the bounds of the UI element or screen.
Definition: MotionEvent.hpp:42
float getHistoricalX(int historyIndex, int pointerIndex) const
Get the historical X-coordinate of this event for the given pointer index.
Definition: MotionEvent.cpp:429
float getAxisValue(Axis axis, int pointerIndex) const
Get the value of the requested axis.
Definition: MotionEvent.cpp:360
Definition: MotionEvent.hpp:100
Definition: MotionEvent.hpp:112
virtual ~MotionEvent()
Destructor.
Definition: MotionEvent.cpp:31
Definition: MotionEvent.hpp:82
float getToolMinor(int pointerIndex) const
Get the current length of the minor axis of an ellipse that describes the size of the approaching too...
Definition: MotionEvent.cpp:336
The pointer is not down but has entered the boundaries of a window or view.
Definition: MotionEvent.hpp:56
Definition: MotionEvent.hpp:72
Axis
Axis types.
Definition: MotionEvent.hpp:64
float getYOffset() const
Get the Y-coordinate offset.
Definition: MotionEvent.cpp:156
const ccxx::Flags< uint32_t > getFlags() const
Get the flags associated with this event.
Definition: MotionEvent.cpp:100
Definition: MotionEvent.hpp:101
WAV file format details at: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/.
Definition: AccelerometerSensorEvent.cpp:3
Definition: MotionEvent.hpp:66
time_ms_t getDownTime() const
Get the time at which the user first pressed down to begin a stream of position events.
Definition: MotionEvent.cpp:132
float getRawX(int pointerIndex) const
Get the raw X-coordinate of this event for the given pointer index.
Definition: MotionEvent.cpp:229
const ccxx::Flags< uint32_t > getEdgeFlags() const
Get a bitmask indicating which edges, if any, were touched during this event.
Definition: MotionEvent.cpp:124
Definition: MotionEvent.hpp:78
virtual time_ms_t getEventTime() const
Get the time at which this event occurred.
Definition: MotionEvent.cpp:140
float getXPrecision() const
Get the precision of the X-coordinates being reported.
Definition: MotionEvent.cpp:164
Definition: MotionEvent.hpp:122
Definition: MotionEvent.hpp:99
Definition: MotionEvent.hpp:103
The motion event contains relative horizontal and/or vertical scroll offsets.
Definition: MotionEvent.hpp:52
Definition: MotionEvent.hpp:86
Action getAction() const
Get the motion action for this event.
Definition: MotionEvent.cpp:38
Definition: MotionEvent.hpp:65
Definition: MotionEvent.hpp:121
A change happened but the pointer is not down.
Definition: MotionEvent.hpp:48
Definition: MotionEvent.hpp:85
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...
Definition: MotionEvent.cpp:520
A non-primary pointer has gone up.
Definition: MotionEvent.hpp:46
float getOrientation(int pointerIndex) const
Get the current orientation of the touch area and tool area in radians clockwise from vertical for th...
Definition: MotionEvent.cpp:300
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 ...
Definition: MotionEvent.cpp:539
uint_t getHistorySize() const
Get the number of historical points in this event.
Definition: MotionEvent.cpp:373
int getActionPointerIndex() const
If the motion action was Action_Up or Action_Down, returns the pointer index for that action...
Definition: MotionEvent.cpp:85
Unknown action type.
Definition: MotionEvent.hpp:31
Definition: MotionEvent.hpp:80
int32_t getPointerID(int pointerIndex) const
Get the pointer identifier associated with a particular pointer data index is this event...
Definition: MotionEvent.cpp:189
Definition: MotionEvent.hpp:84
Definition: MotionEvent.hpp:114
A motion input event.
Definition: MotionEvent.hpp:22
static const uint32_t EDGE_BOTTOM_MASK
A bitmask for testing if the motion event intersected the bottom edge of the screen.
Definition: MotionEvent.hpp:455
static const uint32_t FLAG_WINDOW_IS_OBSCURED
A flag indicating that the window that received the event is partially or completely obscured...
Definition: MotionEvent.hpp:445
float getHistoricalY(int historyIndex, int pointerIndex) const
Get the historical Y-coordinate of this event for the given pointer index.
Definition: MotionEvent.cpp:442
float getHistoricalPressure(int historyIndex, int pointerIndex) const
Get the current pressure of this event for the given pointer index.
Definition: MotionEvent.cpp:455
Definition: MotionEvent.hpp:70
float getSize(int pointerIndex) const
Get the current scaled value of the approximate size for the given pointer index. ...
Definition: MotionEvent.cpp:289
Definition: MotionEvent.hpp:87
Definition: InputEventQueue.hpp:17
A pressure gesture has bene cancelldd.
Definition: MotionEvent.hpp:39
Definition: MotionEvent.hpp:83
float getX(int pointerIndex) const
Get the current X-coordinate of this event for the given pointer index.
Definition: MotionEvent.cpp:254
Definition: MotionEvent.hpp:92
float getRawY(int pointerIndex) const
Get the raw Y-coordinate of this event for the given pointer index.
Definition: MotionEvent.cpp:241
Definition: MotionEvent.hpp:73
Definition: MotionEvent.hpp:98
float getToolMajor(int pointerIndex) const
Get the current length of the major axis of an ellipse that describes the size of the approaching too...
Definition: MotionEvent.cpp:348
Definition: MotionEvent.hpp:97
Definition: MotionEvent.hpp:120
Definition: MotionEvent.hpp:76
The pointer is not down but has exited the boundaries of a window or view.
Definition: MotionEvent.hpp:60