Dali 3D User Interface Engine
custom-actor-internal.h
Go to the documentation of this file.
1 #ifndef __DALI_INTERNAL_CUSTOM_ACTOR_H__
2 #define __DALI_INTERNAL_CUSTOM_ACTOR_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
26 
27 namespace Dali
28 {
29 
30 namespace Internal
31 {
32 
33 class CustomActor : public Actor
34 {
35 public:
36 
41  static CustomActorPtr New(CustomActorImpl& extension);
42 
48  {
49  return *mImpl;
50  }
51 
57  {
58  return *mImpl;
59  }
60 
61 protected:
62 
66  virtual ~CustomActor();
67 
68 private:
69 
73  virtual void OnStageConnectionExternal( int depth )
74  {
75  mImpl->OnStageConnection( depth );
76  }
77 
82  {
84  }
85 
89  virtual void OnChildAdd(Actor& child)
90  {
91  Dali::Actor handle(&child);
92  mImpl->OnChildAdd(handle);
93  }
94 
98  virtual void OnChildRemove(Actor& child)
99  {
100  Dali::Actor handle(&child);
101  mImpl->OnChildRemove(handle);
102  }
103 
107  virtual void OnPropertySet( Property::Index index, Property::Value propertyValue )
108  {
109  mImpl->OnPropertySet(index, propertyValue);
110  }
111 
115  virtual void OnSizeSet(const Vector3& targetSize)
116  {
117  mImpl->OnSizeSet(targetSize);
118  }
119 
123  virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
124  {
125  Dali::Animation animationHandle(&animation);
126  mImpl->OnSizeAnimation(animationHandle, targetSize);
127  }
128 
132  virtual bool OnTouchEvent(const TouchEvent& event)
133  {
134  return mImpl->OnTouchEvent(event);
135  }
136 
140  virtual bool OnHoverEvent(const HoverEvent& event)
141  {
142  return mImpl->OnHoverEvent(event);
143  }
144 
148  virtual bool OnKeyEvent(const KeyEvent& event)
149  {
150  return mImpl->OnKeyEvent(event);
151  }
152 
156  virtual bool OnWheelEvent(const WheelEvent& event)
157  {
158  return mImpl->OnWheelEvent(event);
159  }
160 
164  virtual void OnRelayout( const Vector2& size, RelayoutContainer& container )
165  {
166  mImpl->OnRelayout( size, container );
167  }
168 
172  virtual void OnSetResizePolicy( ResizePolicy::Type policy, Dimension::Type dimension )
173  {
174  mImpl->OnSetResizePolicy( policy, dimension );
175  }
176 
180  virtual Vector3 GetNaturalSize() const
181  {
182  return mImpl->GetNaturalSize();
183  }
184 
188  virtual float CalculateChildSize( const Dali::Actor& child, Dimension::Type dimension )
189  {
190  return mImpl->CalculateChildSize( child, dimension );
191  }
192 
196  virtual float GetHeightForWidth( float width )
197  {
198  return mImpl->GetHeightForWidth( width );
199  }
200 
204  virtual float GetWidthForHeight( float height )
205  {
206  return mImpl->GetWidthForHeight( height );
207  }
208 
213  {
214  return mImpl->RelayoutDependentOnChildren( dimension );
215  }
216 
220  virtual void OnCalculateRelayoutSize( Dimension::Type dimension )
221  {
222  return mImpl->OnCalculateRelayoutSize( dimension );
223  }
224 
228  virtual void OnLayoutNegotiated( float size, Dimension::Type dimension )
229  {
230  return mImpl->OnLayoutNegotiated( size, dimension );
231  }
232 
236  CustomActor(CustomActorImpl& extension);
237 
238  // Undefined
239  CustomActor(const CustomActor&);
240 
241  // Undefined
242  CustomActor& operator=(const CustomActor& rhs);
243 
244 protected:
245 
247 };
248 
249 } // namespace Internal
250 
251 // Helpers for public-api forwarding methods
252 
254 {
255  DALI_ASSERT_ALWAYS( actor && "CustomActor handle is empty" );
256 
257  BaseObject& handle = actor.GetBaseObject();
258 
259  return static_cast<Internal::CustomActor&>(handle);
260 }
261 
263 {
264  DALI_ASSERT_ALWAYS( actor && "CustomActor handle is empty" );
265 
266  const BaseObject& handle = actor.GetBaseObject();
267 
268  return static_cast<const Internal::CustomActor&>(handle);
269 }
270 
271 } // namespace Dali
272 
273 #endif // __DALI_INTERNAL_CUSTOM_ACTOR_H__
Dali Docs Home
Read more about Dali