Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / inc / FUi_TouchRotationGestureDetector.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17 /**
18  * @file        FUi_TouchRotationGestureDetector.h
19  * @brief       This is the header file for the %_TouchRotationGestureDetector class.
20  *
21  * This header file contains the declarations of the %_TouchRotationGestureDetector class.
22  */
23 #ifndef _FUI_INTERNAL_TOUCH_ROTATION_GESTURE_DETECTOR_H_
24 #define _FUI_INTERNAL_TOUCH_ROTATION_GESTURE_DETECTOR_H_
25
26 #include "FUi_TouchGestureDetector.h"
27
28 namespace Tizen { namespace Ui
29 {
30 /**
31  * @class               _TouchRotationGestureDetector
32  * @brief
33  * @since 2.0
34  *
35  */
36 class _OSP_EXPORT_ _TouchRotationGestureDetector
37         : public _TouchGestureDetector
38         , public Tizen::Base::Runtime::ITimerEventListener
39 {
40 public:
41         _TouchRotationGestureDetector(void);
42         ~_TouchRotationGestureDetector(void);
43
44         virtual bool OnTouchPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
45         virtual bool OnTouchMoved(const Tizen::Ui:: _Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
46         virtual bool OnTouchReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
47         virtual bool OnTouchCanceled(const Tizen::Ui::_Control& source, const Tizen::Ui::_TouchInfo& touchinfo);
48
49         float GetAngle(void) const;
50         int GetDistance(void) const;
51
52 private:
53         _TouchRotationGestureDetector(const _TouchRotationGestureDetector&);
54         _TouchRotationGestureDetector& operator =(const _TouchRotationGestureDetector&);
55
56         double GetAngle(int x1, int y1, int x2, int y2) const;
57         virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
58         void SetDetectorStateChanged(void);
59
60 private:
61         int __distance;
62         float __angle;
63         int __fingerCount;
64         Tizen::Graphics::Point __firstPoint;
65         Tizen::Graphics::Point __secondPoint;
66         Tizen::Graphics::Point __firstPrevPoint;
67         Tizen::Graphics::Point __secondPrevPoint;
68         int __firstMovedDirection;
69         int __secondMovedDirection;
70         Tizen::Base::Runtime::Timer* __pTimer;
71         unsigned long __firstPointId;
72         unsigned long __secondPointId;
73 }; // _TouchRotationGestureDetector
74
75 }} //Tizen::Ui
76
77 #endif  //_FUI_INTERNAL_TOUCH_ROTATION_GESTURE_DETECTOR_H_