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 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/internal/event/actors/actor-impl.h>
23 #include <dali/internal/event/actors/actor-declarations.h>
24 #include <dali/public-api/actors/custom-actor.h>
32 class CustomActor : public Actor
37 * Create a new custom actor.
38 * @return A smart-pointer to the newly allocated Actor.
40 static CustomActorPtr New(CustomActorImpl& extension);
43 * Retrieve the custom actor implementation.
44 * @return The implementation, or an invalid pointer if no implementation was set.
46 CustomActorImpl& GetImplementation()
52 * Retrieve the custom actor implementation.
53 * @return The implementation, or an invalid pointer if no implementation was set.
55 const CustomActorImpl& GetImplementation() const
63 * A reference counted object may only be deleted by calling Unreference()
65 virtual ~CustomActor();
70 * @copydoc Internal::Actor::OnStageConnectionExternal
72 virtual void OnStageConnectionExternal()
74 mImpl->OnStageConnection();
78 * @copydoc Internal::Actor::OnStageDisconnectionExternal
80 virtual void OnStageDisconnectionExternal()
82 mImpl->OnStageDisconnection();
86 * @copydoc Internal::Actor::OnChildAdd
88 virtual void OnChildAdd(Actor& child)
90 Dali::Actor handle(&child);
91 mImpl->OnChildAdd(handle);
95 * @copydoc Internal::Actor::OnChildRemove
97 virtual void OnChildRemove(Actor& child)
99 Dali::Actor handle(&child);
100 mImpl->OnChildRemove(handle);
104 * @copydoc Internal::Actor::OnPropertySet
106 virtual void OnPropertySet( Property::Index index, Property::Value propertyValue )
108 mImpl->OnPropertySet(index, propertyValue);
112 * @copydoc Internal::Actor::OnSizeSet
114 virtual void OnSizeSet(const Vector3& targetSize)
116 mImpl->OnSizeSet(targetSize);
120 * @copydoc Internal::Actor::OnSizeAnimation
122 virtual void OnSizeAnimation(Animation& animation, const Vector3& targetSize)
124 Dali::Animation animationHandle(&animation);
125 mImpl->OnSizeAnimation(animationHandle, targetSize);
129 * @copydoc Internal::Actor::OnTouchEvent
131 virtual bool OnTouchEvent(const TouchEvent& event)
133 return mImpl->OnTouchEvent(event);
137 * @copydoc Internal::Actor::OnKeyEvent
139 virtual bool OnKeyEvent(const KeyEvent& event)
141 return mImpl->OnKeyEvent(event);
145 * @copydoc Internal::Actor::OnMouseWheelEvent
147 virtual bool OnMouseWheelEvent(const MouseWheelEvent& event)
149 return mImpl->OnMouseWheelEvent(event);
153 * @copydoc Internal::Actor::GetChildByAlias
155 virtual Dali::Actor GetChildByAlias(const std::string& actorAlias)
157 return mImpl->GetChildByAlias(actorAlias);
161 * Private constructor; see also CustomActor::New()
163 CustomActor(CustomActorImpl& extension);
166 CustomActor(const CustomActor&);
169 CustomActor& operator=(const CustomActor& rhs);
173 CustomActorImplPtr mImpl;
176 } // namespace Internal
178 // Helpers for public-api forwarding methods
180 inline Internal::CustomActor& GetImpl(Dali::CustomActor& actor)
182 DALI_ASSERT_ALWAYS( actor && "CustomActor handle is empty" );
184 BaseObject& handle = actor.GetBaseObject();
186 return static_cast<Internal::CustomActor&>(handle);
189 inline const Internal::CustomActor& GetImpl(const Dali::CustomActor& actor)
191 DALI_ASSERT_ALWAYS( actor && "CustomActor handle is empty" );
193 const BaseObject& handle = actor.GetBaseObject();
195 return static_cast<const Internal::CustomActor&>(handle);
200 #endif // __DALI_INTERNAL_CUSTOM_ACTOR_H__