1 #ifndef __DALI_TOOLKIT_INTERNAL_CONTROL_RENDERER_H__
2 #define __DALI_TOOLKIT_INTERNAL_CONTROL_RENDERER_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
23 #include <dali/public-api/object/base-object.h>
25 #include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
26 #include <dali-toolkit/devel-api/controls/renderer-factory/control-renderer.h>
37 class RendererFactoryCache;
40 * Base class for all Control rendering logic. A control may have multiple control renderers.
42 * Note: The control renderer responds to the the Actor::COLOR by blending it with the 'Multiply' operator.
44 class ControlRenderer : public BaseObject
49 * Initialisation of the renderer, this API should only called by the RendererFactory:
50 * request the geometry and shader from the cache, if not available, create and save to the cache for sharing;
51 * record the property values.
53 * @param[in] factoryCache A pointer pointing to the RendererFactoryCache object
54 * @param[in] propertyMap The properties for the requested ControlRenderer object.
56 virtual void Initialize( RendererFactoryCache& factoryCache, const Property::Map& propertyMap ) = 0;
59 * @copydoc Toolkit::ControlRenderer::SetSize
61 virtual void SetSize( const Vector2& size );
64 * ToDo: Add this function to Toolkit::ControlRenderer when it is fully implemented.
66 * Set the clip rectangular of this renderer.
67 * The contents of the renderer will not be visible outside this rectangular.
69 * @param [in] clipRect The clipping rectangular.
71 virtual void SetClipRect( const Rect<int>& clipRect );
74 *ToDo: Add this function to Toolkit::ControlRenderer when it is fully implemented.
76 * Reposition this renderer with a 2D offset.
78 * @param[in] offset The offset to reposition the renderer.
80 virtual void SetOffset( const Vector2& offset );
83 * @copydoc Toolkit::ControlRenderer::SetDepthIndex
85 void SetDepthIndex( float index );
88 * @copydoc Toolkit::ControlRenderer::SetOnStage
90 virtual void SetOnStage( Actor& actor );
93 * ToDo: Add this function to Toolkit::ControlRenderer when the Renderer can be removed from actor properly.
95 * Renderer is destroyed when control is off stage.
96 * This function should be called when the control removes from stage
98 * @param[in] actor The actor applying this renderer.
100 void SetOffStage( Actor& actor );
105 * @brief Constructor.
110 * @brief A reference counted object may only be deleted by calling Unreference().
112 virtual ~ControlRenderer();
117 ControlRenderer( const ControlRenderer& renderer );
120 ControlRenderer& operator=( const ControlRenderer& renderer );
128 } // namespace Internal
130 inline const Internal::ControlRenderer& GetImplementation(const Toolkit::ControlRenderer& renderer)
132 DALI_ASSERT_ALWAYS( renderer && "ControlRenderer handle is empty" );
134 const BaseObject& handle = renderer.GetBaseObject();
136 return static_cast<const Internal::ControlRenderer&>(handle);
139 inline Internal::ControlRenderer& GetImplementation(Toolkit::ControlRenderer& renderer)
141 DALI_ASSERT_ALWAYS( renderer && "ControlRenderer handle is empty" );
143 BaseObject& handle = renderer.GetBaseObject();
145 return static_cast<Internal::ControlRenderer&>(handle);
148 } // namespace Toolkit
152 #endif /* __DALI_TOOLKIT_INTERNAL_CONTROL_RENDERER_H___ */