[dali_2.3.25] Merge branch 'devel/master'
[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) 2022 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 <dali/public-api/math/vector4.h>
23 #include <dali/public-api/object/base-handle.h>
24 #include <string>
25
26 // INTERNAL INCLUDES
27 #include <dali/public-api/dali-adaptor-common.h>
28
29 namespace Dali
30 {
31 namespace Internal DALI_INTERNAL
32 {
33 namespace Adaptor
34 {
35 class ColorController;
36 }
37
38 } // namespace DALI_INTERNAL
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    * @brief Create an uninitialized ColorController handle.
50    */
51   ColorController();
52
53   /**
54    * @brief Creates a copy of the handle.
55    *
56    * The copy will point to the same implementation as the original.
57    * @param[in]  colorController  The Color Controller to copy from.
58    */
59   ColorController(const ColorController& colorController);
60
61   /**
62    * @brief This assignment operator is required for (smart) pointer semantics.
63    *
64    * @param [in] rhs  A reference to the copied handle
65    * @return A reference to this
66    */
67   ColorController& operator=(const ColorController& rhs);
68
69   /**
70    * @brief Creates a move of the handle.
71    *
72    * The move will point to the same implementation as the original.
73    * @param[in]  colorController  The Color Controller to move from.
74    */
75   ColorController(ColorController&& colorController);
76
77   /**
78    * @brief This move assignment operator is required for (smart) pointer semantics.
79    *
80    * @param [in] rhs  A reference to the moved handle
81    * @return A reference to this
82    */
83   ColorController& operator=(ColorController&& rhs);
84
85   /**
86    * @brief Retrieve the initialized instance of the ColorController.
87    *
88    * @return Handle to ColorController.
89    */
90   static ColorController Get();
91
92   /**
93    * @brief Destructor
94    *
95    * This is non-virtual since derived Handle types must not contain data or virtual methods.
96    */
97   ~ColorController();
98
99   /**
100    * @brief Retrieve the RGBA value by given the color code.
101    *
102    * @param[in] colorCode The color code string.
103    * @param[out] colorValue The RGBA color
104    * @return true if the color code exists, otherwise false
105    */
106   bool RetrieveColor(const std::string& colorCode, Vector4& colorValue);
107
108   /**
109     * @brief Retrieve the RGBA values by given the color code.
110     *
111     * @param[in] colorCode The color code string.
112     * @param[out] textColor The text color.
113     * @param[out] textOutlineColor The text outline color.
114     * @param[out] textShadowColor The text shadow color.
115     * @return true if the color code exists, otherwise false
116     */
117   bool RetrieveColor(const std::string& colorCode, Vector4& textColor, Vector4& textOutlineColor, Vector4& textShadowColor);
118
119 public: // Not intended for application developers
120   /**
121    * @brief This constructor is used internally to create a handle from an object pointer.
122    * @param [in] colorController A pointer the internal color controller.
123    */
124   explicit DALI_INTERNAL ColorController(Internal::Adaptor::ColorController* colorController);
125 };
126
127 } //namespace Dali
128
129 #endif // DALI_COLOR_CONTROLLER_H