(Control base)Use RendererFactory&ControlRenderer to handle background
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / renderers / color / color-renderer.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_COLOR_RENDERER_H__
2 #define __DALI_TOOLKIT_INTERNAL_COLOR_RENDERER_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/internal/controls/renderers/control-renderer-impl.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace Internal
31 {
32
33 /**
34  * The renderer which renders a solid color to the control's quad
35  *
36  * The following properties are required for create a ColorRender
37  *
38  * | %Property Name   | Type        |
39  * |------------------|-------------|
40  * | blend-color      | VECTOR4     |
41  */
42 class ColorRenderer: public ControlRenderer
43 {
44 public:
45
46   /**
47    * @brief Constructor.
48    */
49   ColorRenderer();
50
51   /**
52    * @brief A reference counted object may only be deleted by calling Unreference().
53    */
54   virtual ~ColorRenderer();
55
56 public:  // from ControlRenderer
57
58   /**
59    * @copydoc ControlRenderer::Initialize
60    */
61   virtual void Initialize( RendererFactoryCache& factoryCache, const Property::Map& propertyMap );
62
63   /**
64    * @copydoc ControlRenderer::SetSize
65    */
66   virtual void SetSize( const Vector2& size );
67
68   /**
69    * @copydoc ControlRenderer::SetClipRect
70    */
71   virtual void SetClipRect( const Rect<int>& clipRect );
72
73   /**
74    * @copydoc ControlRenderer::SetOffset
75    */
76   virtual void SetOffset( const Vector2& offset );
77
78 protected:
79   /**
80    * @copydoc ControlRenderer::DoSetOnStage
81    */
82   virtual void DoSetOnStage( Actor& actor );
83
84 public:
85
86   /**
87    * Request the geometry and shader from the cache, if not available, create and save to the cache for sharing.
88    *
89    * @param[in] factoryCache A pointer pointing to the RendererFactoryCache object
90    */
91   void Initialize( RendererFactoryCache& factoryCache );
92
93   /**
94    * Set the color for rendering.
95    * @param[in] color The color to be rendered.
96    */
97   void SetColor( const Vector4& color );
98
99 private:
100
101   // Undefined
102   ColorRenderer( const ColorRenderer& colorRenderer );
103
104   // Undefined
105   ColorRenderer& operator=( const ColorRenderer& colorRenderer );
106
107 private:
108
109   Vector4 mBlendColor;
110   Property::Index mBlendColorIndex;
111
112 };
113
114 } // namespace Internal
115
116 } // namespace Toolkit
117
118 } // namespace Dali
119
120 #endif /* __DALI_TOOLKIT_INTERNAL_COLOR_RENDERER_H__ */