Optimization to reduce Handle size by 50%
[platform/core/uifw/dali-adaptor.git] / adaptors / tizen / public-api / adaptor-framework / common / color-controller.h
1 #ifndef __DALI_COLOR_CONTROLLER_H__
2 #define __DALI_COLOR_CONTROLLER_H__
3
4 /*
5  * Copyright (c) 2014 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 #include <dali/public-api/object/base-handle.h>
22
23 namespace Dali DALI_IMPORT_API
24 {
25
26 namespace Internal DALI_INTERNAL
27 {
28 namespace Adaptor
29 {
30 class ColorController;
31 }
32 }
33
34 /**
35  * Color controller currently caches the changeable color table which updates with the theme change
36  *
37  * It provides the functionality of retrieving a RGBA color by passing in the color code string.
38  */
39 class ColorController : public BaseHandle
40 {
41 public:
42
43   /**
44    * @brief Create an uninitialized ColorController handle.
45    */
46   ColorController();
47
48   /**
49    * @brief Creates a copy of the handle.
50    *
51    * The copy will point to the same implementation as the original.
52    * @param[in]  colorController  The Color Controller to copy from.
53    */
54   ColorController( const ColorController& colorController);
55
56   /**
57    * @copydoc Dali::BaseHandle::operator=
58    */
59   using BaseHandle::operator=;
60
61   /**
62    * @brief Retrieve the initialized instance of the ColorController.
63    *
64    * @return Handle to ColorController.
65    */
66   static ColorController Get();
67
68   /**
69    * @brief Destructor
70    *
71    * This is non-virtual since derived Handle types must not contain data or virtual methods.
72    */
73   ~ColorController();
74
75   /**
76    * @brief Retrieve the RGB value by given the color code.
77    *
78    * @param[in] colorCode The color code string.
79    * @param[out] colorValue The RGBA color
80    * @return true if the color code exists, otherwise false
81    */
82   bool RetrieveColor( const std::string& colorCode, Vector4& colorValue );
83
84   /**
85     * @brief Retrieve the RGB values by given the color code.
86     *
87     * @param[in] colorCode The color code string.
88     * @param[out] textColor The text color.
89     * @param[out] textOutlineColor The text outline color.
90     * @param[out] textShadowColor The text shadow color.
91     * @return true if the color code exists, otherwise false
92     */
93   bool RetrieveColor( const std::string& colorCode , Vector4& textColor, Vector4& textOutlineColor, Vector4& textShadowColor);
94
95
96 public: // Not intended for application developers
97   /**
98    * @brief This constructor is used internally to create a handle from an object pointer.
99    * @param [in] colorController A pointer the internal color controller.
100    */
101   explicit DALI_INTERNAL ColorController(Internal::Adaptor::ColorController* colorController);
102 };
103
104
105 } //namespace Dali
106
107 #endif /* __DALI_COLOR_CONTROLLER_H__ */