1 #ifndef DALI_TOOLKIT_TEXT_MODEL_INTERFACE_H
2 #define DALI_TOOLKIT_TEXT_MODEL_INTERFACE_H
5 * Copyright (c) 2021 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/vector2.h>
25 #include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
26 #include <dali-toolkit/internal/text/line-run.h>
27 #include <dali-toolkit/internal/text/script-run.h>
28 #include <dali-toolkit/internal/text/text-definitions.h>
29 #include <dali-toolkit/public-api/text/text-enumerations.h>
38 * @brief Interface class used to retrieve the text's model from the text-controller.
44 * @brief Virtual destructor.
46 virtual ~ModelInterface()
51 * @brief Retrives the control's size.
53 * @return The control's size.
55 virtual const Size& GetControlSize() const = 0;
58 * @brief Retrives the layout's size.
60 * @return The layout's size.
62 virtual const Size& GetLayoutSize() const = 0;
65 * @brief Retrieves the text's scroll position.
67 * @return The scroll position.
69 virtual const Vector2& GetScrollPosition() const = 0;
72 * @brief Retrieves the text's horizontal alignment.
74 * @return The horizontal alignment.
76 virtual HorizontalAlignment::Type GetHorizontalAlignment() const = 0;
79 * @brief Retrieves the text's vertical alignment.
81 * @return The vertical alignment.
83 virtual VerticalAlignment::Type GetVerticalAlignment() const = 0;
86 * @brief Retrieves the text's vertical line alignment.
88 * @return The vertical line alignment.
90 virtual DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const = 0;
93 * @brief Retrieves ellipsis position for text.
95 * @return The ellipsis position.
97 virtual DevelText::EllipsisPosition::Type GetEllipsisPosition() const = 0;
100 * @brief Whether the text elide property is enabled.
102 * @return @e true if the text elide property is enabled, @e false otherwise.
104 virtual bool IsTextElideEnabled() const = 0;
107 * @brief Retrieves the number of laid-out lines.
109 * @return The number of laid-out lines.
111 virtual Length GetNumberOfLines() const = 0;
114 * @brief Retrieves the laid-out lines.
116 * @return A pointer to the vector with the laid-out lines.
118 virtual const LineRun* const GetLines() const = 0;
121 * @brief Retrieves the number of script runs.
123 * @return The number of script runs.
125 virtual Length GetNumberOfScripts() const = 0;
128 * @brief Retrieves the script runs.
130 * @return A pointer to the vector with the runs of characters with the same script..
132 virtual const ScriptRun* const GetScriptRuns() const = 0;
135 * @brief Retrieves the number of laid-out glyphs.
137 * @return The number of laid-out glyphs.
139 virtual Length GetNumberOfGlyphs() const = 0;
142 * @brief Retrieves the start index of laid-out glyphs.
144 * @return The start index of laid-out glyphs.
146 virtual GlyphIndex GetStartIndexOfElidedGlyphs() const = 0;
149 * @brief Retrieves the end index of laid-out glyphs.
151 * @return The end index of laid-out glyphs.
153 virtual GlyphIndex GetEndIndexOfElidedGlyphs() const = 0;
156 * @brief Retrieves the first middle index of elided glyphs, index before ellipsis of middle.
158 * @return The first middle index of elided glyphs, index before ellipsis of middle.
160 virtual GlyphIndex GetFirstMiddleIndexOfElidedGlyphs() const = 0;
163 * @brief Retrieves the second middle index of elided glyphs, index of ellipsis of middle.
165 * @return The second middle index of elided glyphs, index of ellipsis of middle.
167 virtual GlyphIndex GetSecondMiddleIndexOfElidedGlyphs() const = 0;
170 * @brief Retrieves the laid-out glyphs.
172 * @return A pointer to the vector with the laid-out glyphs.
174 virtual const GlyphInfo* const GetGlyphs() const = 0;
177 * @brief Retrieves the text layout.
179 * @return A pointer to the vector with the positions for each glyph.
181 virtual const Vector2* const GetLayout() const = 0;
184 * @brief Retrieves the vector of colors.
186 * @return Pointer to the vector of colors.
188 virtual const Vector4* const GetColors() const = 0;
191 * @brief Retrieves the vector of indices to the vector of colors.
193 * @return Pointer to a vector which stores for each glyph the index to the vector of colors.
195 virtual const ColorIndex* const GetColorIndices() const = 0;
198 * @brief Retrieves the vector of background colors.
200 * @return Pointer to the vector of background colors.
202 virtual const Vector4* const GetBackgroundColors() const = 0;
205 * @brief Retrieves the vector of indices to the vector of background colors.
207 * @return Pointer to a vector which stores for each glyph the index to the vector of background colors.
209 virtual const ColorIndex* const GetBackgroundColorIndices() const = 0;
212 * @brief checks if there is background colors set using markup.
214 * @return boolean if there is background colors set using markup .
216 virtual bool const IsMarkupBackgroundColorSet() const = 0;
219 * @brief Retrieves the text's default color.
221 * @return The default color.
223 virtual const Vector4& GetDefaultColor() const = 0;
226 * @brief Retrieves the shadow offset, 0 indicates no shadow.
228 * @return The shadow offset.
230 virtual const Vector2& GetShadowOffset() const = 0;
233 * @brief Retrieves the shadow color.
235 * @return The shadow color.
237 virtual const Vector4& GetShadowColor() const = 0;
240 * @brief Retrieve the shadow blur radius.
242 * @return The shadow blur radius.
244 virtual const float& GetShadowBlurRadius() const = 0;
247 * @brief Retrieves the underline color.
249 * @return The underline color.
251 virtual const Vector4& GetUnderlineColor() const = 0;
254 * @brief Returns whether underline is enabled or not.
256 * @return The underline state.
258 virtual bool IsUnderlineEnabled() const = 0;
261 * @brief Retrieves the underline height override
263 * @return Returns the override height for an underline, 0 indicates that adaptor will determine the height
265 virtual float GetUnderlineHeight() const = 0;
268 * @brief Retrieves the underline type override.
270 * @return Returns the override type for an underline.
272 virtual Text::Underline::Type GetUnderlineType() const = 0;
275 * @brief Retrieves the dashed underline width override
277 * @return Returns the override width for the dashed underline.
279 virtual float GetDashedUnderlineWidth() const = 0;
282 * @brief Retrieves the dashed underline gap override
284 * @return Returns the override gap for the dashed underline.
286 virtual float GetDashedUnderlineGap() const = 0;
289 * @brief Retrieves the number of underline runs.
291 * @return The number of underline runs.
293 virtual Length GetNumberOfUnderlineRuns() const = 0;
296 * @brief Retrieves the underline runs.
298 * @param[out] underlineRuns Pointer to a buffer where the underline runs are copied.
299 * @param[in] index Index of the first underline run to be copied.
300 * @param[in] numberOfRuns Number of underline runs to be copied.
302 virtual void GetUnderlineRuns(GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns) const = 0;
305 * @brief Retrieve the outline color.
307 * @return The outline color.
309 virtual const Vector4& GetOutlineColor() const = 0;
312 * @brief Retrieves the width of an outline
314 * @return The width of the outline.
316 virtual uint16_t GetOutlineWidth() const = 0;
319 * @brief Retrieves the background color.
321 * @return The background color.
323 virtual const Vector4& GetBackgroundColor() const = 0;
326 * @brief Returns whether background is enabled or not.
328 * @return The background state.
330 virtual bool IsBackgroundEnabled() const = 0;
333 * @brief Returns whether markup-processor is enabled or not.
335 * @return The markup-processor state.
337 virtual bool IsMarkupProcessorEnabled() const = 0;
340 * @brief Returns the hyphens glyph info.
342 * @return hyphens glyph info.
344 virtual const GlyphInfo* GetHyphens() const = 0;
347 * @brief Returns the indices of the hyphen in the text.
349 * @return the hyphen indices.
351 virtual const Length* GetHyphenIndices() const = 0;
354 * @brief Returns number of hyphens to add in text.
356 * @return number of hyphens.
358 virtual Length GetHyphensCount() const = 0;
361 * @brief Retrieves the strikethrough color.
363 * @return The strikethrough color.
365 virtual const Vector4& GetStrikethroughColor() const = 0;
368 * @brief Returns whether strikethrough is enabled or not.
370 * @return The strikethrough state.
372 virtual bool IsStrikethroughEnabled() const = 0;
375 * @brief Retrieves the strikethrough height override
377 * @return Returns the override height for a strikethrough, 0 indicates that adaptor will determine the height
379 virtual float GetStrikethroughHeight() const = 0;
384 } // namespace Toolkit
388 #endif // DALI_TOOLKIT_TEXT_MODEL_INTERFACE_H