Fission FSN
Loading...
Searching...
No Matches
fsIGestureHandlingComponent.h
Go to the documentation of this file.
1/********************************************************************
2*
3* Created: 8/4/2014 11:15
4*
5* File: fsIGestureHandlingComponent.h
6*
7* Author: Mick Waites
8*
9* Purpose: Base class for components which accept translated
10* input.
11*
12*********************************************************************/
13
14#ifndef fsIGestureHandlingComponenthdr
15#define fsIGestureHandlingComponenthdr
16
17#include <vector>
18
21
22struct fsPoint;
23class fsCEntity;
24
25
27{
28public:
29
30 fsBool hitTest(const fsPoint& pPos) const;
31
32protected:
33
35 {
37 {
38 }
39
42 fsBool mCounted; // contributes to mNumPointsDown
43 };
44
45 enum
46 {
53
55 };
56
57 void gestureTypesSet(fsBool pHandleTaps, fsBool pHandleDragEvent, fsBool pHandlePinchEvents);
58
59 fsBool messageProcessDo(const fsCUniqueId& pMessageType,
60 const fsIMessageDispatcher::sMessageParameters& pParam) override;
61 void listenersRegisterDo() override;
62 void listenersDeregisterDo() override;
63 void gestureReset();
64
65 fsIGestureHandlingComponent(fsCEntity* pParent, fsBool pHandleTaps, fsBool pHandleDragEvent,
66 fsBool pHandlePinchEvents);
68
69 std::vector<sGesturePoint> mGesturePoints;
70
73
75
76private:
77
78 virtual fsBool hitTestDo(const fsPoint& pPos) const;
79 virtual fsBool acceptingInputGet() const = 0;
80 virtual fsBool highlightSetDo() { return false; }
81
82 virtual void onGestureCancel() {}
83
84 virtual void onTap(const fsPoint& pStartPos) {}
85 virtual void onDragStart(const fsPoint& pStartPos) {}
86 virtual void onDragMove(const fsPoint& pCurrPos) {}
87 virtual void onDragEnd(const fsPoint& pEndPos) {}
88
89 virtual void onPinchStart(const fsPoint& pStartPosPointA, const fsPoint& pStartPosPointB) {}
90 virtual void onPinchMove(const fsPoint& pCurrPos, const fsPoint& pDelta, fsS32 pPointID) {}
91 virtual void onPinchEnd(const fsPoint& pCurrPos, const fsPoint& pDelta, fsS32 pPointID) {}
92
93 fsBool dragMessageStolen(const fsCUniqueId& pMessageType, const fsIMessageDispatcher::sMessageParameters& pParam);
94
95 fsBool priorityAcquire();
96 fsBool pointCount(fsS32 pPtrIndex);
97 fsBool pointerDownProcess(const fsIInputManager::sPointerMsgParam& pParam);
98 fsBool pointerMoveProcess(const fsPoint& pPos, fsS32 pPtrIndex, fsBool pPtrDown);
99 fsBool pointerUpProcess(const fsPoint& pPos, fsS32 pPtrIndex);
100
101 fsBool gestureStartProcess(const fsIInputManager::sPointerMsgParam& pParam);
102 fsBool mouseMoveProcess(const fsPoint& pPos);
103
104 void tapEndProcess(const fsPoint& pPos);
105 void tapStartProcess(const fsPoint& pPos, fsS32 pPtrIndex);
106 void dragStartProcess(const fsPoint& pPos, fsS32 pPtrIndex);
107 void dragEndProcess(const fsPoint& pPos, fsS32 pPtrIndex);
108 void pinchEndProcess(const fsPoint& pPos, fsS32 pPtrIndex);
109 void pinchStartProcess(const fsPoint& pPos, fsS32 pPtrIndex);
110
111 fsBool highlightSet(fsBool pHighlight);
112
113 static const fsS32 mDragDistanceThreshold = 16;
114
115 const fsBool mMousePointerType;
116
117 fsBool mHandleTaps;
118 fsBool mHandleDragEvents;
119 fsBool mHandlePinchEvents;
120};
121
122#endif
Definition fsCEntity.h:39
Definition fsCUniqueId.h:21
void gestureReset()
Definition fsIGestureHandlingComponent.cpp:13
fsBool messageProcessDo(const fsCUniqueId &pMessageType, const fsIMessageDispatcher::sMessageParameters &pParam) override
Definition fsIGestureHandlingComponent.cpp:108
@ eSTATE_IN_PINCH_GESTURE
Definition fsIGestureHandlingComponent.h:52
@ eSTATE_IN_TAP_GESTURE
Definition fsIGestureHandlingComponent.h:50
@ eSTATE_NOT_IN_GESTURE
Definition fsIGestureHandlingComponent.h:47
@ eSTATE_MOUSE_OVER
Definition fsIGestureHandlingComponent.h:48
@ eSTATE_IN_DRAG_GESTURE
Definition fsIGestureHandlingComponent.h:51
@ eSTATE_EVALUATING_GESTURE_TYPE
Definition fsIGestureHandlingComponent.h:49
@ eSTATE_WAITING_FOR_ALL_POINTS_TO_RELEASE
Definition fsIGestureHandlingComponent.h:54
fsBool mHighlighted
Definition fsIGestureHandlingComponent.h:74
void listenersDeregisterDo() override
Definition fsIGestureHandlingComponent.cpp:72
fsIGestureHandlingComponent(fsCEntity *pParent, fsBool pHandleTaps, fsBool pHandleDragEvent, fsBool pHandlePinchEvents)
Definition fsIGestureHandlingComponent.cpp:521
~fsIGestureHandlingComponent() override
Definition fsIGestureHandlingComponent.cpp:535
fsBool hitTest(const fsPoint &pPos) const
Definition fsIGestureHandlingComponent.cpp:516
std::vector< sGesturePoint > mGesturePoints
Definition fsIGestureHandlingComponent.h:69
fsS32 mGestureState
Definition fsIGestureHandlingComponent.h:71
fsS32 mNumPointsDown
Definition fsIGestureHandlingComponent.h:72
void gestureTypesSet(fsBool pHandleTaps, fsBool pHandleDragEvent, fsBool pHandlePinchEvents)
Definition fsIGestureHandlingComponent.cpp:63
void listenersRegisterDo() override
Definition fsIGestureHandlingComponent.cpp:81
fsIMessageListenerComponent(fsCEntity *pParent)
Definition fsIMessageListenerComponent.cpp:9
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
fsPoint mPrevPos
Definition fsIGestureHandlingComponent.h:40
fsBool mInGesture
Definition fsIGestureHandlingComponent.h:41
fsBool mCounted
Definition fsIGestureHandlingComponent.h:42
sGesturePoint()
Definition fsIGestureHandlingComponent.h:36
Definition fsIMessageDispatcher.h:32
Definition fsPoint.h:17