1 #ifndef __DALI_TOOLKIT_CONTROL_RENDERER_H__
2 #define __DALI_TOOLKIT_CONTROL_RENDERER_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>
22 #include <dali/public-api/actors/actor.h>
30 namespace Internal DALI_INTERNAL
32 class ControlRenderer;
36 * @brief ControlRenderer provides renderer for rendering the controls. A control may have multiple ControlRenders.
38 * ControlRenderers reuses geometry, shader etc. across controls and manages the renderer and material to exist only when control is on-stage.
39 * It also responds to actor size and color change, and provides the clipping at the renderer level.
40 * Note: The control renderer responds to the the Actor::COLOR by blending it with the 'Multiply' operator.
42 class DALI_IMPORT_API ControlRenderer : public BaseHandle
47 * @brief Create an empty ControlRenderer Handle
54 * This is non-virtual since derived Handle types must not contain data or virtual methods.
59 * @brief This copy constructor is required for (smart) pointer semantics.
61 * @param[in] handle A reference to the copied handle.
63 ControlRenderer( const ControlRenderer& handle );
66 * @brief This assignment operator is required for (smart) pointer semantics.
68 * @param [in] handle A reference to the copied handle.
69 * @return A reference to this.
71 ControlRenderer& operator=( const ControlRenderer& handle );
74 * @brief Set the size of the painting area.
76 * @param[in] size The size of the painting area.
78 void SetSize( const Vector2& size );
81 * @brief Get the size of the painting area.
83 * @return The size of the renderer's painting area.
85 const Vector2& GetSize() const;
88 * @brief Return the natural size of the renderer.
90 * Deriving classes stipulate the natural size and by default a renderer has a ZERO natural size.
92 * @param[out] naturalSize The renderer's natural size
94 void GetNaturalSize( Vector2& naturalSize ) const;
97 * @brief Set the depth index of this renderer.
99 * Depth-index controls draw-order for overlapping renderers.
100 * Renderer with higher depth indices are rendered in front of other renderer with smaller values
102 * @param[in] depthIndex The depth index of this renderer.
104 void SetDepthIndex( float index );
107 * @brief Get the depth index of this renderer
109 * @return The depth index of this renderer.
111 float GetDepthIndex() const;
114 * @brief Renderer only exists when control is on stage.
116 * This function should be called when the control put on stage.
118 * @param[in] actor The actor applying this renderer.
120 void SetOnStage( Actor& actor );
123 * @brief Renderer is destroyed when control is off stage.
125 * This function should be called when the control removes from stage
127 * @param[in] actor The actor applying this renderer.
129 void SetOffStage( Actor& actor );
132 * @brief Remove the renderer from actor and reset the control renderer self.
134 * This function can be called with an empty handle. If the control renderer is empty, do nothing.
136 * @param[in] actor The actor to be set off stage.
138 void RemoveAndReset( Actor& actor );
141 * @brief Create the property map representing this renderer.
143 * @param[out] map The renderer property map.
145 void CreatePropertyMap( Property::Map& map ) const;
147 public: // Not intended for application developers
149 explicit DALI_INTERNAL ControlRenderer(Internal::ControlRenderer *impl);
153 } // namespace Toolkit
157 #endif /*__DALI_TOOLKIT_CONTROL_RENDERER_H__*/