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=f046504895c2b253eb27206c39051a40c9d89af2;hp=ba52c089f62066d261afea32974b5bc1190b0e63;hb=957e21ff67b0680b79b8532db4ea310c43eef770;hpb=e2eda444afbe82e9591fe198eef339227f90a616 diff --git a/dali-toolkit/internal/builder/builder-impl.h b/dali-toolkit/internal/builder/builder-impl.h index ba52c08..f046504 100644 --- a/dali-toolkit/internal/builder/builder-impl.h +++ b/dali-toolkit/internal/builder/builder-impl.h @@ -1,33 +1,38 @@ #ifndef __DALI_TOOLKIT_INTERNAL_BUILDER_H__ #define __DALI_TOOLKIT_INTERNAL_BUILDER_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. -// +/* + * Copyright (c) 2014 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. + * + */ // EXTERNAL INCLUDES #include #include #include -#include -#include +#include +#include +#include +#include +#include #include // INTERNAL INCLUDES -#include -#include +#include +#include +#include // Warning messages usually displayed #define DALI_SCRIPT_WARNING(format, args...) \ @@ -60,6 +65,7 @@ extern Dali::Integration::Log::Filter* gFilterScript; #endif class Builder; +class Replacement; /** * @copydoc Toolkit::Builder @@ -77,39 +83,69 @@ public: Dali::Toolkit::Builder::UIFormat rep = Dali::Toolkit::Builder::JSON ); /** - * @copydoc Toolkit::Builder::CreateAnimation + * @copydoc Toolkit::Builder::AddConstants + */ + void AddConstants( const Property::Map& map ); + + /** + * @copydoc Toolkit::Builder::AddConstant + */ + void AddConstant( const std::string& key, const Property::Value& value ); + + /** + * @copydoc Toolkit::Builder::GetConstants + */ + const Property::Map& GetConstants() const; + + /** + * @copydoc Toolkit::Builder::GetConstant + */ + const Property::Value& GetConstant( const std::string& key ) const; + + /** + * @copydoc Toolkit::Builder::CreateAnimation( const std::string& animationName ); */ Animation CreateAnimation( const std::string& animationName ); /** - * @copydoc Toolkit::Builder::CreateFromStyle + * @copydoc Toolkit::Builder::CreateAnimation( const std::string& animationName, const Property::Map& map ); + */ + Animation CreateAnimation( const std::string& animationName, const Property::Map& map ); + + /** + * @copydoc Toolkit::Builder::CreateAnimation( const std::string&,Dali::Actor); */ - BaseHandle CreateFromStyle( const std::string& styleName ); + Animation CreateAnimation( const std::string& animationName, Dali::Actor sourceActor ); /** - * @copydoc Toolkit::Builder::GetFont + * @copydoc Toolkit::Builder::CreateAnimation( const std::string&,const Property::Map&, Dali::Actor); */ - Font GetFont(const std::string &name) const; + Animation CreateAnimation( const std::string& animationName, const Property::Map& map, Dali::Actor sourceActor ); /** - * @copydoc Toolkit::Builder::GetTextStyle + * @copydoc Toolkit::Builder::Create( const std::string& templateName ); */ - TextStyle GetTextStyle(const std::string &name) const; + BaseHandle Create( const std::string& templateName ); /** - * @copydoc Toolkit::Builder::GetImage + * @copydoc Toolkit::Builder::Create( const std::string& templateName, const Property::Map& map ); */ - Image GetImage(const std::string &name) const; + BaseHandle Create( const std::string& templateName, const Property::Map& map ); /** - * @copydoc Toolkit::Builder::GetActor + * @copydoc Toolkit::Builder::CreateFromJson( const std::string& json ); */ - Actor GetActor( const std::string &name ) const; + BaseHandle CreateFromJson( const std::string& json ); + + /** + * @copydoc Toolkit::Builder::ApplyFromJson( Handle& handle, const std::string& json ); + */ + bool ApplyFromJson( Handle& handle, const std::string& json ); /** * @copydoc Toolkit::Builder::ApplyStyle */ - void ApplyStyle( const std::string& styleName, Handle& handle ); + bool ApplyStyle( const std::string& styleName, Handle& handle ); /** * @copydoc Toolkit::Builder::AddActors @@ -122,11 +158,6 @@ public: void AddActors( const std::string §ionName, Actor toActor ); /** - * @copydoc Toolkit::Builder::GetAnimation - */ - Animation GetAnimation( const std::string &name ) const; - - /** * @copydoc Toolkit::Builder::CreateRenderTask */ void CreateRenderTask( const std::string &name ); @@ -137,14 +168,60 @@ public: ShaderEffect GetShaderEffect( const std::string &name ); /** + * @copydoc Toolkit::Builder::GetShaderEffect + */ + ShaderEffect GetShaderEffect( const std::string &name, const Replacement& constant ); + + /** * @copydoc Toolkit::Builder::GetFrameBufferImage */ FrameBufferImage GetFrameBufferImage( const std::string &name ); /** - * @copydoc Toolkit::Builder::GetTopLevelActors + * @copydoc Toolkit::Builder::GetFrameBufferImage */ - ActorContainer GetTopLevelActors( void ) const; + FrameBufferImage GetFrameBufferImage( const std::string &name, const Replacement& constant ); + + /** + * @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 + */ + Toolkit::Builder::BuilderSignalType& QuitSignal(); + + /** + * Emits the quit signal + */ + void EmitQuitSignal(); protected: @@ -155,7 +232,7 @@ private: Builder(const Builder&); Builder& operator=(const Builder& rhs); - void SetupTask( RenderTask& task, const Toolkit::TreeNode& node ); + void SetupTask( RenderTask& task, const Toolkit::TreeNode& node, const Replacement& replacement ); private: Toolkit::JsonParser mParser; @@ -166,7 +243,45 @@ private: typedef std::map ShaderEffectLut; ShaderEffectLut mShaderEffectLut; + typedef std::map PathLut; + PathLut mPathLut; + + typedef struct{ std::string name; Dali::PathConstrainer pathConstrainer; } PathConstrainerEntry; + typedef std::vector PathConstrainerLut; + PathConstrainerLut mPathConstrainerLut; + + typedef struct{ std::string name; Dali::LinearConstrainer linearConstrainer; } LinearConstrainerEntry; + typedef std::vector LinearConstrainerLut; + LinearConstrainerLut mLinearConstrainerLut; + SlotDelegate mSlotDelegate; + + Property::Map mReplacementMap; + + BaseHandle Create( const std::string& templateName, const Replacement& constant ); + + BaseHandle DoCreate( const TreeNode& root, const TreeNode& node, Actor parent, const Replacement& replacements ); + + 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 ); + + void ApplyProperties( const TreeNode& root, const TreeNode& node, + Dali::Handle& handle, const Replacement& constant ); + + void ApplyStylesByActor( const TreeNode& root, const TreeNode& node, + Dali::Handle& handle, const Replacement& constant ); + + void ApplyAllStyleProperties( const TreeNode& root, const TreeNode& node, + Dali::Handle& handle, const Replacement& constant ); + + void SetProperties( const TreeNode& node, Handle& handle, const Replacement& constant ); + + Toolkit::Builder::BuilderSignalType mQuitSignal; }; } // namespace Internal