8d47e360348293f8831da29f2d6fcb99651d5c4c
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / controls / renderer-factory / control-renderer.h
1 #ifndef __DALI_TOOLKIT_CONTROL_RENDERER_H__
2 #define __DALI_TOOLKIT_CONTROL_RENDERER_H__
3 /*
4  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
5  *
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
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  *
18  */
19
20 // EXTERNAL INCLUDES
21 #include <dali/public-api/object/base-handle.h>
22 #include <dali/public-api/actors/actor.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace Internal DALI_INTERNAL
31 {
32 class ControlRenderer;
33 }
34
35 /**
36  * ControlRenderer provides renderer for rendering the controls. A control may have multiple ControlRenders.
37  * ControlRenderers reuses geometry, shader etc. across controls and manages the renderer and material to exist only when control is on-stage.
38  * It also responds to actor size and color change, and provides the clipping at the renderer level.
39  * Note: The control renderer responds to the the Actor::COLOR by blending it with the 'Multiply' operator.
40  */
41 class DALI_IMPORT_API ControlRenderer : public BaseHandle
42 {
43 public:
44
45   /**
46    * @brief Create an empty ControlRenderer Handle
47    */
48   ControlRenderer();
49
50   /**
51    * @brief Destructor
52    *
53    * This is non-virtual since derived Handle types must not contain data or virtual methods.
54    */
55   ~ControlRenderer();
56
57   /**
58    * @brief This copy constructor is required for (smart) pointer semantics.
59    *
60    * @param[in] handle A reference to the copied handle.
61    */
62   ControlRenderer( const ControlRenderer& handle );
63
64   /**
65    * @brief This assignment operator is required for (smart) pointer semantics.
66    *
67    * @param [in] handle  A reference to the copied handle.
68    * @return A reference to this.
69    */
70   ControlRenderer& operator=( const ControlRenderer& handle );
71
72   /**
73    * Set the size of the painting area.
74    *
75    * @param[in] size The size of the painting area.
76    */
77   void SetSize( const Vector2& size );
78
79   /**
80    * Set the clip rectangular of this renderer.
81    * The contents of the renderer will not be visible outside this rectangular.
82    *
83    * @param [in] clipRect The clipping rectangular.
84    */
85   void SetClipRect( const Rect<int>& clipRect );
86
87   /**
88    * Reposition this renderer with a 2D offset.
89    *
90    * @param[in] offset The offset to reposition the renderer.
91    */
92   void SetOffset( const Vector2& offset );
93
94   /**
95    * Set the depth index of this renderer.
96    * Depth-index controls draw-order for overlapping renderers.
97    * Renderer with higher depth indices are rendered in front of other renderer with smaller values
98    *
99    * @param[in] depthIndex The depth index of this renderer.
100    */
101   void SetDepthIndex( float index );
102
103   /**
104    * Renderer only exists when control is on stage.
105    * This function should be called when the control put on stage.
106    *
107    * @param[in] actor The actor applying this renderer.
108    */
109   void SetOnStage( Actor& actor );
110
111   /**
112    * Renderer is destroyed when control is off stage.
113    * This function should be called when the control removes from stage
114    *
115    * @param[in] actor The actor applying this renderer.
116    */
117   void SetOffStage( Actor& actor );
118
119 public: // Not intended for application developers
120
121   explicit DALI_INTERNAL ControlRenderer(Internal::ControlRenderer *impl);
122
123 };
124
125 } // namespace Toolkit
126
127 } // namespace Dali
128
129 #endif /*__DALI_TOOLKIT_CONTROL_RENDERER_H__*/