Merge "Fix issue using broken image" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / text / spans / underline-span.h
1 #ifndef DALI_TOOLKIT_TEXT_UNDERLINE_SPAN_H
2 #define DALI_TOOLKIT_TEXT_UNDERLINE_SPAN_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 // INTERNAL INCLUDES
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>
26
27 namespace Dali
28 {
29 namespace Toolkit
30 {
31 namespace Text
32 {
33 namespace Internal DALI_INTERNAL
34 {
35 class UnderlineSpan;
36 }
37
38 /**
39  * @brief UnderlineSpan is a handle to an object that specifies the underline properties for range of characters.
40  */
41 class DALI_TOOLKIT_API UnderlineSpan : public BaseSpan
42 {
43 public:
44   /**
45    * @brief Create an initialized UnderlineSpan.
46    *
47    * @return A handle to a newly allocated Dali resource
48    */
49   static UnderlineSpan New();
50
51   /**
52    * @brief Create an initialized UnderlineSpan.
53    *
54    * @param[in] color The color of line.
55    * @param[in] height The height of line.
56    *
57    * @return A handle to a newly allocated Dali resource
58    */
59   static UnderlineSpan NewSolid(Vector4 color, float height);
60
61   /**
62    * @brief Create an initialized UnderlineSpan.
63    *
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.
68    *
69    * @return A handle to a newly allocated Dali resource
70    */
71   static UnderlineSpan NewDashed(Vector4 color, float height, float dashGap, float dashWidth);
72
73   /**
74    * @brief Create an initialized UnderlineSpan.
75    *
76    * @param[in] color The color of line.
77    * @param[in] height The height of line.
78    *
79    * @return A handle to a newly allocated Dali resource
80    */
81   static UnderlineSpan NewDouble(Vector4 color, float height);
82
83   /**
84    * @brief Creates an uninitialized UnderlineSpan handle.
85    *
86    * Calling member functions with an uninitialized UnderlineSpan handle is not allowed.
87    */
88   UnderlineSpan();
89
90   /**
91    * @brief Copy constructor.
92    * @param[in] rhs A reference to the copied handle
93    */
94   UnderlineSpan(const UnderlineSpan& rhs);
95
96   /**
97    * @brief Move constructor.
98    * @param[in] rhs A reference to the handle to move
99    */
100   UnderlineSpan(UnderlineSpan&& rhs);
101
102   /**
103    * @brief Assignment operator.
104    * @param[in] rhs A reference to the copied handle
105    * @return A reference to this
106    */
107   UnderlineSpan& operator=(const UnderlineSpan& rhs);
108
109   /**
110    * @brief Move assignment operator.
111    * @param[in] rhs A reference to the moved handle
112    * @return A reference to this
113    */
114   UnderlineSpan& operator=(UnderlineSpan&& rhs);
115
116   /**
117    * @brief Non virtual destructor.
118    */
119   ~UnderlineSpan();
120
121   /**
122    * @brief Downcasts to a UnderlineSpan handle.
123    * If handle is not a UnderlineSpan, the returned handle is left uninitialized.
124    *
125    * @param[in] handle Handle to an object
126    * @return UnderlineSpan handle or an uninitialized handle
127    */
128   static UnderlineSpan DownCast(BaseHandle handle);
129
130 public: //Methods
131   /**
132    * @brief Retrive the type of line.
133    *
134    * @return A type value.
135    */
136   const Text::Underline::Type GetType() const;
137
138   /**
139    * @brief Retrieve whether the type is defined.
140    *
141    * @return The return is true if type is defined, otherwise false.
142    */
143   bool IsTypeDefined() const;
144
145   /**
146    * @brief Retrive the color of line.
147    *
148    * @return A color value.
149    */
150   const Vector4 GetColor() const;
151
152   /**
153    * @brief Retrieve whether the color is defined.
154    *
155    * @return The return is true if color is defined, otherwise false.
156    */
157   bool IsColorDefined() const;
158
159   /**
160    * @brief Retrive the height of line.
161    *
162    * @return A height value.
163    */
164   const float GetHeight() const;
165
166   /**
167    * @brief Retrieve whether the height is defined.
168    *
169    * @return The return is true if height is defined, otherwise false.
170    */
171   bool IsHeightDefined() const;
172
173   /**
174    * @brief Retrive the dash-gap of line.
175    *
176    * @return A dash-gap value.
177    */
178   const float GetDashGap() const;
179
180   /**
181    * @brief Retrieve whether the dash-gap is defined.
182    *
183    * @return The return is true if dash-gap is defined, otherwise false.
184    */
185   bool IsDashGapDefined() const;
186
187   /**
188    * @brief Retrive the dash-width of line.
189    *
190    * @return A dash-width value.
191    */
192   const float GetDashWidth() const;
193
194   /**
195    * @brief Retrieve whether the dash-width is defined.
196    *
197    * @return The return is true if dash-width is defined, otherwise false.
198    */
199   bool IsDashWidthDefined() const;
200
201 public: // Not intended for application developers
202   /// @cond internal
203   /**
204    * @brief This constructor is used internally to Create an initialized UnderlineSpan handle.
205    *
206    * @param[in] underlineSpan Pointer to internal UnderlineSpan
207    */
208   explicit DALI_INTERNAL UnderlineSpan(Internal::UnderlineSpan* underlineSpan);
209   /// @endcond
210 };
211
212 } // namespace Text
213
214 } // namespace Toolkit
215
216 } // namespace Dali
217
218 #endif // DALI_TOOLKIT_TEXT_UNDERLINE_SPAN_H