2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FUi_TouchManager.h
19 * @brief This is the header file for the _TouchManager class.
21 * This header file contains the declarations of the _TouchManager class. @n
24 #ifndef _FUI_INTERNAL_TOUCH_MANAGER_H_
25 #define _FUI_INTERNAL_TOUCH_MANAGER_H_
27 #include "FUi_ControlImpl.h"
28 #include "FUi_FingerInfo.h"
30 namespace Tizen { namespace Base { namespace Collection {
31 template<class T> class IListT;
32 template<class KeyType, class ValueType> class HashMapT;
35 namespace Tizen { namespace Ui
38 class _MultiFingerInfo
42 * This is the default class constructor.
45 _MultiFingerInfo(void);
48 * This is the default class destructor.
51 ~_MultiFingerInfo(void);
55 * This method returns point id.
58 * @return The point Id
60 unsigned long GetPointId(unsigned long deviceId) const;
63 * This method returns current cursor id.
66 * @return The cursor Id
68 unsigned long GetCurrentPointId(void) const;
71 * This method convert efl point id to cursor id.
74 * @return The cursor Id
76 unsigned long GeneratePointId(unsigned long deviceId);
79 * This method returns the touch position of specific pointId.
82 * @return The touch position
84 Tizen::Graphics::Point GetPosition(unsigned long id) const;
87 * This method returns the touch position of specific pointId.
90 * @return The touch position
92 Tizen::Graphics::Point GetScreenPoint(unsigned long id) const;
95 * This method returns the touch status of specific pointId.
98 * @return The touch status
100 _TouchStatus GetStatus(unsigned long id) const;
103 * This method returns the touch start position.
106 * @return The touch start position
108 Tizen::Graphics::Point GetStartPoint(unsigned long id) const;
111 * This method returns the touch count
114 * @return The touch count
116 int GetPointCount(void) const;
119 * This method returns the touch info list.
122 * @return The touch info list
124 Tizen::Base::Collection::IListT<_FingerInfo*>* GetMultiFingerListN(void) const;
127 * This method sets current finger info
131 result SetFingerInfo(unsigned long pointId, const Tizen::Graphics::Point& point, const Tizen::Graphics::Point& screenPoint, _TouchStatus status);
134 * This method resets finger info
138 void ResetFingerInfo(void);
142 * This method initializes finger information
147 void InitializeFingerInfo(void);
150 * This method remove finger informations
155 void RemoveFingerInfoList(void);
158 * This is the copy constructor for this class.
160 _MultiFingerInfo(const _MultiFingerInfo&);
163 * This is the assignment operator for this class.
165 _MultiFingerInfo& operator =(const _MultiFingerInfo&);
168 unsigned long __currentPointId;
169 unsigned long __generatedPointId;
171 Tizen::Base::Collection::HashMapT<int, _FingerInfo*>* __pFingerInfoMap;
172 }; //_MultiFingerInfo
175 class _TouchEventArg;
176 class _ITouchEventListener;
178 class _OSP_EXPORT_ _TouchManager
181 static void Initialize(void);
182 static _TouchManager* GetInstance(void);
186 * This method adds current position to multi touch list
191 result AddPoint(unsigned long pointId, const Tizen::Graphics::Point& point, _TouchStatus status);
194 * This method returns the touch point count.
197 * @return The touch point count
199 int GetPointCount(void) const;
202 * This method returns the touch position.
205 * @return The touch position
207 Tizen::Graphics::Point GetScreenPoint(unsigned long id) const;
210 * This method returns the touch position.
213 * @return The touch position
215 Tizen::Graphics::Point GetPosition(unsigned long id) const;
218 * This method returns the touch status of specific pointId.
221 * @return The touch status
223 TouchStatus GetTouchStatus(unsigned long id) const;
226 * This method converts device id to point id.
229 * @return The point Id
231 unsigned long GetPointId(unsigned long deviceId) const;
234 * This method generates pointId.
237 * @return The point Id
239 unsigned long GeneratePointId(unsigned long deviceId) const;
242 * This method returns the current pointId for multi touch
245 * @return The point Id
247 unsigned long GetCurrentPointId(void) const;
250 * This method returns touch start point
253 * @return The touch start point(means touch pressed point)
255 Tizen::Graphics::Point GetStartPoint(unsigned long pointId) const;
258 * This method makes touch event and send touch event through event manager
262 result SendEvent(_Control* pControl, const _TouchInfo& touchInfo);
265 * This method sets touch cancelled status
269 void SetTouchCanceled(bool canceled, bool onlyTouchEvent = false);;
272 * This method sets touch allowed status
276 void SetTouchAllowed(bool allowed);
279 * This method returns touch allowed status
282 * @return touch allowed status
284 bool IsTouchAllowed(void);
287 * This method returns touch move allowed status
288 * Whenever starting touch move, checking this value if it allows to move.
291 * @return touch move allowed status
293 bool IsInTouchMoveAllowanceBounds(const _Control& source, const _TouchInfo& touchInfo);
296 * This method sets the touch control source. - common control of focus, drag.
297 * It's the control touch press occurred.
301 void SetTouchControlSource(const _Control& source);
304 * This method returns the touch control source,
307 * @return The first touched control source
309 _Control* GetTouchControlSource(void) const;
312 * This method sets the touch focused control source. - common control of focus, drag.
313 * It's the control touch press occurred.
317 void SetFocusedControlSource(const _Control& source);
320 * This method returns the touch focused control source,
323 * @return The first touched control source
325 _Control* GetFocusedControlSource(void) const;
328 * This method sets touch captured control
329 * If you set the captured control, all touch events are sent to captured control.
333 void SetCapturedControl(const _Control* pControl, bool allowOutOfBounds);
336 * This method returns touch captured control
339 * @return The captured control
341 _Control* GetCapturedControl(void) const;
343 bool IsCaptureAllowedOutOfBounds(void) const;
346 * This method resets touch information, point count and cursorID etc.
350 void ResetTouchInfo(void);
353 * This method sets touch is canceled by gesture success.
357 void SetTouchCanceledOnGestureSuccess(bool cancel);
360 * This method returns whether touch is canceled on gesture success.
364 bool IsTouchCanceledOnGestureSuccess(void) const;
366 Tizen::Base::Collection::IListT<_FingerInfo*>* GetMultiFingerInfoListN(void) const;
368 bool IsSendingDelayedEvent(void) const;
370 static void ReleaseInstance(void);
374 * This is the default class constructor.
380 * This is the default class destructor.
383 ~_TouchManager(void);
386 * This is the copy constructor for this class.
388 _TouchManager(const _TouchManager&);
391 * This is the assignment operator for this class.
393 _TouchManager& operator =(const _TouchManager&);
395 static void InitializeInstance(void);
398 static _TouchManager* __pInstance;
399 _MultiFingerInfo* __pMultiFingerInfo;
400 _ControlHandle __touchControlHandle;
401 _ControlHandle __capturedControlHandle;
402 _ControlHandle __focusedControlHandle;
403 bool __touchCanceled;
405 _ITouchEventListener* __pTouchEventListener;
406 bool __captureAllowOutOfBounds; //will be deleted
407 bool __isSendingDelayedEvent;
408 bool __touchCanceledOnGestureSuccess;
413 #endif // _FUI_INTERNAL_TOUCH_MANAGER_H_