1 #ifndef DALI_TOOLKIT_TEXT_MODEL_INTERFACE_H
2 #define DALI_TOOLKIT_TEXT_MODEL_INTERFACE_H
5 * Copyright (c) 2018 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/public-api/text/text-enumerations.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/devel-api/text/text-enumerations-devel.h>
41 * @brief Interface class used to retrieve the text's model from the text-controller.
47 * @brief Virtual destructor.
49 virtual ~ModelInterface()
53 * @brief Retrives the control's size.
55 * @return The control's size.
57 virtual const Size& GetControlSize() const = 0;
60 * @brief Retrives the layout's size.
62 * @return The layout's size.
64 virtual const Size& GetLayoutSize() const = 0;
67 * @brief Retrieves the text's scroll position.
69 * @return The scroll position.
71 virtual const Vector2& GetScrollPosition() const = 0;
74 * @brief Retrieves the text's horizontal alignment.
76 * @return The horizontal alignment.
78 virtual HorizontalAlignment::Type GetHorizontalAlignment() const = 0;
81 * @brief Retrieves the text's vertical alignment.
83 * @return The vertical alignment.
85 virtual VerticalAlignment::Type GetVerticalAlignment() const = 0;
88 * @brief Retrieves the text's vertical line alignment.
90 * @return The vertical line alignment.
92 virtual DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const = 0;
95 * @brief Whether the text elide property is enabled.
97 * @return @e true if the text elide property is enabled, @e false otherwise.
99 virtual bool IsTextElideEnabled() const = 0;
102 * @brief Retrieves the number of laid-out lines.
104 * @return The number of laid-out lines.
106 virtual Length GetNumberOfLines() const = 0;
109 * @brief Retrieves the laid-out lines.
111 * @return A pointer to the vector with the laid-out lines.
113 virtual const LineRun* const GetLines() const = 0;
116 * @brief Retrieves the number of script runs.
118 * @return The number of script runs.
120 virtual Length GetNumberOfScripts() const = 0;
123 * @brief Retrieves the script runs.
125 * @return A pointer to the vector with the runs of characters with the same script..
127 virtual const ScriptRun* const GetScriptRuns() const = 0;
130 * @brief Retrieves the number of laid-out glyphs.
132 * @return The number of laid-out glyphs.
134 virtual Length GetNumberOfGlyphs() const = 0;
137 * @brief Retrieves the laid-out glyphs.
139 * @return A pointer to the vector with the laid-out glyphs.
141 virtual const GlyphInfo* const GetGlyphs() const = 0;
144 * @brief Retrieves the text layout.
146 * @return A pointer to the vector with the positions for each glyph.
148 virtual const Vector2* const GetLayout() const = 0;
151 * @brief Retrieves the vector of colors.
153 * @return Pointer to the vector of colors.
155 virtual const Vector4* const GetColors() const = 0;
158 * @brief Retrieves the vector of indices to the vector of colors.
160 * @return Pointer to a vector which stores for each glyph the index to the vector of colors.
162 virtual const ColorIndex* const GetColorIndices() const = 0;
165 * @brief Retrieves the text's default color.
167 * @return The default color.
169 virtual const Vector4& GetDefaultColor() const = 0;
172 * @brief Retrieves the shadow offset, 0 indicates no shadow.
174 * @return The shadow offset.
176 virtual const Vector2& GetShadowOffset() const = 0;
179 * @brief Retrieves the shadow color.
181 * @return The shadow color.
183 virtual const Vector4& GetShadowColor() const = 0;
186 * @brief Retrieve the shadow blur radius.
188 * @return The shadow blur radius.
190 virtual const float& GetShadowBlurRadius() const = 0;
193 * @brief Retrieves the underline color.
195 * @return The underline color.
197 virtual const Vector4& GetUnderlineColor() const = 0;
200 * @brief Returns whether underline is enabled or not.
202 * @return The underline state.
204 virtual bool IsUnderlineEnabled() const = 0;
207 * @brief Retrieves the underline height override
209 * @return Returns the override height for an underline, 0 indicates that adaptor will determine the height
211 virtual float GetUnderlineHeight() const = 0;
214 * @brief Retrieves the number of underline runs.
216 * @return The number of underline runs.
218 virtual Length GetNumberOfUnderlineRuns() const = 0;
221 * @brief Retrieves the underline runs.
223 * @param[out] underlineRuns Pointer to a buffer where the underline runs are copied.
224 * @param[in] index Index of the first underline run to be copied.
225 * @param[in] numberOfRuns Number of underline runs to be copied.
227 virtual void GetUnderlineRuns( GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns ) const = 0;
230 * @brief Retrieve the outline color.
232 * @return The outline color.
234 virtual const Vector4& GetOutlineColor() const = 0;
237 * @brief Retrieves the width of an outline
239 * @return The width of the outline.
241 virtual float GetOutlineWidth() const = 0;
244 * @brief Retrieves the background color.
246 * @return The background color.
248 virtual const Vector4& GetBackgroundColor() const = 0;
251 * @brief Returns whether background is enabled or not.
253 * @return The background state.
255 virtual bool IsBackgroundEnabled() const = 0;
261 } // namespace Toolkit
265 #endif // DALI_TOOLKIT_TEXT_MODEL_INTERFACE_H