1 #ifndef DALI_TOOLKIT_TEXT_UNDERLINE_SPAN_H
2 #define DALI_TOOLKIT_TEXT_UNDERLINE_SPAN_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/devel-api/text/spans/base-span.h>
23 #include <dali-toolkit/public-api/text/text-enumerations.h>
24 #include <dali/public-api/common/constants.h>
25 #include <dali/public-api/math/vector4.h>
33 namespace Internal DALI_INTERNAL
39 * @brief UnderlineSpan is a handle to an object that specifies the underline properties for range of characters.
41 class DALI_TOOLKIT_API UnderlineSpan : public BaseSpan
45 * @brief Create an initialized UnderlineSpan.
47 * @return A handle to a newly allocated Dali resource
49 static UnderlineSpan New();
52 * @brief Create an initialized UnderlineSpan.
54 * @param[in] color The color of line.
55 * @param[in] height The height of line.
57 * @return A handle to a newly allocated Dali resource
59 static UnderlineSpan NewSolid(Vector4 color, float height);
62 * @brief Create an initialized UnderlineSpan.
64 * @param[in] color The color of line.
65 * @param[in] height The height of line.
66 * @param[in] dashGap The dash-gap of line.
67 * @param[in] dashWidth The dash-width of line.
69 * @return A handle to a newly allocated Dali resource
71 static UnderlineSpan NewDashed(Vector4 color, float height, float dashGap, float dashWidth);
74 * @brief Create an initialized UnderlineSpan.
76 * @param[in] color The color of line.
77 * @param[in] height The height of line.
79 * @return A handle to a newly allocated Dali resource
81 static UnderlineSpan NewDouble(Vector4 color, float height);
84 * @brief Creates an uninitialized UnderlineSpan handle.
86 * Calling member functions with an uninitialized UnderlineSpan handle is not allowed.
91 * @brief Copy constructor.
92 * @param[in] rhs A reference to the copied handle
94 UnderlineSpan(const UnderlineSpan& rhs);
97 * @brief Move constructor.
98 * @param[in] rhs A reference to the handle to move
100 UnderlineSpan(UnderlineSpan&& rhs);
103 * @brief Assignment operator.
104 * @param[in] rhs A reference to the copied handle
105 * @return A reference to this
107 UnderlineSpan& operator=(const UnderlineSpan& rhs);
110 * @brief Move assignment operator.
111 * @param[in] rhs A reference to the moved handle
112 * @return A reference to this
114 UnderlineSpan& operator=(UnderlineSpan&& rhs);
117 * @brief Non virtual destructor.
122 * @brief Downcasts to a UnderlineSpan handle.
123 * If handle is not a UnderlineSpan, the returned handle is left uninitialized.
125 * @param[in] handle Handle to an object
126 * @return UnderlineSpan handle or an uninitialized handle
128 static UnderlineSpan DownCast(BaseHandle handle);
132 * @brief Retrive the type of line.
134 * @return A type value.
136 const Text::Underline::Type GetType() const;
139 * @brief Retrieve whether the type is defined.
141 * @return The return is true if type is defined, otherwise false.
143 bool IsTypeDefined() const;
146 * @brief Retrive the color of line.
148 * @return A color value.
150 const Vector4 GetColor() const;
153 * @brief Retrieve whether the color is defined.
155 * @return The return is true if color is defined, otherwise false.
157 bool IsColorDefined() const;
160 * @brief Retrive the height of line.
162 * @return A height value.
164 const float GetHeight() const;
167 * @brief Retrieve whether the height is defined.
169 * @return The return is true if height is defined, otherwise false.
171 bool IsHeightDefined() const;
174 * @brief Retrive the dash-gap of line.
176 * @return A dash-gap value.
178 const float GetDashGap() const;
181 * @brief Retrieve whether the dash-gap is defined.
183 * @return The return is true if dash-gap is defined, otherwise false.
185 bool IsDashGapDefined() const;
188 * @brief Retrive the dash-width of line.
190 * @return A dash-width value.
192 const float GetDashWidth() const;
195 * @brief Retrieve whether the dash-width is defined.
197 * @return The return is true if dash-width is defined, otherwise false.
199 bool IsDashWidthDefined() const;
201 public: // Not intended for application developers
204 * @brief This constructor is used internally to Create an initialized UnderlineSpan handle.
206 * @param[in] underlineSpan Pointer to internal UnderlineSpan
208 explicit DALI_INTERNAL UnderlineSpan(Internal::UnderlineSpan* underlineSpan);
214 } // namespace Toolkit
218 #endif // DALI_TOOLKIT_TEXT_UNDERLINE_SPAN_H