Cleaning up Visual::Base
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / color / color-visual.h
1 #ifndef DALI_TOOLKIT_INTERNAL_COLOR_VISUAL_H
2 #define DALI_TOOLKIT_INTERNAL_COLOR_VISUAL_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/visuals/visual-base-impl.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace Internal
31 {
32
33 /**
34  * The visual 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::Base
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::CreatePropertyMap
67    */
68   virtual void DoCreatePropertyMap( Property::Map& map ) const;
69
70 protected:
71
72   /**
73    * @copydoc Visual::DoInitialize
74    */
75   virtual void DoInitialize( Actor& actor, const Property::Map& propertyMap );
76
77   /**
78    * @copydoc Visual::DoSetOnStage
79    */
80   virtual void DoSetOnStage( Actor& actor );
81
82 public:
83
84   /**
85    * Set the color for rendering.
86    * @param[in] color The color to be rendered.
87    */
88   void SetColor( const Vector4& color );
89
90 private:
91   /**
92    * @brief Initialize the renderer with the geometry and shader from the cache, if not available, create and save to the cache for sharing.
93    */
94   void InitializeRenderer();
95
96 private:
97
98   // Undefined
99   ColorVisual( const ColorVisual& colorRenderer );
100
101   // Undefined
102   ColorVisual& operator=( const ColorVisual& colorRenderer );
103
104 private:
105
106   Vector4 mMixColor;
107   Property::Index mMixColorIndex;
108
109 };
110
111 } // namespace Internal
112
113 } // namespace Toolkit
114
115 } // namespace Dali
116
117 #endif /* DALI_TOOLKIT_INTERNAL_COLOR_VISUAL_H */