X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fbuilder%2Fbuilder-impl.h;h=b6db52d5f3bb5a0d3b36adbd5e0b29992d91b9e6;hp=aeb3ff11e2d792b073428650dbd27dcb9e64e9c3;hb=50550b5dd051c5baebd26365991b50f155031dc8;hpb=306d2f61a1b64179e801fa8a0bb2bd7b4e9dd682 diff --git a/dali-toolkit/internal/builder/builder-impl.h b/dali-toolkit/internal/builder/builder-impl.h index aeb3ff1..b6db52d 100644 --- a/dali-toolkit/internal/builder/builder-impl.h +++ b/dali-toolkit/internal/builder/builder-impl.h @@ -22,14 +22,19 @@ #include #include #include +#include +#include #include #include +#include +#include #include // INTERNAL INCLUDES -#include -#include +#include +#include #include +#include // Warning messages usually displayed #define DALI_SCRIPT_WARNING(format, args...) \ @@ -145,29 +150,37 @@ public: bool ApplyStyle( const std::string& styleName, Handle& handle ); /** - * @copydoc Toolkit::Builder::AddActors + * Lookup the stylename in builder. If it's found in the parse tree, + * then return true. + * @param[in] styleName The style name to search for + * @return true if the stylename exists */ - void AddActors( Actor toActor ); + bool LookupStyleName( const std::string& styleName ); /** - * @copydoc Toolkit::Builder::AddActors + * Lookup the stylename in the recorded Styles - if it exists, + * performs a shallow copy to the passed in style and returns true. + * Otherwise it returns false. + + * @param[in] styleName The stylename to search for + * @return A const pointer to the style object */ - void AddActors( const std::string §ionName, Actor toActor ); + const StylePtr GetStyle( const std::string& styleName ); /** - * @copydoc Toolkit::Builder::CreateRenderTask + * @copydoc Toolkit::Builder::AddActors */ - void CreateRenderTask( const std::string &name ); + void AddActors( Actor toActor ); /** - * @copydoc Toolkit::Builder::GetShaderEffect + * @copydoc Toolkit::Builder::AddActors */ - ShaderEffect GetShaderEffect( const std::string &name ); + void AddActors( const std::string §ionName, Actor toActor ); /** - * @copydoc Toolkit::Builder::GetShaderEffect + * @copydoc Toolkit::Builder::CreateRenderTask */ - ShaderEffect GetShaderEffect( const std::string &name, const Replacement& constant ); + void CreateRenderTask( const std::string &name ); /** * @copydoc Toolkit::Builder::GetFrameBufferImage @@ -183,6 +196,33 @@ public: * @copydoc Toolkit::Builder::GetPath */ Path GetPath( const std::string &name ); + + /** + * @copydoc Toolkit::Builder::GetPathConstrainer + */ + Dali::PathConstrainer GetPathConstrainer( const std::string& name ); + + /* + * Check if a given constrainer is of type PathConstrainer + * @param[in] name The name of the constrainer + * @return True if constainer is of type PathConstrainer, False otherwise + * + */ + bool IsPathConstrainer( const std::string& name ); + + /** + * @copydoc Toolkit::Builder::GetLinearConstrainer + */ + Dali::LinearConstrainer GetLinearConstrainer( const std::string& name ); + + /* + * Check if a given constrainer is of type LinearConstrainer + * @param[in] name The name of the constrainer + * @return True if constainer is of type LinearConstrainer, False otherwise + * + */ + bool IsLinearConstrainer( const std::string& name ); + /** * @copydoc Toolkit::Builder::QuitSignal */ @@ -193,56 +233,151 @@ public: */ void EmitQuitSignal(); + protected: virtual ~Builder(); private: - // Undefined - Builder(const Builder&); - Builder& operator=(const Builder& rhs); - - void SetupTask( RenderTask& task, const Toolkit::TreeNode& node, const Replacement& replacement ); - -private: - Toolkit::JsonParser mParser; - - typedef std::map ImageLut; - ImageLut mFrameBufferImageLut; - - typedef std::map ShaderEffectLut; - ShaderEffectLut mShaderEffectLut; - + typedef std::vector KeyStack; + typedef std::vector< TreeNode::KeyNodePair > MappingsLut; + typedef struct{ std::string name; Dali::LinearConstrainer linearConstrainer; } LinearConstrainerEntry; + typedef std::vector LinearConstrainerLut; + typedef struct{ std::string name; Dali::PathConstrainer pathConstrainer; } PathConstrainerEntry; + typedef std::vector PathConstrainerLut; typedef std::map PathLut; - PathLut mPathLut; - - SlotDelegate mSlotDelegate; - - Property::Map mReplacementMap; + typedef std::map ImageLut; - BaseHandle Create( const std::string& templateName, const Replacement& constant ); +private: + // Undefined + Builder(const Builder&); - BaseHandle DoCreate( const TreeNode& root, const TreeNode& node, Actor parent, const Replacement& replacements ); + // Undefined + Builder& operator=(const Builder& rhs); void LoadConstants( const TreeNode& root, Property::Map& intoMap ); - void LoadIncludes( const std::string& data ); - - bool ApplyStyle( const std::string& styleName, Handle& handle, const Replacement& replacement); + Animation CreateAnimation( const std::string& animationName, + const Replacement& replacement, + Dali::Actor sourceActor ); + + BaseHandle Create( const std::string& templateName, + const Replacement& constant ); + + BaseHandle DoCreate( const TreeNode& root, + const TreeNode& node, + Actor parent, + const Replacement& replacements ); + + void SetupTask( RenderTask& task, + const Toolkit::TreeNode& node, + const Replacement& replacement ); + + bool ApplyStyle( const std::string& styleName, + Handle& handle, + const Replacement& replacement); + + void ApplyAllStyleProperties( const TreeNode& root, + const TreeNode& node, + Dali::Handle& handle, + const Replacement& constant ); + + void RecordStyles( const char* styleName, + const TreeNode& node, + Dali::Handle& handle, + const Replacement& replacements ); + + void RecordStyle( StylePtr style, + const TreeNode& node, + Dali::Handle& handle, + const Replacement& replacements ); + + void ApplyProperties( const TreeNode& root, + const TreeNode& node, + Dali::Handle& handle, + const Replacement& constant ); + + void ApplySignals( const TreeNode& root, + const TreeNode& node, + Dali::Handle& handle ); + + void ApplyStylesByActor( const TreeNode& root, + const TreeNode& node, + Dali::Handle& handle, + const Replacement& constant ); + + void SetProperties( const TreeNode& node, + Handle& handle, + const Replacement& constant ); + + bool MapToTargetProperty( Handle& propertyObject, + const std::string& key, + const TreeNode& node, + const Replacement& constant, + Property::Index& index, + Property::Value& value ); - Animation CreateAnimation( const std::string& animationName, const Replacement& replacement, Dali::Actor sourceActor ); + /** + * Find the key in the mapping table, if it's present, then generate + * a property value for it (of the given type if available), + * recursing as necessary, and stopping if any cycles are detected. + * + * @param[in] mappingRoot The JSON node containing the mappings + * @param[in] theKey The key to search for + * @param[in] propertyType The property type if known, or NONE + * @param[in,out] value The string value to test and write back to. + */ + bool GetPropertyMap( const TreeNode& mappingRoot, + const char* theKey, + Property::Type propertyType, + Property::Value& value ); - void ApplyProperties( const TreeNode& root, const TreeNode& node, - Dali::Handle& handle, const Replacement& constant ); + void SetCustomProperties( const TreeNode& node, + Handle& handle, + const Replacement& constant, + const std::string& childName, + Property::AccessMode accessMode ); - void ApplyStylesByActor( const TreeNode& root, const TreeNode& node, - Dali::Handle& handle, const Replacement& constant ); + /** + * Find the key in the mapping table, if it's present, then generate + * a property value for it (of the given type if available), + * recursing as necessary, and stopping if any cycles are detected. + * + * @param[in] mappingRoot The JSON node containing the mappings + * @param[in] theKey The key to search for + * @param[in,out] keyStack the stack of visited keys + * @param[in] propertyType The property type if known, or NONE + * @param[in,out] value The string value to test and write back to. + */ + bool RecursePropertyMap( const TreeNode& mappingRoot, + KeyStack& keyStack, + const char* theKey, + Property::Type propertyType, + Property::Value& value ); - void ApplyAllStyleProperties( const TreeNode& root, const TreeNode& node, - Dali::Handle& handle, const Replacement& constant ); - void SetProperties( const TreeNode& node, Handle& handle, const Replacement& constant ); + /** + * Tests if the value is a string delimited by <>. If it is, then it attempts to + * change the value to the mapping from a matching key in the mappings table. + * @param[in] mappingRoot The JSON node containing the mappings + * @param[in,out] keyStack the stack of visited keys + * @param[in,out] value The string value to test and write back to. + * @return true if the value was converted, false otherwise. + */ + bool ConvertChildValue( const TreeNode& mappingRoot, + KeyStack& keyStack, + Property::Value& value ); +private: + Toolkit::JsonParser mParser; + ImageLut mFrameBufferImageLut; + PathLut mPathLut; + PathConstrainerLut mPathConstrainerLut; + LinearConstrainerLut mLinearConstrainerLut; + SlotDelegate mSlotDelegate; + Property::Map mReplacementMap; + MappingsLut mCompleteMappings; + Dictionary mStyles; // State based styles Toolkit::Builder::BuilderSignalType mQuitSignal; };