X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fupdate%2Fcommon%2Fproperty-owner.h;h=843a19b166d674921bbba9e151411ff4ac5ab85e;hb=4f6cc67ac85e504f3be6e05a9560a3fc862a0a6d;hp=fb056ad9de16c0a1488070297ed34ce06b27643d;hpb=5c66381841dd4dfd82c5a118d34104a00a2e0e1c;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/update/common/property-owner.h b/dali/internal/update/common/property-owner.h index fb056ad..843a19b 100644 --- a/dali/internal/update/common/property-owner.h +++ b/dali/internal/update/common/property-owner.h @@ -1,33 +1,33 @@ -#ifndef __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_H__ -#define __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_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 +#ifndef DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_H +#define DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_H + +/* + * Copyright (c) 2019 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 +#include #include + namespace Dali { @@ -39,9 +39,6 @@ namespace SceneGraph class PropertyOwner; -typedef std::set PropertyOwnerSet; -typedef PropertyOwnerSet::iterator PropertyOwnerIter; - typedef OwnerContainer< PropertyBase* > OwnedPropertyContainer; typedef OwnedPropertyContainer::Iterator OwnedPropertyIter; @@ -58,9 +55,33 @@ public: public: /** + * Called when the observable object is connected to the scene graph. + * @param[in] owner A reference to the connected PropertyOwner + */ + virtual void PropertyOwnerConnected( PropertyOwner& owner ) = 0; + + /** + * Called when the observable object is disconnected from the scene graph. + * @param[in] currentBufferIndex The buffer to reset. + * @param[in] owner A reference to the disconnected PropertyOwner + */ + virtual void PropertyOwnerDisconnected( BufferIndex updateBufferIndex, PropertyOwner& owner ) = 0; + + /** * Called shortly before the observable object is destroyed. + * + * @note Cleanup should be done in both this and PropertyOwnerDisconnected as PropertyOwnerDisconnected + * may not be called (i.e. when shutting down). */ virtual void PropertyOwnerDestroyed( PropertyOwner& owner ) = 0; + + protected: + + /** + * Virtual destructor, no deletion through this interface + */ + virtual ~Observer() {} + }; /** @@ -96,17 +117,30 @@ public: bool IsObserved(); /** - * Disconnect all observers and remove constraints. + * Called just before destruction to disconnect all observers and remove constraints. + * This occurs when the object is in the process of being destroyed. + */ + void Destroy(); + + /** + * Notify all observers that the object has been connected + * This occurs when the object is connected to the scene-graph during UpdateManager::Update(). + */ + void ConnectToSceneGraph(); + + /** + * Notify all observers that the object has been disconnected and remove constraints. * This occurs when the object is disconnected from the scene-graph during UpdateManager::Update(). + * @param[in] currentBufferIndex The current update buffer. */ - void DisconnectFromSceneGraph(); + void DisconnectFromSceneGraph( BufferIndex updateBufferIndex ); /** * Install a custom property. * @post The PropertyOwner takes ownership of the property. * @param[in] property A pointer to a newly allocated property. */ - void InstallCustomProperty(PropertyBase* property); + void InstallCustomProperty( OwnerPointer& property ); /** * Retrieve the custom properties owned by the object. @@ -126,12 +160,6 @@ public: return mCustomProperties; } - /** - * Reset animatable properties to the corresponding base values. - * @param[in] currentBufferIndex The buffer to reset. - * @post The ResetDefaultProperties method is called, during which derived classes can reset default properties. - */ - void ResetToBaseValues( BufferIndex updateBufferIndex ); // Constraints @@ -139,7 +167,7 @@ public: * Apply a constraint. * @param[in] constraint The constraint to apply. */ - void ApplyConstraint( ConstraintBase* constraint ); + void ApplyConstraint( OwnerPointer& constraint ); /** * Begin removal of constraints. @@ -153,6 +181,32 @@ public: */ ConstraintOwnerContainer& GetConstraints(); + /** + * @copydoc UniformMap::Add + */ + virtual void AddUniformMapping( OwnerPointer< UniformPropertyMapping >& map ); + + /** + * @copydoc UniformMap::Remove + */ + virtual void RemoveUniformMapping( const std::string& uniformName ); + + /** + * Get the mappings table + */ + const UniformMap& GetUniformMap() const; + + /** + * @copydoc UniformMap::AddUniformMapObserver + */ + void AddUniformMapObserver( UniformMap::Observer& observer ); + + /** + * @copydoc UniformMap::RemoveUniformMapObserver + */ + void RemoveUniformMapObserver( UniformMap::Observer& observer ); + + protected: /** @@ -168,15 +222,10 @@ private: // Undefined PropertyOwner& operator=(const PropertyOwner& rhs); - /** - * Called after ResetToBaseValues; derived classes should reset any default properties. - * @param[in] currentBufferIndex The buffer to reset. - */ - virtual void ResetDefaultProperties( BufferIndex updateBufferIndex ) {} - protected: OwnedPropertyContainer mCustomProperties; ///< Properties provided with InstallCustomProperty() + UniformMap mUniformMaps; ///< Container of owned uniform maps private: @@ -187,7 +236,6 @@ private: ObserverContainer mObservers; ///< Container of observer raw-pointers (not owned) ConstraintOwnerContainer mConstraints; ///< Container of owned constraints - }; } // namespace SceneGraph @@ -196,4 +244,4 @@ private: } // namespace Dali -#endif // __DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_H__ +#endif // DALI_INTERNAL_SCENE_GRAPH_PROPERTY_OWNER_H