[Tizen] Not execute the remove callback
[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) 2021 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/gesture-detector-impl.h>
23
24 namespace Dali
25 {
26 namespace Internal
27 {
28 /**
29  * Holds gesture specific data for an Actor
30  */
31 class ActorGestureData
32 {
33 public:
34   /**
35    * Constructor
36    */
37   ActorGestureData();
38
39   /**
40    * Non-virtual Destructor
41    */
42   ~ActorGestureData();
43
44   /**
45    * Adds a gesture detector to the data so that the owning actor is aware that it requires this
46    * type of gesture.
47    * @param[in] detector The detector being added.
48    * @note A raw pointer to the detector is stored, so the detector MUST remove itself when it is
49    * destroyed using RemoveGestureDetector()
50    */
51   void AddGestureDetector(GestureDetector& detector);
52
53   /**
54    * Removes a previously added gesture detector from the data. If no more gesture detectors of
55    * this type are registered then the actor owning this data will no longer be hit-tested for that
56    * gesture.
57    * @param[in] detector The detector to remove.
58    */
59   void RemoveGestureDetector(GestureDetector& detector);
60
61   /**
62    * Queries whether the actor requires the gesture type.
63    * @param[in] type The gesture type.
64    * @return true if the gesture is required, false otherwise.
65    */
66   inline bool IsGestureRequired(GestureType::Value type) const
67   {
68     return type & gesturesRequired;
69   }
70
71   /**
72    * Retrieve a reference to the detectors for the given type.
73    * @param[in] type The container type required
74    * @pre Ensure IsGestureRequired() is used to check if the container is actually available.
75    */
76   GestureDetectorContainer& GetGestureDetectorContainer(GestureType::Value type);
77
78 private:
79   /**
80    * Helper to retrieve the appropriate container type.
81    * @param[in] type The container type required.
82    */
83   inline GestureDetectorContainer*& GetContainerPtr(GestureType::Value type);
84
85 private:
86   GestureType::Value gesturesRequired; ///< Stores which gestures are required
87
88   GestureDetectorContainer* panDetectors;       ///< Pointer to a container of pan-detectors
89   GestureDetectorContainer* pinchDetectors;     ///< Pointer to a container of pinch-detectors
90   GestureDetectorContainer* longPressDetectors; ///< Pointer to a container of long-press-detectors
91   GestureDetectorContainer* tapDetectors;       ///< Pointer to a container of tap-detectors
92   GestureDetectorContainer* rotationDetectors;  ///< Pointer to a container of tap-detectors
93 };
94
95 } // namespace Internal
96
97 } // namespace Dali
98
99 #endif // DALI_INTERNAL_ACTOR_GESTURE_DATA_H