X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Fcommon%2Fobject-impl.h;h=b7e68367fcfdbd8c69410a844cc96d738f7c617a;hb=b461bf8aff79358fc27202f9ae79bd383570a9f5;hp=fc2598d440d4ae994be385b07b62ac48abfbd12e;hpb=73c37a734c864d1098c86a44a064c9f35a2ed15d;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/common/object-impl.h b/dali/internal/event/common/object-impl.h index fc2598d..b7e6836 100644 --- a/dali/internal/event/common/object-impl.h +++ b/dali/internal/event/common/object-impl.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_OBJECT_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 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. @@ -19,19 +19,19 @@ */ // INTERNAL INCLUDES -#include #include #include #include #include #include #include +#include #include #include -#include -#include +#include #include #include +#include #include namespace Dali @@ -41,7 +41,7 @@ class PropertyNotification; namespace Internal { -class Constraint; +class ConstraintBase; class EventThreadServices; class Handle; class PropertyCondition; @@ -55,9 +55,10 @@ class PropertyBase; class PropertyOwner; } -typedef std::vector< Dali::ActiveConstraint > ActiveConstraintContainer; -typedef ActiveConstraintContainer::iterator ActiveConstraintIter; -typedef ActiveConstraintContainer::const_iterator ActiveConstraintConstIter; +typedef std::vector< Dali::Constraint > ConstraintContainer; +typedef ConstraintContainer::iterator ConstraintIter; +typedef ConstraintContainer::const_iterator ConstraintConstIter; + /** * A base class for objects which optionally provide properties. @@ -211,26 +212,31 @@ public: */ virtual void RemovePropertyNotifications(); - // Constraints + /******************************** Uniform Mappings ********************************/ /** - * Apply a constraint to a Object. - * @param[in] constraint The constraint to apply. + * @copydoc Dali::Handle::AddUniformMapping() + */ + void AddUniformMapping( Property::Index propertyIndex, const std::string& uniformName ) const; + + /** + * @copydoc Dali::Handle::RemoveUniformMapping( ) */ - Dali::ActiveConstraint ApplyConstraint( Constraint& constraint ); + void RemoveUniformMapping( const std::string& uniformName ); + + /******************************** Constraints ********************************/ /** - * Apply a constraint to a Object. + * Apply a constraint to an Object. * @param[in] constraint The constraint to apply. - * @param[in] weightObject An object with a "weight" float property. */ - Dali::ActiveConstraint ApplyConstraint( Constraint& constraint, Dali::Handle weightObject ); + void ApplyConstraint( ConstraintBase& constraint ); /** - * Remove one constraint from a Object. - * @param[in] activeConstraint The active constraint to remove. + * Remove one constraint from an Object. + * @param[in] constraint The constraint to remove. */ - void RemoveConstraint( Dali::ActiveConstraint activeConstraint ); + void RemoveConstraint( ConstraintBase& constraint ); /** * Remove all constraints from a Object. @@ -256,7 +262,7 @@ public: return PROPERTY_CUSTOM_START_INDEX; } - // To be overridden by deriving classes + /******************** To be overridden by deriving classes ********************/ /** * Retrieve the scene-graph object added by this object. @@ -273,7 +279,7 @@ public: virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const = 0; /** - * Retrieve an constraint input-property owned by the scene-graph object. + * Retrieve a constraint input-property owned by the scene-graph object. * @pre -1 < index < GetPropertyCount(). * @param[in] index The index of the property. * @return A dereferenceable pointer to an input property, or NULL if a scene-object does not exist with this property. @@ -306,8 +312,17 @@ protected: void OnSceneObjectRemove(); /** + * For overriding by derived classes to return the parent of this object. + */ + virtual Object* GetParentObject() const + { + // By default the Object does not have a parent + return NULL; + }; + + /** * For use in derived classes. - * This is called after a non animatable custom property is set. + * This is called after a property is set. * @param [in] index The index of the property. * @param [in] propertyValue The value of the property. */ @@ -325,7 +340,35 @@ protected: * @param index * @return pointer to the property */ - CustomProperty* FindCustomProperty( Property::Index index ) const; + CustomPropertyMetadata* FindCustomProperty( Property::Index index ) const; + + /** + * Helper to find animatable property + * @param index + * @return pointer to the property + */ + AnimatablePropertyMetadata* FindAnimatableProperty( Property::Index index ) const; + + /** + * Helper to register a scene-graph property + * @param [in] name The name of the property. + * @param [in] index The index of the property + * @param [in] value The value of the property. + * @return The index of the registered property or Property::INVALID_INDEX if registration failed. + */ + Property::Index RegisterSceneGraphProperty(const std::string& name, Property::Index index, const Property::Value& propertyValue) const; + + /** + * Check whether the animatable property is registered already, if not then register one. + * @param [in] index The index of the property + * @return pointer to the property. + */ + AnimatablePropertyMetadata* RegisterAnimatableProperty(Property::Index index) const; + + /** + * Resolve the index and name of child properties if any. + */ + void ResolveChildProperties(); private: // Default property extensions for derived classes @@ -418,7 +461,7 @@ private: // Default property extensions for derived classes * @param [in] name The name allocated to this custom property. * @param [in] index The index allocated to this custom property. */ - virtual void NotifyScenePropertyInstalled( const SceneGraph::PropertyBase& newProperty, const std::string& name, unsigned int index ) + virtual void NotifyScenePropertyInstalled( const SceneGraph::PropertyBase& newProperty, const std::string& name, unsigned int index ) const { } private: @@ -440,25 +483,19 @@ private: void DisablePropertyNotifications(); /** - * Helper for ApplyConstraint overloads. - * @param[in] constraint The constraint to apply. - * @param[in] weightObject An object with a "weight" float property, or an empty handle. - * @return The new active-constraint which is owned by Object. + * Get the value of the property. + * @param [in] entry An entry from the property lookup container. + * @return The new value of the property. */ - ActiveConstraintBase* DoApplyConstraint( Constraint& constraint, Dali::Handle weightObject ); - - /** - * Helper to remove active constraints - */ - void RemoveConstraint( ActiveConstraint& constraint, bool isInScenegraph ); + Property::Value GetPropertyValue( const PropertyMetadata* entry ) const; /** * Set the value of scene graph property. * @param [in] index The index of the property. - * @param [in] entry An entry from the CustomPropertyLookup. + * @param [in] entry An entry from the property lookup container. * @param [in] value The new value of the property. */ - virtual void SetSceneGraphProperty( Property::Index index, const CustomProperty& entry, const Property::Value& value ); + virtual void SetSceneGraphProperty( Property::Index index, const PropertyMetadata& entry, const Property::Value& value ); protected: /** @@ -492,20 +529,20 @@ private: private: - typedef OwnerContainer CustomPropertyLookup; - CustomPropertyLookup mCustomProperties; ///< Used for accessing custom Node properties + typedef OwnerContainer PropertyMetadataLookup; + mutable PropertyMetadataLookup mCustomProperties; ///< Used for accessing custom Node properties + mutable PropertyMetadataLookup mAnimatableProperties; ///< Used for accessing animatable Node properties mutable TypeInfo const * mTypeInfo; ///< The type-info for this object, mutable so it can be lazy initialized from const method if it is required Dali::Vector mObservers; - ActiveConstraintContainer* mConstraints; ///< Container of owned active-constraints. + ConstraintContainer* mConstraints; ///< Container of owned -constraints. typedef std::vector< Dali::PropertyNotification > PropertyNotificationContainer; typedef PropertyNotificationContainer::iterator PropertyNotificationContainerIter; typedef PropertyNotificationContainer::const_iterator PropertyNotificationContainerConstIter; PropertyNotificationContainer* mPropertyNotifications; ///< Container of owned property notifications. }; - } // namespace Internal // Helpers for public-api forwarding methods