1 #ifndef DALI_TOOLKIT_VISUAL_BASE_H
2 #define DALI_TOOLKIT_VISUAL_BASE_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
41 * @brief Visual provides renderer for rendering the controls. A control may have multiple ControlRenders.
43 * Visuals reuses geometry, shader etc. across controls and manages the renderer and texture sets to exist only when control is on-stage.
44 * It also responds to actor size and color change, and provides the clipping at the renderer level.
45 * Note: The control renderer responds to the the Actor::COLOR by blending it with the 'Multiply' operator.
47 class DALI_IMPORT_API Base : public BaseHandle
52 * @brief Create an empty Visual Handle
59 * This is non-virtual since derived Handle types must not contain data or virtual methods.
64 * @brief This copy constructor is required for (smart) pointer semantics.
66 * @param[in] handle A reference to the copied handle.
68 Base( const Base& handle );
71 * @brief This assignment operator is required for (smart) pointer semantics.
73 * @param [in] handle A reference to the copied handle.
74 * @return A reference to this.
76 Base& operator=( const Base& handle );
79 * @brief Set the size of the painting area.
81 * @param[in] size The size of the painting area.
83 void SetSize( const Vector2& size );
86 * @brief Get the size of the painting area.
88 * @return The size of the renderer's painting area.
90 const Vector2& GetSize() const;
93 * @brief Return the natural size of the renderer.
95 * Deriving classes stipulate the natural size and by default a renderer has a ZERO natural size.
97 * @param[out] naturalSize The renderer's natural size
99 void GetNaturalSize( Vector2& naturalSize ) const;
102 * @brief Set the depth index of this visual.
104 * Depth-index controls draw-order for overlapping visuals.
105 * Renderer with higher depth indices are rendered in front of other renderer with smaller values
107 * @param[in] index The depth index of this visual.
109 void SetDepthIndex( float index );
112 * @brief Get the depth index of this renderer
114 * @return The depth index of this renderer.
116 float GetDepthIndex() const;
119 * @brief Renderer only exists when control is on stage.
121 * This function should be called when the control put on stage.
123 * @param[in] actor The actor applying this renderer.
124 * @post SetOffStage should be called with the same actor when the control is put off stage otherwise memory will be leaked
126 void SetOnStage( Actor& actor );
129 * @brief Renderer is destroyed when control is off stage.
131 * This function should be called when the control removes from stage
133 * @param[in] actor The actor applying this renderer.
135 void SetOffStage( Actor& actor );
138 * @brief Remove the renderer from actor and reset the control renderer self.
140 * This function can be called with an empty handle. If the control renderer is empty, do nothing.
142 * @param[in] actor The actor to be set off stage.
144 void RemoveAndReset( Actor& actor );
147 * @brief Create the property map representing this renderer.
149 * @param[out] map The renderer property map.
151 void CreatePropertyMap( Property::Map& map ) const;
153 public: // Not intended for application developers
155 explicit DALI_INTERNAL Base(Internal::Visual::Base *impl);
159 } // namespace Visual
161 } // namespace Toolkit
165 #endif /*DALI_TOOLKIT_VISUAL_BASE_H*/