Guiliani  Version 2.6 revision 7293 (documentation build 12)
GUIGestureDetector.h
1/*
2* Copyright (C) TES Electronic Solutions GmbH,
3* All Rights Reserved.
4* Contact: info@guiliani.de
5*
6* This file is part of the Guiliani HMI framework
7* for the development of graphical user interfaces on embedded systems.
8*/
9
10#ifndef __GUIGESTUREDETECTOR_H__
11#define __GUIGESTUREDETECTOR_H__
12
13#include "eC_Types.h"
14#include "GUIEvent.h"
15#include "GUIPoint.h"
16
17#define MAX_ACTIVE_POINTERS 3
18
22{
23public:
34 const EventType_t& eType,
35 const eC_Int& iX,
36 const eC_Int& iY,
37 const eC_Value& vSpan,
38 const eC_Value& vSpanX,
39 const eC_Value& vSpanY,
40 const eC_UInt& uiModifiers = 0) :
41 CGUIEvent(eType, uiModifiers),
42 m_iX(iX),
43 m_iY(iY),
44 m_vSpan(vSpan),
45 m_vSpanX(vSpanX),
46 m_vSpanY(vSpanY)
47 {
48 }
49
53 eC_Int GetX() const
54 {
55 return m_iX;
56 }
57
61 eC_Int GetY() const
62 {
63 return m_iY;
64 }
65
69 eC_Value GetSpan() const
70 {
71 return m_vSpan;
72 }
73
77 eC_Value GetSpanX() const
78 {
79 return m_vSpanX;
80 }
81
85 eC_Value GetSpanY() const
86 {
87 return m_vSpanY;
88 }
89
90private:
91 eC_Int m_iX;
92 eC_Int m_iY;
93 eC_Value m_vSpan;
94 eC_Value m_vSpanX;
95 eC_Value m_vSpanY;
96};
97
100{
101public:
105 {
110 GET_MOVE
111 };
112
116 {
120 GT_ROTATE
121 };
122
126 {
130 m_bIsActive(false),
131 m_bIsPrimary(false),
132 m_uiPointerID(0),
133 m_iX(0),
134 m_iY(0)
135 {
136 }
137
146 const eC_Bool& bIsActive,
147 const eC_Bool& bIsPrimary,
148 const eC_UInt& uiPointerID,
149 const eC_Int& iX,
150 const eC_Int& iY) :
151 m_bIsActive(bIsActive),
152 m_bIsPrimary(bIsPrimary),
153 m_uiPointerID(uiPointerID),
154 m_iX(iX),
155 m_iY(iY)
156 {
157 }
158
159 eC_Bool m_bIsActive;
160 eC_Bool m_bIsPrimary;
162 eC_Int m_iX;
163 eC_Int m_iY;
164 };
165
166public:
172 static CGUIEvent* ProcessEvent(const GestureEventType_t& eType, const PointerState_t& kPointerState);
173
174#ifdef GUILIANI_GESTURES_ACTIVE
175private:
181 static eC_Bool UpdatePointer(
182 const GestureEventType_t& eType,
183 const PointerState_t& kPointerState,
184 eC_Int& iPointerIndex);
185
188 static void ClearPointers();
189 static void Reset();
190
191 static void UpdateScroll();
192 static void UpdateScale();
193 static void UpdateRotation();
194
195private:
196 static eC_UInt ms_uiActivePointers;
197 static PointerState_t ms_akPointers[MAX_ACTIVE_POINTERS];
198
199 static eC_Int ms_iSkipIndex;
200
201 static CGUIPoint ms_kFocusPoint;
202 static CGUIPoint ms_kLastFocus;
203
204 static eC_Value ms_vCurrentSpanX;
205 static eC_Value ms_vCurrentSpanY;
206 static eC_Value ms_vCurrentSpan;
207 static eC_Value ms_vPreviousSpan;
208
209 static eC_Value ms_vAverageDeviationX;
210 static eC_Value ms_vAverageDeviationY;
211 static eC_Value ms_vCurrentScrollX;
212 static eC_Value ms_vCurrentScrollY;
213
214 static eC_Value ms_vCurrentAngle;
215
216 static eC_Int ms_iDownX;
217 static eC_Int ms_iDownY;
218 static GestureType_t ms_eCurrentType;
219#endif
220};
221
222#endif
EventType_t
List of event type ids.
Definition: GUIEventTypeResource.h:65
Base class for Guiliani Events.
Definition: GUIEvent.h:26
Definition: GUIGestureDetector.h:100
static CGUIEvent * ProcessEvent(const GestureEventType_t &eType, const PointerState_t &kPointerState)
GestureType_t
Definition: GUIGestureDetector.h:116
@ GT_SCROLL
scrolling
Definition: GUIGestureDetector.h:119
@ GT_SCALE
scaling
Definition: GUIGestureDetector.h:118
@ GT_NONE
none detected
Definition: GUIGestureDetector.h:117
@ GT_ROTATE
rotation
Definition: GUIGestureDetector.h:120
GestureEventType_t
Definition: GUIGestureDetector.h:105
@ GET_MOVE
move of pointer
Definition: GUIGestureDetector.h:110
@ GET_PRIMARY_UP
primary pointer up
Definition: GUIGestureDetector.h:107
@ GET_PRIMARY_DOWN
primary pointer down
Definition: GUIGestureDetector.h:106
@ GET_ADDITIONAL_DOWN
additional pointer down
Definition: GUIGestureDetector.h:108
@ GET_ADDITIONAL_UP
additional pointer up
Definition: GUIGestureDetector.h:109
Definition: GUIGestureDetector.h:22
eC_Value GetSpan() const
Definition: GUIGestureDetector.h:69
eC_Value GetSpanX() const
Definition: GUIGestureDetector.h:77
eC_Int GetX() const
Definition: GUIGestureDetector.h:53
eC_Int GetY() const
Definition: GUIGestureDetector.h:61
CGUIGestureEvent(const EventType_t &eType, const eC_Int &iX, const eC_Int &iY, const eC_Value &vSpan, const eC_Value &vSpanX, const eC_Value &vSpanY, const eC_UInt &uiModifiers=0)
Definition: GUIGestureDetector.h:33
eC_Value GetSpanY() const
Definition: GUIGestureDetector.h:85
CGUIPoint class to hold two values (x, y) like a vector.
Definition: GUIPoint.h:18
Definition: GUIGestureDetector.h:126
PointerState_t()
Definition: GUIGestureDetector.h:129
eC_Bool m_bIsActive
active-flag
Definition: GUIGestureDetector.h:159
eC_Int m_iY
y-position
Definition: GUIGestureDetector.h:163
eC_UInt m_uiPointerID
pointer-id
Definition: GUIGestureDetector.h:161
PointerState_t(const eC_Bool &bIsActive, const eC_Bool &bIsPrimary, const eC_UInt &uiPointerID, const eC_Int &iX, const eC_Int &iY)
Definition: GUIGestureDetector.h:145
eC_Int m_iX
x-position
Definition: GUIGestureDetector.h:162
eC_Bool m_bIsPrimary
true if primary
Definition: GUIGestureDetector.h:160