1 #ifndef __DALI_TOOLKIT_RENDERER_FACTORY_H__
2 #define __DALI_TOOLKIT_RENDERER_FACTORY_H__
4 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 #include <dali/public-api/object/base-handle.h>
24 #include <dali-toolkit/devel-api/controls/renderer-factory/control-renderer.h>
34 namespace Internal DALI_INTERNAL
36 class RendererFactory;
40 * @brief RendererFactory is a singleton object that provides and shares renderers for controls
42 * The renderer type is required in the property map for requesting a control renderer.
44 * | %Property Name | Type |
45 * |---------------------------|------------------|
46 * | renderer-type | STRING |
48 class DALI_IMPORT_API RendererFactory : public BaseHandle
53 * @brief Create or retrieve RendererFactory singleton.
55 * @return A handle to the RendererFactory control.
57 static RendererFactory Get();
60 * @brief Create a RendererFactory handle.
62 * Calling member functions with an uninitialised handle is not allowed.
69 * This is non-virtual since derived Handle types must not contain data or virtual methods.
74 * @brief This copy constructor is required for (smart) pointer semantics.
76 * @param[in] handle A reference to the copied handle.
78 RendererFactory( const RendererFactory& handle );
81 * @brief This assignment operator is required for (smart) pointer semantics.
83 * @param [in] handle A reference to the copied handle.
84 * @return A reference to this.
86 RendererFactory& operator=( const RendererFactory& handle );
89 * @brief Request the control renderer
91 * @param[in] propertyMap The map contains the properties required by the control renderer
92 * Depends on the content of the map, different kind of renderer would be returned.
93 * @return The pointer pointing to control renderer
95 ControlRenderer GetControlRenderer( const Property::Map& propertyMap );
98 * @brief Request the control renderer to render the given color
100 * @param[in] color The color to be rendered
101 * @return The pointer pointing to the control renderer
103 ControlRenderer GetControlRenderer( const Vector4& color );
106 * @brief Request the current control renderer to render the given color
108 * if the current renderer is a handle to an internal color renderer, set this color to it,
109 * else the renderer would be a handle to a newly created internal color renderer.
111 * @param[in] renderer The ControlRenderer to reset
112 * @param[in] actor The Actor the renderer is applied to if, empty if the renderer has not been applied to any Actor
113 * @param[in] color The color to be rendered.
115 void ResetRenderer( ControlRenderer& renderer, Actor& actor, const Vector4& color );
118 * @brief Request the control renderer to renderer the border with the given size and color.
120 * @param[in] borderSize The size of the border. Border size is the same along all edges.
121 * @param[in] borderColor The color of the border.
122 * @return The pointer pointing to the control renderer
124 ControlRenderer GetControlRenderer( float borderSize, const Vector4& borderColor );
127 * @brief Request the control renderer to render the image.
129 * @param[in] image The image to be rendered.
130 * @return The pointer pointing to the control renderer
132 ControlRenderer GetControlRenderer( const Image& image );
135 * @brief Request the current control renderer to render the given image
137 * if the current renderer is a handle to an internal image renderer, set this image to it,
138 * else the renderer would be a handle to a newly created internal image renderer.
140 * @param[in] renderer The ControlRenderer to reset
141 * @param[in] actor The Actor the renderer is applied to if, empty if the renderer has not been applied to any Actor
142 * @param[in] image The Image to be rendered.
144 void ResetRenderer( ControlRenderer& renderer, Actor& actor, const Image& image );
147 * @brief Request the control renderer to render the given resource at the url.
149 * @param[in] url The URL to the resource to be rendered.
150 * @return The pointer pointing to the control renderer
152 ControlRenderer GetControlRenderer( const std::string& url );
155 * @brief Request the current control renderer to render the given resource at the url
157 * if the current renderer is a handle to an internal image renderer, set this image to it,
158 * else the renderer would be a handle to a newly created internal image renderer.
160 * @param[in] renderer The ControlRenderer to reset
161 * @param[in] actor The Actor the renderer is applied to if, empty if the renderer has not been applied to any Actor
162 * @param[in] url The URL to the resource to be rendered.
164 void ResetRenderer( ControlRenderer& renderer, Actor& actor, const std::string& url );
168 * @brief Request the current control renderer from the property map, merging the property map with the renderer
170 * if the current renderer is capable of merging with the property map the reset the renderer with the merged properties
171 * else the renderer would be a handle to a newly created internal renderer.
173 * @param[in] renderer The ControlRenderer to reset
174 * @param[in] actor The Actor the renderer is applied to if, empty if the renderer has not been applied to any Actor
175 * @param[in] propertyMap The map contains the properties required by the control renderer
176 * Depends on the content of the map, different kind of renderer would be returned.
178 void ResetRenderer( ControlRenderer& renderer, Actor& actor, const Property::Map& propertyMap );
182 explicit DALI_INTERNAL RendererFactory(Internal::RendererFactory *impl);
186 } // namespace Toolkit
190 #endif /* __DALI_TOOLKIT_RENDERER_FACTORY_H__ */