(Gestures) Extract out GestureData from Actor
[platform/core/uifw/dali-core.git] / dali / internal / event / events / actor-gesture-data.h
1 #ifndef __DALI_INTERNAL_ACTOR_GESTURE_DATA_H__
2 #define __DALI_INTERNAL_ACTOR_GESTURE_DATA_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 // INTERNAL INCLUDES
22 #include <dali/internal/event/events/pan-gesture-detector-impl.h>
23 #include <dali/internal/event/events/pinch-gesture-detector-impl.h>
24 #include <dali/internal/event/events/long-press-gesture-detector-impl.h>
25 #include <dali/internal/event/events/tap-gesture-detector-impl.h>
26
27 namespace Dali
28 {
29
30 namespace Internal
31 {
32
33 /**
34  * Holds gesture specific data for an Actor
35  */
36 class ActorGestureData
37 {
38 public:
39
40   /**
41    * Constructor
42    */
43   ActorGestureData();
44
45   /**
46    * Non-virtual Destructor
47    */
48   ~ActorGestureData();
49
50   /**
51    * Adds a gesture detector to the data so that the owning actor is aware that it requires this
52    * type of gesture.
53    * @param[in] detector The detector being added.
54    * @note A raw pointer to the detector is stored, so the detector MUST remove itself when it is
55    * destroyed using RemoveGestureDetector()
56    */
57   void AddGestureDetector( GestureDetector& detector );
58
59   /**
60    * Removes a previously added gesture detector from the data. If no more gesture detectors of
61    * this type are registered then the actor owning this data will no longer be hit-tested for that
62    * gesture.
63    * @param[in] detector The detector to remove.
64    */
65   void RemoveGestureDetector( GestureDetector& detector );
66
67   /**
68    * Queries whether the actor requires the gesture type.
69    * @param[in] type The gesture type.
70    * @return true if the gesture is required, false otherwise.
71    */
72   inline bool IsGestureRequred( Gesture::Type type ) const
73   {
74     return type & gesturesRequired;
75   }
76
77 private:
78
79   Gesture::Type gesturesRequired; ///< Stores which gestures are required
80
81   PanGestureDetectorContainer*       panDetectors;       ///< Pointer to a container of pan-detectors
82   PinchGestureDetectorContainer*     pinchDetectors;     ///< Pointer to a container of pinch-detectors
83   LongPressGestureDetectorContainer* longPressDetectors; ///< Pointer to a container of long-press-detectors
84   TapGestureDetectorContainer*       tapDetectors;       ///< Pointer to a container of tap-detectors
85 };
86
87 } // namespace Internal
88
89 } // namespace Dali
90
91 #endif // __DALI_INTERNAL_ACTOR_GESTURE_DATA_H__
92