1 #ifndef DALI_TOOLKIT_INTERNAL_TEXT_EFFECTS_STYLE_H
2 #define DALI_TOOLKIT_INTERNAL_TEXT_EFFECTS_STYLE_H
5 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali-toolkit/internal/text/text-controller.h>
23 #include <dali-toolkit/public-api/text/text-enumerations.h>
24 #include <dali/devel-api/scripting/scripting.h>
32 const Scripting::StringEnum UNDERLINE_TYPE_STRING_TABLE[] =
34 {"solid", Text::Underline::SOLID},
35 {"dashed", Text::Underline::DASHED},
36 {"double", Text::Underline::DOUBLE}};
37 const unsigned int UNDERLINE_TYPE_STRING_TABLE_COUNT = sizeof(UNDERLINE_TYPE_STRING_TABLE) / sizeof(UNDERLINE_TYPE_STRING_TABLE[0]);
42 DEFAULT, ///< The default text effect style.
43 INPUT ///< The input text effect style.
48 * @brief Parses the shadow properties.
50 * @param[in] shadowProperties The map with the shadow properties.
51 * @param[out] colorDefined Whether the shadow's color is defined.
52 * @param[out] color The shadow's color.
53 * @param[out] offsetDefined Whether the shadow's offset is defined.
54 * @param[out] offset The shadow's offset.
56 bool ParseShadowProperties(const Property::Map& shadowProperties,
63 * @brief Parses the underline properties.
65 * @param[in] underlineProperties The map with the underline properties.
66 * @param[out] enabled Whether the underline is enabled.
67 * @param[out] colorDefined Whether the underline's color is defined.
68 * @param[out] color The underline's color.
69 * @param[out] heightDefined Whether the underline's height is defined.
70 * @param[out] height The underline's height.
71 * @param[out] type The underline's type; DASHED, DOUBLE, etc. Default is a solid underline.
72 * @param[out] dashWidth The dashed underline's width.
73 * @param[out] dashGap The dashed underline's gap.
75 bool ParseUnderlineProperties(const Property::Map& underlineProperties,
82 Text::Underline::Type& type,
89 * @brief Parses the outline properties.
91 * @param[in] outlineProperties The map with the outline properties.
92 * @param[out] colorDefined Whether the outline's color is defined.
93 * @param[out] color The outline's color.
94 * @param[out] widthDefined Whether the outline's width is defined.
95 * @param[out] width The outline's width.
97 bool ParseOutlineProperties(const Property::Map& outlineProperties,
101 unsigned int& width);
104 * @brief Parses the background properties.
106 * @param[in] backgroundProperties The map with the background properties.
107 * @param[out] enabled Whether the background is enabled.
108 * @param[out] colorDefined Whether the background color is defined.
109 * @param[out] color The background color.
111 bool ParseBackgroundProperties(const Property::Map& backgroundProperties,
117 * @brief Parses the strikethrough properties.
119 * @param[in] strikethroughProperties The map with the strikethrough properties.
120 * @param[out] enabled Whether the strikethrough is enabled.
121 * @param[out] colorDefined Whether the strikethrough's color is defined.
122 * @param[out] color The strikethrough's color.
123 * @param[out] heightDefined Whether the strikethrough's height is defined.
124 * @param[out] height The strikethrough's height.
126 bool ParseStrikethroughProperties(const Property::Map& strikethroughProperties,
134 * @brief Sets the underline properties.
136 * @param[in] controller The text's controller.
137 * @param[in] value The values of the underline's properties.
138 * @param[in] type Whether the property is for the default underline or the input underline.
140 * @return Whether the underline properties have been updated.
142 bool SetUnderlineProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
145 * @brief Sets the strikethrough properties.
147 * @param[in] controller The text's controller.
148 * @param[in] value The values of the strikethrough's properties.
149 * @param[in] type Whether the property is for the default strikethrough or the input strikethrough.
151 * @return Whether the strikethrough properties have been updated.
153 bool SetStrikethroughProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
156 * @brief Retrieves the underline's properties.
158 * @param[in] controller The text's controller.
159 * @param[out] value The value of the underline's properties.
160 * @param[in] type Whether the property is for the default underline or the input underline.
162 void GetUnderlineProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
165 * @brief Retrieves the strikethrough's properties.
167 * @param[in] controller The text's controller.
168 * @param[out] value The value of the strikethrough's properties.
169 * @param[in] type Whether the property is for the default strikethrough or the input strikethrough.
171 void GetStrikethroughProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
174 * @brief Sets the shadow properties.
176 * @param[in] controller The text's controller.
177 * @param[in] value The values of the shadow's style.
178 * @param[in] type Whether the property is for the default shadow's style or the input shadow's style.
180 * @return Whether the shadow properties have been updated.
182 bool SetShadowProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
185 * @brief Retrieves the shadow's properties.
187 * @param[in] controller The text's controller.
188 * @param[out] value The value of the shadow's properties.
189 * @param[in] type Whether the property is for the default shadow or the input shadow.
191 void GetShadowProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
194 * @brief Sets the emboss properties.
196 * @param[in] controller The text's controller.
197 * @param[in] value The values of the emboss's properties.
198 * @param[in] type Whether the property is for the default emboss or the input emboss.
200 * @return Whether the emboss properties have been updated.
202 bool SetEmbossProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
205 * @brief Retrieves the emboss's properties.
207 * @param[in] controller The text's controller.
208 * @param[out] value The value of the emboss's properties.
209 * @param[in] type Whether the property is for the default emboss or the input emboss.
211 void GetEmbossProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
214 * @brief Sets the outline properties.
216 * @param[in] controller The text's controller.
217 * @param[in] value The values of the outline's properties.
218 * @param[in] type Whether the property is for the default outline or the input outline.
220 * @return Whether the outline properties have been updated.
222 bool SetOutlineProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
225 * @brief Retrieves the outline's properties.
227 * @param[in] controller The text's controller.
228 * @param[out] value The value of the outline's properties.
229 * @param[in] type Whether the property is for the default outline or the input outline.
231 void GetOutlineProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
234 * @brief Sets the background properties.
236 * @param[in] controller The text's controller.
237 * @param[in] value The values of the background's properties.
238 * @param[in] type Whether the property is for the default background or the input background.
240 * @return Whether the background properties have been updated.
242 bool SetBackgroundProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
245 * @brief Retrieves the background's properties.
247 * @param[in] controller The text's controller.
248 * @param[out] value The value of the underline's properties.
249 * @param[in] type Whether the property is for the default background or the input background.
251 void GetBackgroundProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
254 * @brief Converts a underline type string into @e Underline::Type
256 * @param[in] underlineTypeStr The underline type string. Must end with '\0'.
258 * @return The @e Underline::Type value corresponding to the string.
260 Underline::Type StringToUnderlineType(const char* const underlineTypeStr);
264 } // namespace Toolkit
268 #endif // DALI_TOOLKIT_INTERNAL_TEXT_EFFECTS_STYLE_H