4 * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
8 * Jaewon Lim <jaewon81.lim@samsung.com>
9 * Woojin Jung <woojin2.jung@samsung.com>
10 * Juyoung Kim <j0.kim@samsung.com>
11 * Anastasia Lyupa <a.lyupa@samsung.com>
13 * This library is free software; you can redistribute it and/or modify it under
14 * the terms of the GNU Lesser General Public License as published by the
15 * Free Software Foundation; either version 2.1 of the License, or (at your option)
18 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
19 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
21 * License for more details.
23 * You should have received a copy of the GNU Lesser General Public License
24 * along with this library; if not, write to the Free Software Foundation, Inc., 51
25 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 * - Samsung RnD Institute Russia
35 #include "probeinfo.h"
36 #include "tizen_probe.h"
37 #include "dacollection.h"
42 #define PACK_GESTURE_EVENT(API_ID, _GESTURETYPE, _X, _Y, _INFO1, _INFO2, _ARGDETECTOR) \
45 setProbePoint(&probeInfo); \
46 PREPARE_LOCAL_BUF(); \
47 PACK_COMMON_BEGIN(MSG_PROBE_UIEVENT, API_ID, "p", _ARGDETECTOR); \
48 PACK_COMMON_END(0, 0, 0); \
49 sprintf(info1_str, "%d", _INFO1); \
50 PACK_UIEVENT(_EVENT_GESTURE, _GESTURETYPE, _X, _Y, info1_str, _INFO2); \
54 GestureEventListener GestureEventListener::rInstance;
56 GestureEventListener::GestureEventListener()
61 GestureEventListener::~GestureEventListener()
66 void GestureEventListener::OnCustomGestureCanceled (TouchGestureDetector &gestureDetector)
68 probeInfo_t probeInfo;
70 if(isOptionEnabled(OPT_EVENT))
73 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnCustomGestureCanceled__TouchGestureDetector__gestureDetector_,
74 _GESTURE_CUSTOM, 0, 0, 0, 0, &gestureDetector);
79 void GestureEventListener::OnCustomGestureChanged (TouchGestureDetector &gestureDetector)
81 probeInfo_t probeInfo;
83 if(isOptionEnabled(OPT_EVENT))
86 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnCustomGestureChanged__TouchGestureDetector__gestureDetector_,
87 _GESTURE_CUSTOM, 0, 0, 0, 0, &gestureDetector);
92 void GestureEventListener::OnCustomGestureFinished (TouchGestureDetector &gestureDetector)
94 probeInfo_t probeInfo;
96 if(isOptionEnabled(OPT_EVENT))
99 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnCustomGestureFinished__TouchGestureDetector__gestureDetector_,
100 _GESTURE_CUSTOM, 0, 0, 0, 0, &gestureDetector);
105 void GestureEventListener::OnCustomGestureStarted (TouchGestureDetector &gestureDetector)
107 probeInfo_t probeInfo;
109 if(isOptionEnabled(OPT_EVENT))
112 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnCustomGestureStarted__TouchGestureDetector__gestureDetector_,
113 _GESTURE_CUSTOM, 0, 0, 0, 0, &gestureDetector);
118 void GestureEventListener::OnFlickGestureCanceled (TouchFlickGestureDetector &gestureDetector)
120 probeInfo_t probeInfo;
122 if(isOptionEnabled(OPT_EVENT))
126 int x = 0, y = 0, dur = 0;
127 FlickDirection direction = FLICK_DIRECTION_NONE;
129 gestureDetector.GetDistance(x, y);
130 dur = gestureDetector.GetDuration();
131 direction = gestureDetector.GetDirection();
132 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnFlickGestureCanceled__TouchFlickGestureDetector__gestureDetector_,
133 _GESTURE_FLICK, x, y, dur, (int)direction, &gestureDetector);
139 void GestureEventListener::OnFlickGestureDetected (TouchFlickGestureDetector &gestureDetector)
141 probeInfo_t probeInfo;
143 if(isOptionEnabled(OPT_EVENT))
147 int x = 0, y = 0, dur = 0;
148 FlickDirection direction = FLICK_DIRECTION_NONE;
150 gestureDetector.GetDistance(x, y);
151 dur = gestureDetector.GetDuration();
152 direction = gestureDetector.GetDirection();
153 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnFlickGestureDetected__TouchFlickGestureDetector__gestureDetector_,
154 _GESTURE_FLICK, x, y, dur, (int)direction, &gestureDetector);
160 void GestureEventListener::OnLongPressGestureCanceled (TouchLongPressGestureDetector &gestureDetector)
162 probeInfo_t probeInfo;
164 if(isOptionEnabled(OPT_EVENT))
168 int moveallow = 0, tcount = 0, dur = 0;
170 moveallow = gestureDetector.GetMoveAllowance();
171 dur = gestureDetector.GetDuration();
172 tcount = gestureDetector.GetTouchCount();
173 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnLongPressGestureCanceled__TouchLongPressGestureDetector__gestureDetector_,
174 _GESTURE_LONGPRESS, moveallow, 0, dur, tcount, &gestureDetector);
180 void GestureEventListener::OnLongPressGestureDetected (TouchLongPressGestureDetector &gestureDetector)
182 probeInfo_t probeInfo;
184 if(isOptionEnabled(OPT_EVENT))
188 int moveallow = 0, tcount = 0, dur = 0;
190 moveallow = gestureDetector.GetMoveAllowance();
191 dur = gestureDetector.GetDuration();
192 tcount = gestureDetector.GetTouchCount();
193 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnLongPressGestureDetected__TouchLongPressGestureDetector__gestureDetector_,
194 _GESTURE_LONGPRESS, moveallow, 0, dur, tcount, &gestureDetector);
200 void GestureEventListener::OnPanningGestureCanceled (TouchPanningGestureDetector &gestureDetector)
202 probeInfo_t probeInfo;
204 if(isOptionEnabled(OPT_EVENT))
210 tcount = gestureDetector.GetTouchCount();
211 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnPanningGestureCanceled__TouchPanningGestureDetector__gestureDetector_,
212 _GESTURE_PANNING, 0, 0, 0, tcount, &gestureDetector);
218 void GestureEventListener::OnPanningGestureChanged (TouchPanningGestureDetector &gestureDetector)
220 probeInfo_t probeInfo;
222 if(isOptionEnabled(OPT_EVENT))
228 tcount = gestureDetector.GetTouchCount();
229 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnPanningGestureChanged__TouchPanningGestureDetector__gestureDetector_,
230 _GESTURE_PANNING, 0, 0, 0, tcount, &gestureDetector);
236 void GestureEventListener::OnPanningGestureFinished (TouchPanningGestureDetector &gestureDetector)
238 probeInfo_t probeInfo;
240 if(isOptionEnabled(OPT_EVENT))
246 tcount = gestureDetector.GetTouchCount();
247 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnPanningGestureFinished__TouchPanningGestureDetector__gestureDetector_,
248 _GESTURE_PANNING, 0, 0, 0, tcount, &gestureDetector);
254 void GestureEventListener::OnPanningGestureStarted (TouchPanningGestureDetector &gestureDetector)
256 probeInfo_t probeInfo;
258 if(isOptionEnabled(OPT_EVENT))
264 tcount = gestureDetector.GetTouchCount();
265 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnPanningGestureStarted__TouchPanningGestureDetector__gestureDetector_,
266 _GESTURE_PANNING, 0, 0, 0, tcount, &gestureDetector);
272 void GestureEventListener::OnPinchGestureCanceled (TouchPinchGestureDetector &gestureDetector)
274 probeInfo_t probeInfo;
276 if(isOptionEnabled(OPT_EVENT))
280 Tizen::Graphics::Point point;
283 point = gestureDetector.GetCenterPoint();
284 scale = gestureDetector.GetScale();
285 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnPinchGestureCanceled__TouchPinchGestureDetector__gestureDetector_,
286 _GESTURE_PINCH, point.x, point.y, scale, 0, &gestureDetector);
292 void GestureEventListener::OnPinchGestureChanged (TouchPinchGestureDetector &gestureDetector)
294 probeInfo_t probeInfo;
296 if(isOptionEnabled(OPT_EVENT))
300 Tizen::Graphics::Point point;
303 point = gestureDetector.GetCenterPoint();
304 scale = gestureDetector.GetScale();
305 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnPinchGestureChanged__TouchPinchGestureDetector__gestureDetector_,
306 _GESTURE_PINCH, point.x, point.y, scale, 0, &gestureDetector);
312 void GestureEventListener::OnPinchGestureFinished (TouchPinchGestureDetector &gestureDetector)
314 probeInfo_t probeInfo;
316 if(isOptionEnabled(OPT_EVENT))
320 Tizen::Graphics::Point point;
323 point = gestureDetector.GetCenterPoint();
324 scale = gestureDetector.GetScale();
325 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnPinchGestureFinished__TouchPinchGestureDetector__gestureDetector_,
326 _GESTURE_PINCH, point.x, point.y, scale, 0, &gestureDetector);
332 void GestureEventListener::OnPinchGestureStarted (TouchPinchGestureDetector &gestureDetector)
334 probeInfo_t probeInfo;
336 if(isOptionEnabled(OPT_EVENT))
340 Tizen::Graphics::Point point;
343 point = gestureDetector.GetCenterPoint();
344 scale = gestureDetector.GetScale();
345 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnPinchGestureStarted__TouchPinchGestureDetector__gestureDetector_,
346 _GESTURE_PINCH, point.x, point.y, scale, 0, &gestureDetector);
352 void GestureEventListener::OnRotationGestureCanceled (TouchRotationGestureDetector &gestureDetector)
354 probeInfo_t probeInfo;
356 if(isOptionEnabled(OPT_EVENT))
363 distance = gestureDetector.GetDistance();
364 angle = gestureDetector.GetAngle();
365 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnRotationGestureCanceled__TouchRotationGestureDetector__gestureDetector_,
366 _GESTURE_ROTATION, 0, 0, distance, static_cast<int>(angle), &gestureDetector);
372 void GestureEventListener::OnRotationGestureChanged (TouchRotationGestureDetector &gestureDetector)
374 probeInfo_t probeInfo;
376 if(isOptionEnabled(OPT_EVENT))
383 distance = gestureDetector.GetDistance();
384 angle = gestureDetector.GetAngle();
385 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnRotationGestureChanged__TouchRotationGestureDetector__gestureDetector_,
386 _GESTURE_ROTATION, 0, 0, distance, static_cast<int>(angle), &gestureDetector);
392 void GestureEventListener::OnRotationGestureFinished (TouchRotationGestureDetector &gestureDetector)
394 probeInfo_t probeInfo;
396 if(isOptionEnabled(OPT_EVENT))
403 distance = gestureDetector.GetDistance();
404 angle = gestureDetector.GetAngle();
405 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnRotationGestureFinished__TouchRotationGestureDetector__gestureDetector_,
406 _GESTURE_ROTATION, 0, 0, distance, static_cast<int>(angle), &gestureDetector);
412 void GestureEventListener::OnRotationGestureStarted (TouchRotationGestureDetector &gestureDetector)
414 probeInfo_t probeInfo;
416 if(isOptionEnabled(OPT_EVENT))
423 distance = gestureDetector.GetDistance();
424 angle = gestureDetector.GetAngle();
425 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnRotationGestureStarted__TouchRotationGestureDetector__gestureDetector_,
426 _GESTURE_ROTATION, 0, 0, distance, static_cast<int>(angle), &gestureDetector);
432 void GestureEventListener::OnTapGestureCanceled (TouchTapGestureDetector &gestureDetector)
434 probeInfo_t probeInfo;
436 if(isOptionEnabled(OPT_EVENT))
440 int move = 0, tapcount = 0, touchcount = 0, interval = 0;
442 move = gestureDetector.GetMoveAllowance();
443 tapcount = gestureDetector.GetTapCount();
444 interval = gestureDetector.GetTapInterval();
445 touchcount = gestureDetector.GetTouchCount();
446 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnTapGestureCanceled__TouchTapGestureDetector__gestureDetector_,
447 _GESTURE_TAP, move, tapcount, interval, touchcount, &gestureDetector);
453 void GestureEventListener::OnTapGestureDetected (TouchTapGestureDetector &gestureDetector)
455 probeInfo_t probeInfo;
457 if(isOptionEnabled(OPT_EVENT))
461 int move = 0, tapcount = 0, touchcount = 0, interval = 0;
463 move = gestureDetector.GetMoveAllowance();
464 tapcount = gestureDetector.GetTapCount();
465 interval = gestureDetector.GetTapInterval();
466 touchcount = gestureDetector.GetTouchCount();
467 PACK_GESTURE_EVENT(API_ID_void_GestureEventListener__OnTapGestureDetected__TouchTapGestureDetector__gestureDetector_,
468 _GESTURE_TAP, move, tapcount, interval, touchcount, &gestureDetector);
474 GestureEventListener& GestureEventListener::GetInstance()
480 namespace Tizen { namespace Ui {
482 result TouchFlickGestureDetector::AddFlickGestureEventListener(ITouchFlickGestureEventListener& listener)
484 typedef result (TouchFlickGestureDetector::*methodType)(ITouchFlickGestureEventListener& listener);
485 static methodType addflickgestureeventlistenerp;
488 GET_REAL_FUNC_TIZEN(_ZN5Tizen2Ui25TouchFlickGestureDetector28AddFlickGestureEventListenerERNS0_31ITouchFlickGestureEventListenerE,
489 LIBOSP_UIFW, addflickgestureeventlistenerp);
492 GestureEventListener& mylistener = GestureEventListener::GetInstance();
493 if(add_detector_hash(static_cast<void*>(this), static_cast<void*>(&mylistener)) <= 0)
495 iret = (this->*addflickgestureeventlistenerp)(static_cast<ITouchFlickGestureEventListener&>(mylistener));
496 if(likely(iret == E_SUCCESS))
502 del_detector_hash(static_cast<void*>(this));
507 return (this->*addflickgestureeventlistenerp)(listener);
510 result TouchLongPressGestureDetector::AddLongPressGestureEventListener(ITouchLongPressGestureEventListener& listener)
512 typedef result (TouchLongPressGestureDetector::*methodType)(ITouchLongPressGestureEventListener& listener);
513 static methodType addlongpressgestureeventlistenerp;
516 GET_REAL_FUNC_TIZEN(_ZN5Tizen2Ui29TouchLongPressGestureDetector32AddLongPressGestureEventListenerERNS0_35ITouchLongPressGestureEventListenerE,
517 LIBOSP_UIFW, addlongpressgestureeventlistenerp);
520 GestureEventListener& mylistener = GestureEventListener::GetInstance();
521 if(add_detector_hash(static_cast<void*>(this), static_cast<void*>(&mylistener)) <= 0)
523 iret = (this->*addlongpressgestureeventlistenerp)(static_cast<ITouchLongPressGestureEventListener&>(mylistener));
524 if(likely(iret == E_SUCCESS))
530 del_detector_hash(static_cast<void*>(this));
535 return (this->*addlongpressgestureeventlistenerp)(listener);
538 result TouchPanningGestureDetector::AddPanningGestureEventListener(ITouchPanningGestureEventListener& listener)
540 typedef result (TouchPanningGestureDetector::*methodType)(ITouchPanningGestureEventListener& listener);
541 static methodType addpanninggestureeventlistenerp;
544 GET_REAL_FUNC_TIZEN(_ZN5Tizen2Ui27TouchPanningGestureDetector30AddPanningGestureEventListenerERNS0_33ITouchPanningGestureEventListenerE,
545 LIBOSP_UIFW, addpanninggestureeventlistenerp);
548 GestureEventListener& mylistener = GestureEventListener::GetInstance();
549 if(add_detector_hash(static_cast<void*>(this), static_cast<void*>(&mylistener)) <= 0)
551 iret = (this->*addpanninggestureeventlistenerp)(static_cast<ITouchPanningGestureEventListener&>(mylistener));
552 if(likely(iret == E_SUCCESS))
558 del_detector_hash(static_cast<void*>(this));
563 return (this->*addpanninggestureeventlistenerp)(listener);
566 result TouchPinchGestureDetector::AddPinchGestureEventListener(ITouchPinchGestureEventListener& listener)
568 typedef result (TouchPinchGestureDetector::*methodType)(ITouchPinchGestureEventListener& listener);
569 static methodType addpinchgestureeventlistenerp;
572 GET_REAL_FUNC_TIZEN(_ZN5Tizen2Ui25TouchPinchGestureDetector28AddPinchGestureEventListenerERNS0_31ITouchPinchGestureEventListenerE,
573 LIBOSP_UIFW, addpinchgestureeventlistenerp);
576 GestureEventListener& mylistener = GestureEventListener::GetInstance();
577 if(add_detector_hash(static_cast<void*>(this), static_cast<void*>(&mylistener)) <= 0)
579 iret = (this->*addpinchgestureeventlistenerp)(static_cast<ITouchPinchGestureEventListener&>(mylistener));
580 if(likely(iret == E_SUCCESS))
586 del_detector_hash(static_cast<void*>(this));
591 return (this->*addpinchgestureeventlistenerp)(listener);
594 result TouchRotationGestureDetector::AddRotationGestureEventListener(ITouchRotationGestureEventListener& listener)
596 typedef result (TouchRotationGestureDetector::*methodType)(ITouchRotationGestureEventListener& listener);
597 static methodType addrotationgestureeventlistenerp;
600 GET_REAL_FUNC_TIZEN(_ZN5Tizen2Ui28TouchRotationGestureDetector31AddRotationGestureEventListenerERNS0_34ITouchRotationGestureEventListenerE,
601 LIBOSP_UIFW, addrotationgestureeventlistenerp);
604 GestureEventListener& mylistener = GestureEventListener::GetInstance();
605 if(add_detector_hash(static_cast<void*>(this), static_cast<void*>(&mylistener)) <= 0)
607 iret = (this->*addrotationgestureeventlistenerp)(static_cast<ITouchRotationGestureEventListener&>(mylistener));
608 if(likely(iret == E_SUCCESS))
614 del_detector_hash(static_cast<void*>(this));
619 return (this->*addrotationgestureeventlistenerp)(listener);
622 result TouchTapGestureDetector::AddTapGestureEventListener(ITouchTapGestureEventListener& listener)
624 typedef result (TouchTapGestureDetector::*methodType)(ITouchTapGestureEventListener& listener);
625 static methodType addtapgestureeventlistenerp;
628 GET_REAL_FUNC_TIZEN(_ZN5Tizen2Ui23TouchTapGestureDetector26AddTapGestureEventListenerERNS0_29ITouchTapGestureEventListenerE,
629 LIBOSP_UIFW, addtapgestureeventlistenerp);
632 GestureEventListener& mylistener = GestureEventListener::GetInstance();
633 if(add_detector_hash(static_cast<void*>(this), static_cast<void*>(&mylistener)) <= 0)
635 iret = (this->*addtapgestureeventlistenerp)(static_cast<ITouchTapGestureEventListener&>(mylistener));
636 if(likely(iret == E_SUCCESS))
642 del_detector_hash(static_cast<void*>(this));
647 return (this->*addtapgestureeventlistenerp)(listener);
650 result TouchGestureDetector::AddGestureEventListener(ITouchGestureEventListener& listener)
652 typedef result (TouchGestureDetector::*methodType)(ITouchGestureEventListener& listener);
653 static methodType addgestureeventlistenerp;
656 GET_REAL_FUNC_TIZEN(_ZN5Tizen2Ui20TouchGestureDetector23AddGestureEventListenerERNS0_26ITouchGestureEventListenerE,
657 LIBOSP_UIFW, addgestureeventlistenerp);
660 GestureEventListener& mylistener = GestureEventListener::GetInstance();
661 if(add_detector_hash(static_cast<void*>(this), static_cast<void*>(&mylistener)) <= 0)
663 iret = (this->*addgestureeventlistenerp)(static_cast<ITouchGestureEventListener&>(mylistener));
664 if(likely(iret == E_SUCCESS))
670 del_detector_hash(static_cast<void*>(this));
675 return (this->*addgestureeventlistenerp)(listener);
679 } } // end of namespace