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