Merge "Overlay RenderTaskList should be created by the Window instead of the Overlay...
[platform/core/uifw/dali-adaptor.git] / dali / internal / input / common / gesture-detector.h
1 #ifndef __DALI_INTERNAL_GESTURE_DETECTOR_H__
2 #define __DALI_INTERNAL_GESTURE_DETECTOR_H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/common/vector-wrapper.h>
23 #include <dali/public-api/events/gesture.h>
24 #include <dali/public-api/math/vector2.h>
25 #include <dali/public-api/object/ref-object.h>
26
27 namespace Dali
28 {
29
30 namespace Integration
31 {
32 class Core;
33 class GestureRequest;
34 struct TouchEvent;
35 }
36
37 namespace Internal
38 {
39
40 namespace Adaptor
41 {
42
43 /**
44  * Abstract Base class for all adaptor gesture detectors.
45  *
46  * @note this may be replaced by gesture events sent directly from X.
47  */
48 class GestureDetector : public RefObject
49 {
50 public:
51
52   /**
53    * Called by the gesture manager when it gets a touch event.  The gesture detector should
54    * evaluate this event along with previously received events to determine whether the gesture
55    * they require has taken place.
56    * @param[in]  event  The latest touch event.
57    */
58   virtual void SendEvent(const Integration::TouchEvent& event) = 0;
59
60   /**
61    * Called by the gesture manager when Core updates the gesture's detection requirements.
62    * @param[in]  request  The updated detection requirements.
63    */
64   virtual void Update(const Integration::GestureRequest& request) = 0;
65
66   /**
67    * Returns the type of gesture detector.
68    * @return Type of gesture detector.
69    */
70   Gesture::Type GetType() const { return mType; }
71
72 protected:
73
74   /**
75    * Protected Constructor.  Should only be able to create derived class objects.
76    * @param[in]  screenSize    The size of the screen.
77    * @param[in]  detectorType  The type of gesture detector.
78    */
79   GestureDetector(Vector2 screenSize, Gesture::Type detectorType)
80   : mScreenSize(screenSize), mType(detectorType) {}
81
82   /**
83    * Virtual destructor.
84    */
85   virtual ~GestureDetector() {}
86
87 protected:
88
89   Vector2 mScreenSize;
90   Gesture::Type mType;
91 };
92
93 typedef IntrusivePtr<GestureDetector> GestureDetectorPtr;
94
95 } // namespace Adaptor
96
97 } // namespace Internal
98
99 } // namespace Dali
100
101 #endif // __DALI_INTERNAL_GESTURE_DETECTOR_H__