2 // Open Service Platform
3 // Copyright (c) 2012 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://www.tizenopensource.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.
17 #ifndef _SAMPLE_CUSTOM_GESTURE_DETECTOR_H_
18 #define _SAMPLE_CUSTOM_GESTURE_DETECTOR_H_
20 #include <FUiITouchCustomGestureEventListener.h>
23 class SampleCustomGestureDetector:
24 public Osp::Ui::TouchGestureDetector
27 SampleCustomGestureDetector(const Osp::Graphics::Rectangle &rect);
28 virtual ~SampleCustomGestureDetector(void);
30 void AddEventListener(const Osp::Ui::ITouchCustomGestureEventListener& listener);
31 void RemoveEventListener(const Osp::Ui::ITouchCustomGestureEventListener& listener);
33 virtual void OnTouchPressed(Osp::Ui::Control& source, const Osp::Ui::TouchEventInfo& touchInfo);
34 virtual void OnTouchMoved(Osp::Ui::Control& source, const Osp::Ui::TouchEventInfo& touchInfo);
35 virtual void OnTouchReleased(Osp::Ui::Control& source, const Osp::Ui::TouchEventInfo& touchInfo);
36 virtual void OnTouchCanceled(Osp::Ui::Control& source, const Osp::Ui::TouchEventInfo& touchInfo);
39 double GetAngle(int x1, int y1, int x2, int y2) const;
42 Osp::Graphics::Point __previousPoint;
43 Osp::Graphics::Point __startPoint;
44 Osp::Graphics::Point __centerPoint;
45 Osp::Graphics::Rectangle __touchAreaBounds;
47 bool __directionChanged;
50 class SampleCustomGestureDetectorForm:
52 public Osp::Ui::ITouchCustomGestureEventListener
55 SampleCustomGestureDetectorForm(void);
56 virtual ~SampleCustomGestureDetectorForm();
58 virtual bool Initialize(void);
60 virtual result OnInitializing(void);
61 virtual result OnTerminating(void);
63 virtual void OnCustomGestureStarted(Osp::Ui::TouchGestureDetector& gestureDetector);
64 virtual void OnCustomGestureChanged(Osp::Ui::TouchGestureDetector& gestureDetector);
65 virtual void OnCustomGestureFinished(Osp::Ui::TouchGestureDetector& gestureDetector);
66 virtual void OnCustomGestureCanceled(Osp::Ui::TouchGestureDetector& gestureDetector);
67 virtual void OnActionPerformed(const Osp::Ui::Control& source, int actionId);
69 virtual result OnDraw(void);
70 Osp::Ui::Controls::Label* GetTouchArea(void);
72 static const int ID_BUTTON_CLEAR = 101;
73 Osp::Ui::Controls::Label* __pTouchArea;
74 Osp::Ui::Controls::Label* __pTouchResult;
75 Osp::Ui::Controls::Button* __pClearButton;
76 SampleCustomGestureDetector* __pCustomGesture;
77 Osp::Graphics::Canvas* __pCanvas;
80 #endif /* _SAMPLE_CUSTOM_GESTURE_DETECTOR_H_ */