1 #ifndef DALI_TOOLKIT_TEXT_UNDERLINE_STYLE_PROPERTIES_H
2 #define DALI_TOOLKIT_TEXT_UNDERLINE_STYLE_PROPERTIES_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/public-api/math/vector4.h>
26 #include <dali-toolkit/public-api/text/text-enumerations.h>
35 * @brief Properties of underline style.
37 struct UnderlineStyleProperties
42 * Default constructor to set the default values of bitfields
44 UnderlineStyleProperties()
45 : type{Text::Underline::SOLID},
53 dashGapDefined{false},
54 dashWidthDefined{false}
58 UnderlineStyleProperties(Text::Underline::Type type,
67 bool dashWidthDefined)
73 typeDefined{typeDefined},
74 colorDefined{colorDefined},
75 heightDefined{heightDefined},
76 dashGapDefined{dashGapDefined},
77 dashWidthDefined{dashWidthDefined}
81 // Overloading operators
83 bool operator==(const UnderlineStyleProperties& other) const
85 //The property is similar when both are not defined or when both are defined and have the same value.
86 return ((!typeDefined && !other.typeDefined) || ((typeDefined && other.typeDefined) && (type == other.type))) &&
87 ((!colorDefined && !other.colorDefined) || ((colorDefined && other.colorDefined) && (color == other.color))) &&
88 ((!heightDefined && !other.heightDefined) || ((heightDefined && other.heightDefined) && (height == other.height))) &&
89 ((!dashGapDefined && !other.dashGapDefined) || ((dashGapDefined && other.dashGapDefined) && (dashGap == other.dashGap))) &&
90 ((!dashWidthDefined && !other.dashWidthDefined) || ((dashWidthDefined && other.dashWidthDefined) && (dashWidth == other.dashWidth)));
93 bool operator!=(const UnderlineStyleProperties& other) const
95 return !(*this == other);
98 bool IsHeightEqualTo(const UnderlineStyleProperties& other) const
100 return ((!heightDefined && !other.heightDefined) || ((heightDefined && other.heightDefined) && (height == other.height)));
104 Text::Underline::Type type; ///< The type of underline.
105 Vector4 color; ///< The color of underline.
106 float height; ///< The height of underline.
107 float dashGap; ///< The dash-gap of underline.
108 float dashWidth; ///< The height of underline.
110 bool typeDefined : 1; ///< Whether the type is defined.
111 bool colorDefined : 1; ///< Whether the color is defined.
112 bool heightDefined : 1; ///< Whether the height is defined.
113 bool dashGapDefined : 1; ///< Whether the dash-gap is defined.
114 bool dashWidthDefined : 1; ///< Whether the dash-width is defined.
119 } // namespace Toolkit
123 #endif // DALI_TOOLKIT_TEXT_UNDERLINE_STYLE_PROPERTIES_H