Rename of Control Renderers to Visuals
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / renderers / color / color-visual.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/visual-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  * | mixColor        | VECTOR4     |
41  */
42 class ColorVisual: public Visual
43 {
44 public:
45
46   /**
47    * @brief Constructor.
48    *
49    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
50    */
51   ColorVisual( VisualFactoryCache& factoryCache );
52
53   /**
54    * @brief A reference counted object may only be deleted by calling Unreference().
55    */
56   virtual ~ColorVisual();
57
58 public:  // from Visual
59
60   /**
61    * @copydoc Visual::SetSize
62    */
63   virtual void SetSize( const Vector2& size );
64
65   /**
66    * @copydoc Visual::SetClipRect
67    */
68   virtual void SetClipRect( const Rect<int>& clipRect );
69
70   /**
71    * @copydoc Visual::SetOffset
72    */
73   virtual void SetOffset( const Vector2& offset );
74
75   /**
76    * @copydoc Visual::CreatePropertyMap
77    */
78   virtual void DoCreatePropertyMap( Property::Map& map ) const;
79
80 protected:
81
82   /**
83    * @copydoc Visual::DoInitialize
84    */
85   virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
86
87   /**
88    * @copydoc Visual::DoSetOnStage
89    */
90   virtual void DoSetOnStage( Actor& actor );
91
92 public:
93
94   /**
95    * Set the color for rendering.
96    * @param[in] color The color to be rendered.
97    */
98   void SetColor( const Vector4& color );
99
100 private:
101   /**
102    * @brief Initialize the renderer with the geometry and shader from the cache, if not available, create and save to the cache for sharing.
103    */
104   void InitializeRenderer();
105
106 private:
107
108   // Undefined
109   ColorVisual( const ColorVisual& colorRenderer );
110
111   // Undefined
112   ColorVisual& operator=( const ColorVisual& colorRenderer );
113
114 private:
115
116   Vector4 mMixColor;
117   Property::Index mMixColorIndex;
118
119 };
120
121 } // namespace Internal
122
123 } // namespace Toolkit
124
125 } // namespace Dali
126
127 #endif /* __DALI_TOOLKIT_INTERNAL_COLOR_RENDERER_H__ */