1 #ifndef __DALI_INTERNAL_ANIMATOR_CONNECTOR_BASE_H__
2 #define __DALI_INTERNAL_ANIMATOR_CONNECTOR_BASE_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/common/object-impl.h>
23 #include <dali/internal/common/owner-pointer.h>
24 #include <dali/devel-api/common/owner-container.h>
25 #include <dali/public-api/animation/alpha-function.h>
26 #include <dali/public-api/animation/time-period.h>
27 #include <dali/public-api/common/dali-common.h>
36 class AnimatorConnectorBase;
38 typedef OwnerPointer<AnimatorConnectorBase> AnimatorConnectorPtr;
40 typedef OwnerContainer< AnimatorConnectorBase* > AnimatorConnectorContainer;
42 typedef AnimatorConnectorContainer::Iterator AnimatorConnectorIter;
43 typedef AnimatorConnectorContainer::ConstIterator AnimatorConnectorConstIter;
46 * An abstract base class for animator connectors.
48 * The scene-graph objects are created by a Object e.g. Actor is a proxy for SceneGraph::Node.
49 * AnimatorConnectorBase observes the proxy object, in order to detect when a scene-graph object is created.
51 class AnimatorConnectorBase: public Object::Observer
58 AnimatorConnectorBase(
60 Property::Index propertyIndex,
63 const TimePeriod& period)
66 mAlphaFunction(alpha),
68 mPropertyIndex( propertyIndex ),
69 mComponentIndex( componentIndex )
71 object.AddObserver( *this );
77 virtual ~AnimatorConnectorBase()
82 * Set the parent of the AnimatorConnector.
83 * @pre The connector does not already have a parent.
84 * @param [in] parent The parent object.
86 virtual void SetParent(Animation& parent) = 0;
89 * Retrieve the parent of the AnimatorConnector.
90 * @return The parent object, or NULL.
92 Animation* GetParent() const
97 Object* GetObject() const
102 Property::Index GetPropertyIndex() const
104 return mPropertyIndex;
107 int GetComponentIndex() const
109 return mComponentIndex;
115 * From Object::Observer
117 virtual void SceneObjectAdded( Object& object )
122 * From Object::Observer
124 virtual void SceneObjectRemoved( Object& object )
129 * From Object::Observer
131 virtual void ObjectDestroyed( Object& object )
138 Animation* mParent; ///< The parent owns the connector.
139 Object* mObject; ///< Not owned by the animator connector. Valid until ObjectDestroyed() is called.
141 AlphaFunction mAlphaFunction;
142 TimePeriod mTimePeriod;
144 Property::Index mPropertyIndex;
149 } // namespace Internal
153 #endif // __DALI_INTERNAL_ANIMATOR_CONNECTOR_BASE_H__