X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fanimation%2Fanimator-connector-base.h;h=15cee6f71d4542b7d490b29951db812c7fe1ed68;hb=7ab969fbd5e091f206a3407f7da115aaf103d3cc;hp=1882a8d91d2ec0a9a623fdd01ffbc09b4290dda1;hpb=8f2c5571c924479b6a07a2c2187dedd9c685baf0;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/animation/animator-connector-base.h b/dali/internal/event/animation/animator-connector-base.h index 1882a8d..15cee6f 100644 --- a/dali/internal/event/animation/animator-connector-base.h +++ b/dali/internal/event/animation/animator-connector-base.h @@ -1,29 +1,26 @@ #ifndef __DALI_INTERNAL_ANIMATOR_CONNECTOR_BASE_H__ #define __DALI_INTERNAL_ANIMATOR_CONNECTOR_BASE_H__ -// -// Copyright (c) 2014 Samsung Electronics Co., Ltd. -// -// Licensed under the Flora License, Version 1.0 (the License); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://floralicense.org/license/ -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an AS IS BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -// EXTERNAL INCLUDES -#include +/* + * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ // INTERNAL INCLUDES -#include -#include -#include +#include +#include #include #include @@ -34,30 +31,34 @@ namespace Internal { class Animation; -class AnimatorConnectorBase; - -typedef OwnerPointer AnimatorConnectorPtr; - -typedef OwnerContainer< AnimatorConnectorBase* > AnimatorConnectorContainer; - -typedef AnimatorConnectorContainer::Iterator AnimatorConnectorIter; -typedef AnimatorConnectorContainer::ConstIterator AnimatorConnectorConstIter; /** * An abstract base class for animator connectors. + * + * The scene-graph objects are created by a Object e.g. Actor is a proxy for SceneGraph::Node. + * AnimatorConnectorBase observes the proxy object, in order to detect when a scene-graph object is created. */ -class AnimatorConnectorBase +class AnimatorConnectorBase: public Object::Observer { public: /** * Constructor. */ - AnimatorConnectorBase(AlphaFunction alpha, const TimePeriod& period) - : mParent(NULL), + AnimatorConnectorBase( + Object& object, + Property::Index propertyIndex, + int componentIndex, + AlphaFunction alpha, + const TimePeriod& period) + : mParent( NULL ), + mObject( &object ), mAlphaFunction(alpha), - mTimePeriod(period) + mTimePeriod(period), + mPropertyIndex( propertyIndex ), + mComponentIndex( componentIndex ) { + object.AddObserver( *this ); } /** @@ -78,17 +79,61 @@ public: * Retrieve the parent of the AnimatorConnector. * @return The parent object, or NULL. */ - Animation* GetParent() + Animation* GetParent() const { return mParent; } + Object* GetObject() const + { + return mObject; + } + + Property::Index GetPropertyIndex() const + { + return mPropertyIndex; + } + + int GetComponentIndex() const + { + return mComponentIndex; + } + +private: + + /** + * From Object::Observer + */ + virtual void SceneObjectAdded( Object& object ) + { + } + + /** + * From Object::Observer + */ + virtual void SceneObjectRemoved( Object& object ) + { + } + + /** + * From Object::Observer + */ + virtual void ObjectDestroyed( Object& object ) + { + mObject = NULL; + } + protected: Animation* mParent; ///< The parent owns the connector. + Object* mObject; ///< Not owned by the animator connector. Valid until ObjectDestroyed() is called. AlphaFunction mAlphaFunction; TimePeriod mTimePeriod; + + Property::Index mPropertyIndex; + int mComponentIndex; + }; } // namespace Internal