Extending Text Styles - Adding Dashed/Double Underline
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-effects-style.h
1 #ifndef DALI_TOOLKIT_INTERNAL_TEXT_EFFECTS_STYLE_H
2 #define DALI_TOOLKIT_INTERNAL_TEXT_EFFECTS_STYLE_H
3
4 /*
5  * Copyright (c) 2021 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/text/text-controller.h>
23
24 namespace Dali
25 {
26 namespace Toolkit
27 {
28 namespace Text
29 {
30 namespace EffectStyle
31 {
32 enum Type
33 {
34   DEFAULT, ///< The default text effect style.
35   INPUT    ///< The input text effect style.
36 };
37 };
38
39 /**
40  * @brief Parses the shadow properties.
41  *
42  * @param[in] shadowProperties The map with the shadow properties.
43  * @param[out] colorDefined Whether the shadow's color is defined.
44  * @param[out] color The shadow's color.
45  * @param[out] offsetDefined Whether the shadow's offset is defined.
46  * @param[out] offset The shadow's offset.
47  */
48 bool ParseShadowProperties(const Property::Map& shadowProperties,
49                            bool&                colorDefined,
50                            Vector4&             color,
51                            bool&                offsetDefined,
52                            Vector2&             offset);
53
54 /**
55  * @brief Parses the underline properties.
56  *
57  * @param[in] underlineProperties The map with the underline properties.
58  * @param[out] enabled Whether the underline is enabled.
59  * @param[out] colorDefined Whether the underline's color is defined.
60  * @param[out] color The underline's color.
61  * @param[out] heightDefined Whether the underline's height is defined.
62  * @param[out] height The underline's height.
63  * @param[out] type The underline's type; DASHED, DOUBLE, etc. Default is a solid underline.
64  * @param[out] dashWidth The dashed underline's width.
65  * @param[out] dashGap The dashed underline's gap.
66  */
67 bool ParseUnderlineProperties(const Property::Map&   underlineProperties,
68                               bool&                  enabled,
69                               bool&                  colorDefined,
70                               Vector4&               color,
71                               bool&                  heightDefined,
72                               float&                 height,
73                               bool&                  typeDefined,
74                               Text::Underline::Type& type,
75                               bool&                  widthDefined,
76                               float&                 dashWidth,
77                               bool&                  dashGapDefined,
78                               float&                 dashGap);
79
80 /**
81  * @brief Parses the outline properties.
82  *
83  * @param[in] outlineProperties The map with the outline properties.
84  * @param[out] colorDefined Whether the outline's color is defined.
85  * @param[out] color The outline's color.
86  * @param[out] widthDefined Whether the outline's width is defined.
87  * @param[out] width The outline's width.
88  */
89 bool ParseOutlineProperties(const Property::Map& outlineProperties,
90                             bool&                colorDefined,
91                             Vector4&             color,
92                             bool&                widthDefined,
93                             unsigned int&        width);
94
95 /**
96  * @brief Parses the background properties.
97  *
98  * @param[in] backgroundProperties The map with the background properties.
99  * @param[out] enabled Whether the background is enabled.
100  * @param[out] colorDefined Whether the background color is defined.
101  * @param[out] color The background color.
102  */
103 bool ParseBackgroundProperties(const Property::Map& backgroundProperties,
104                                bool&                enabled,
105                                bool&                colorDefined,
106                                Vector4&             color);
107
108 /**
109  * @brief Parses the strikethrough properties.
110  *
111  * @param[in] strikethroughProperties The map with the strikethrough properties.
112  * @param[out] enabled Whether the strikethrough is enabled.
113  * @param[out] colorDefined Whether the strikethrough's color is defined.
114  * @param[out] color The strikethrough's color.
115  * @param[out] heightDefined Whether the strikethrough's height is defined.
116  * @param[out] height The strikethrough's height.
117  */
118 bool ParseStrikethroughProperties(const Property::Map& strikethroughProperties,
119                               bool&                enabled,
120                               bool&                colorDefined,
121                               Vector4&             color,
122                               bool&                heightDefined,
123                               float&               height);
124
125 /**
126  * @brief Sets the underline properties.
127  *
128  * @param[in] controller The text's controller.
129  * @param[in] value The values of the underline's properties.
130  * @param[in] type Whether the property is for the default underline or the input underline.
131  *
132  * @return Whether the underline properties have been updated.
133  */
134 bool SetUnderlineProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
135
136 /**
137  * @brief Sets the strikethrough properties.
138  *
139  * @param[in] controller The text's controller.
140  * @param[in] value The values of the strikethrough's properties.
141  * @param[in] type Whether the property is for the default strikethrough or the input strikethrough.
142  *
143  * @return Whether the strikethrough properties have been updated.
144  */
145 bool SetStrikethroughProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
146
147 /**
148  * @brief Retrieves the underline's properties.
149  *
150  * @param[in] controller The text's controller.
151  * @param[out] value The value of the underline's properties.
152  * @param[in] type Whether the property is for the default underline or the input underline.
153  */
154 void GetUnderlineProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
155
156 /**
157  * @brief Retrieves the strikethrough's properties.
158  *
159  * @param[in] controller The text's controller.
160  * @param[out] value The value of the strikethrough's properties.
161  * @param[in] type Whether the property is for the default strikethrough or the input strikethrough.
162  */
163 void GetStrikethroughProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
164
165 /**
166  * @brief Sets the shadow properties.
167  *
168  * @param[in] controller The text's controller.
169  * @param[in] value The values of the shadow's style.
170  * @param[in] type Whether the property is for the default shadow's style or the input shadow's style.
171  *
172  * @return Whether the shadow properties have been updated.
173  */
174 bool SetShadowProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
175
176 /**
177  * @brief Retrieves the shadow's properties.
178  *
179  * @param[in] controller The text's controller.
180  * @param[out] value The value of the shadow's properties.
181  * @param[in] type Whether the property is for the default shadow or the input shadow.
182  */
183 void GetShadowProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
184
185 /**
186  * @brief Sets the emboss properties.
187  *
188  * @param[in] controller The text's controller.
189  * @param[in] value The values of the emboss's properties.
190  * @param[in] type Whether the property is for the default emboss or the input emboss.
191  *
192  * @return Whether the emboss properties have been updated.
193  */
194 bool SetEmbossProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
195
196 /**
197  * @brief Retrieves the emboss's properties.
198  *
199  * @param[in] controller The text's controller.
200  * @param[out] value The value of the emboss's properties.
201  * @param[in] type Whether the property is for the default emboss or the input emboss.
202  */
203 void GetEmbossProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
204
205 /**
206  * @brief Sets the outline properties.
207  *
208  * @param[in] controller The text's controller.
209  * @param[in] value The values of the outline's properties.
210  * @param[in] type Whether the property is for the default outline or the input outline.
211  *
212  * @return Whether the outline properties have been updated.
213  */
214 bool SetOutlineProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
215
216 /**
217  * @brief Retrieves the outline's properties.
218  *
219  * @param[in] controller The text's controller.
220  * @param[out] value The value of the outline's properties.
221  * @param[in] type Whether the property is for the default outline or the input outline.
222  */
223 void GetOutlineProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
224
225 /**
226  * @brief Sets the background properties.
227  *
228  * @param[in] controller The text's controller.
229  * @param[in] value The values of the background's properties.
230  * @param[in] type Whether the property is for the default background or the input background.
231  *
232  * @return Whether the background properties have been updated.
233  */
234 bool SetBackgroundProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
235
236 /**
237  * @brief Retrieves the background's properties.
238  *
239  * @param[in] controller The text's controller.
240  * @param[out] value The value of the underline's properties.
241  * @param[in] type Whether the property is for the default background or the input background.
242  */
243 void GetBackgroundProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
244
245 } // namespace Text
246
247 } // namespace Toolkit
248
249 } // namespace Dali
250
251 #endif // DALI_TOOLKIT_INTERNAL_TEXT_EFFECTS_STYLE_H