Dali 3D User Interface Engine
gesture-detector-impl.h
Go to the documentation of this file.
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 // INTERNAL INCLUDES
28 
29 namespace Dali
30 {
31 
32 namespace Integration
33 {
34 struct GestureEvent;
35 }
36 
37 namespace Internal
38 {
39 
40 class GestureDetector;
42 
44 typedef std::vector<GestureDetector*> GestureDetectorContainer;
45 typedef std::vector<Actor*> GestureDetectorActorContainer;
46 
50 template< typename Detector >
52 {
53  typedef std::vector<Detector*> type;
54 };
55 
59 class GestureDetector : public Object, public Object::Observer
60 {
61 public:
62 
66  void Attach(Actor& actor);
67 
71  void Detach(Actor& actor);
72 
76  void DetachAll();
77 
81  size_t GetAttachedActorCount() const;
82 
86  Dali::Actor GetAttachedActor(size_t index) const;
87 
93  {
94  return mAttachedActors;
95  }
96 
102  {
103  return mType;
104  }
105 
111  bool IsAttached(Actor& actor) const;
112 
113 protected: // Creation & Destruction
114 
119 
123  virtual ~GestureDetector();
124 
125 private:
126 
127  // Undefined
129 
130  // Undefined
132 
136  virtual void SceneObjectAdded(Object& object) {}
137 
141  virtual void SceneObjectRemoved(Object& object) {}
142 
146  virtual void ObjectDestroyed(Object& object);
147 
152  virtual void OnActorAttach(Actor& actor) = 0;
153 
158  virtual void OnActorDetach(Actor& actor) = 0;
159 
166  virtual void OnActorDestroyed(Object& object) = 0;
167 
168 private: // Default property extensions from Object
169 
173  virtual unsigned int GetDefaultPropertyCount() const;
174 
178  virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
179 
183  virtual const char* GetDefaultPropertyName(Property::Index index) const;
184 
188  virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
189 
193  virtual bool IsDefaultPropertyWritable(Property::Index index) const;
194 
198  virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
199 
203  virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
204 
209 
213  virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
214 
218  virtual Property::Value GetDefaultProperty( Property::Index index ) const;
219 
223  virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
224 
229 
233  virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
234 
235 protected:
236 
240 };
241 
242 } // namespace Internal
243 
244 // Helpers for public-api forwarding methods
245 
247 {
248  DALI_ASSERT_ALWAYS( detector && "GestureDetector handle is empty" );
249 
250  BaseObject& handle = detector.GetBaseObject();
251 
252  return static_cast<Internal::GestureDetector&>(handle);
253 }
254 
256 {
257  DALI_ASSERT_ALWAYS( detector && "GestureDetector handle is empty" );
258 
259  const BaseObject& handle = detector.GetBaseObject();
260 
261  return static_cast<const Internal::GestureDetector&>(handle);
262 }
263 
264 } // namespace Dali
265 
266 #endif // __DALI_INTERNAL_GESTURE_DETECTOR_H__
Dali Docs Home
Read more about Dali