1 #ifndef __DALI_TOOLKIT_INTERNAL_BUILDER_H__
2 #define __DALI_TOOLKIT_INTERNAL_BUILDER_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://floralicense.org/license/
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
24 #include <boost/property_tree/ptree.hpp>
25 #include <dali/dali.h>
26 #include <dali/integration-api/debug.h>
29 #include <dali-toolkit/public-api/builder/json-parser.h>
30 #include <dali-toolkit/public-api/builder/builder.h>
32 // Warning messages usually displayed
33 #define DALI_SCRIPT_WARNING(format, args...) \
34 DALI_LOG_WARNING("Script:" format, ## args)
36 // Info messages are usually debug build
37 #define DALI_SCRIPT_INFO(format, args...) \
38 DALI_LOG_INFO(Dali::Toolkit::Internal::gFilterScript, Debug::General, "Script:" format, ## args)
40 // Info Verbose need to be swiched on in gFilterScript filter constructor (by default set to General)
41 #define DALI_SCRIPT_VERBOSE(format, args...) \
42 DALI_LOG_INFO(Dali::Toolkit::Internal::gFilterScript, Debug::Verbose, "Script:" format, ## args)
58 #if defined(DEBUG_ENABLED)
59 extern Dali::Integration::Log::Filter* gFilterScript;
65 * @copydoc Toolkit::Builder
67 class Builder : public Dali::BaseObject
74 * @copydoc Toolkit::Builder::LoadFromString
76 void LoadFromString( const std::string &data,
77 Dali::Toolkit::Builder::UIFormat rep = Dali::Toolkit::Builder::JSON );
80 * @copydoc Toolkit::Builder::CreateAnimation
82 Animation CreateAnimation( const std::string& animationName );
85 * @copydoc Toolkit::Builder::CreateFromStyle
87 BaseHandle CreateFromStyle( const std::string& styleName );
90 * @copydoc Toolkit::Builder::GetFont
92 Font GetFont(const std::string &name) const;
95 * @copydoc Toolkit::Builder::GetTextStyle
97 TextStyle GetTextStyle(const std::string &name) const;
100 * @copydoc Toolkit::Builder::GetImage
102 Image GetImage(const std::string &name) const;
105 * @copydoc Toolkit::Builder::GetActor
107 Actor GetActor( const std::string &name ) const;
110 * @copydoc Toolkit::Builder::ApplyStyle
112 void ApplyStyle( const std::string& styleName, Handle& handle );
115 * @copydoc Toolkit::Builder::AddActors
117 void AddActors( Actor toActor );
120 * @copydoc Toolkit::Builder::AddActors
122 void AddActors( const std::string §ionName, Actor toActor );
125 * @copydoc Toolkit::Builder::GetAnimation
127 Animation GetAnimation( const std::string &name ) const;
130 * @copydoc Toolkit::Builder::CreateRenderTask
132 void CreateRenderTask( const std::string &name );
135 * @copydoc Toolkit::Builder::GetShaderEffect
137 ShaderEffect GetShaderEffect( const std::string &name );
140 * @copydoc Toolkit::Builder::GetFrameBufferImage
142 FrameBufferImage GetFrameBufferImage( const std::string &name );
145 * @copydoc Toolkit::Builder::GetTopLevelActors
147 ActorContainer GetTopLevelActors( void ) const;
155 Builder(const Builder&);
156 Builder& operator=(const Builder& rhs);
158 void SetupTask( RenderTask& task, const Toolkit::TreeNode& node );
161 Toolkit::JsonParser mParser;
163 typedef std::map<const std::string, FrameBufferImage> ImageLut;
164 ImageLut mFrameBufferImageLut;
166 typedef std::map<const std::string, ShaderEffect> ShaderEffectLut;
167 ShaderEffectLut mShaderEffectLut;
169 SlotDelegate<Builder> mSlotDelegate;
172 } // namespace Internal
174 inline Internal::Builder& GetImpl(Dali::Toolkit::Builder& obj)
176 DALI_ASSERT_ALWAYS(obj);
178 Dali::BaseObject& handle = obj.GetBaseObject();
180 return static_cast<Internal::Builder&>(handle);
183 inline const Internal::Builder& GetImpl(const Dali::Toolkit::Builder& obj)
185 DALI_ASSERT_ALWAYS(obj);
187 const Dali::BaseObject& handle = obj.GetBaseObject();
189 return static_cast<const Internal::Builder&>(handle);
192 } // namespace Toolkit
196 #endif // __DALI_TOOLKIT_INTERNAL_BUILDER_H__