1 #ifndef __DALI_INTERNAL_CUSTOM_ACTOR_H__
2 #define __DALI_INTERNAL_CUSTOM_ACTOR_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.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
11 // http://floralicense.org/license/
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.
21 #include <dali/internal/event/actors/actor-impl.h>
22 #include <dali/internal/event/actors/actor-declarations.h>
23 #include <dali/public-api/actors/custom-actor.h>
31 class CustomActor : public Actor
36 * Create a new custom actor.
37 * @return A smart-pointer to the newly allocated Actor.
39 static CustomActorPtr New(CustomActorImpl& extension);
42 * Retrieve the custom actor implementation.
43 * @return The implementation, or an invalid pointer if no implementation was set.
45 CustomActorImpl& GetImplementation()
51 * Retrieve the custom actor implementation.
52 * @return The implementation, or an invalid pointer if no implementation was set.
54 const CustomActorImpl& GetImplementation() const
62 * A reference counted object may only be deleted by calling Unreference()
64 virtual ~CustomActor();
69 * @copydoc Internal::Actor::OnStageConnectionExternal
71 virtual void OnStageConnectionExternal()
73 mImpl->OnStageConnection();
77 * @copydoc Internal::Actor::OnStageDisconnectionExternal
79 virtual void OnStageDisconnectionExternal()
81 mImpl->OnStageDisconnection();
85 * @copydoc Internal::Actor::OnChildAdd
87 virtual void OnChildAdd(Actor& child)
89 Dali::Actor handle(&child);
90 mImpl->OnChildAdd(handle);
94 * @copydoc Internal::Actor::OnChildRemove
96 virtual void OnChildRemove(Actor& child)
98 Dali::Actor handle(&child);
99 mImpl->OnChildRemove(handle);
103 * @copydoc Internal::Actor::OnPropertySet
105 virtual void OnPropertySet( Property::Index index, Property::Value propertyValue )
107 mImpl->OnPropertySet(index, propertyValue);
111 * @copydoc Internal::Actor::OnSizeSet
113 virtual void OnSizeSet(const Vector3& targetSize)
115 mImpl->OnSizeSet(targetSize);
119 * @copydoc Internal::Actor::OnSizeAnimation
121 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
123 Dali::Animation animationHandle(&animation);
124 mImpl->OnSizeAnimation(animationHandle, targetSize);
128 * @copydoc Internal::Actor::OnTouchEvent
130 virtual bool OnTouchEvent(const TouchEvent& event)
132 return mImpl->OnTouchEvent(event);
136 * @copydoc Internal::Actor::OnKeyEvent
138 virtual bool OnKeyEvent(const KeyEvent& event)
140 return mImpl->OnKeyEvent(event);
144 * @copydoc Internal::Actor::OnMouseWheelEvent
146 virtual bool OnMouseWheelEvent(const MouseWheelEvent& event)
148 return mImpl->OnMouseWheelEvent(event);
152 * @copydoc Internal::Actor::GetChildByAlias
154 virtual Dali::Actor GetChildByAlias(const std::string& actorAlias)
156 return mImpl->GetChildByAlias(actorAlias);
160 * Private constructor; see also CustomActor::New()
162 CustomActor(CustomActorImpl& extension);
165 CustomActor(const CustomActor&);
168 CustomActor& operator=(const CustomActor& rhs);
172 CustomActorImplPtr mImpl;
175 } // namespace Internal
177 // Helpers for public-api forwarding methods
179 inline Internal::CustomActor& GetImpl(Dali::CustomActor& actor)
181 DALI_ASSERT_ALWAYS( actor && "CustomActor handle is empty" );
183 BaseObject& handle = actor.GetBaseObject();
185 return static_cast<Internal::CustomActor&>(handle);
188 inline const Internal::CustomActor& GetImpl(const Dali::CustomActor& actor)
190 DALI_ASSERT_ALWAYS( actor && "CustomActor handle is empty" );
192 const BaseObject& handle = actor.GetBaseObject();
194 return static_cast<const Internal::CustomActor&>(handle);
199 #endif // __DALI_INTERNAL_CUSTOM_ACTOR_H__