1 #ifndef DALI_TOOLKIT_TEXT_MODEL_INTERFACE_H
2 #define DALI_TOOLKIT_TEXT_MODEL_INTERFACE_H
5 * Copyright (c) 2017 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>
40 * @brief Interface class used to retrieve the text's model from the text-controller.
46 * @brief Virtual destructor.
48 virtual ~ModelInterface()
52 * @brief Retrives the control's size.
54 * @return The control's size.
56 virtual const Size& GetControlSize() const = 0;
59 * @brief Retrives the layout's size.
61 * @return The layout's size.
63 virtual const Size& GetLayoutSize() const = 0;
66 * @brief Retrieves the text's scroll position.
68 * @return The scroll position.
70 virtual const Vector2& GetScrollPosition() const = 0;
73 * @brief Retrieves the text's horizontal alignment.
75 * @return The horizontal alignment.
77 virtual HorizontalAlignment::Type GetHorizontalAlignment() const = 0;
80 * @brief Retrieves the text's vertical alignment.
82 * @return The vertical alignment.
84 virtual VerticalAlignment::Type GetVerticalAlignment() const = 0;
87 * @brief Whether the text elide property is enabled.
89 * @return @e true if the text elide property is enabled, @e false otherwise.
91 virtual bool IsTextElideEnabled() const = 0;
94 * @brief Retrieves the number of laid-out lines.
96 * @return The number of laid-out lines.
98 virtual Length GetNumberOfLines() const = 0;
101 * @brief Retrieves the laid-out lines.
103 * @return A pointer to the vector with the laid-out lines.
105 virtual const LineRun* const GetLines() const = 0;
108 * @brief Retrieves the number of script runs.
110 * @return The number of script runs.
112 virtual Length GetNumberOfScripts() const = 0;
115 * @brief Retrieves the script runs.
117 * @return A pointer to the vector with the runs of characters with the same script..
119 virtual const ScriptRun* const GetScriptRuns() const = 0;
122 * @brief Retrieves the number of laid-out glyphs.
124 * @return The number of laid-out glyphs.
126 virtual Length GetNumberOfGlyphs() const = 0;
129 * @brief Retrieves the laid-out glyphs.
131 * @return A pointer to the vector with the laid-out glyphs.
133 virtual const GlyphInfo* const GetGlyphs() const = 0;
136 * @brief Retrieves the text layout.
138 * @return A pointer to the vector with the positions for each glyph.
140 virtual const Vector2* const GetLayout() const = 0;
143 * @brief Retrieves the vector of colors.
145 * @return Pointer to the vector of colors.
147 virtual const Vector4* const GetColors() const = 0;
150 * @brief Retrieves the vector of indices to the vector of colors.
152 * @return Pointer to a vector which stores for each glyph the index to the vector of colors.
154 virtual const ColorIndex* const GetColorIndices() const = 0;
157 * @brief Retrieves the text's default color.
159 * @return The default color.
161 virtual const Vector4& GetDefaultColor() const = 0;
164 * @brief Retrieves the shadow offset, 0 indicates no shadow.
166 * @return The shadow offset.
168 virtual const Vector2& GetShadowOffset() const = 0;
171 * @brief Retrieves the shadow color.
173 * @return The shadow color.
175 virtual const Vector4& GetShadowColor() const = 0;
178 * @brief Retrieve the shadow blur radius.
180 * @return The shadow blur radius.
182 virtual const float& GetShadowBlurRadius() const = 0;
185 * @brief Retrieves the underline color.
187 * @return The underline color.
189 virtual const Vector4& GetUnderlineColor() const = 0;
192 * @brief Returns whether underline is enabled or not.
194 * @return The underline state.
196 virtual bool IsUnderlineEnabled() const = 0;
199 * @brief Retrieves the underline height override
201 * @return Returns the override height for an underline, 0 indicates that adaptor will determine the height
203 virtual float GetUnderlineHeight() const = 0;
206 * @brief Retrieves the number of underline runs.
208 * @return The number of underline runs.
210 virtual Length GetNumberOfUnderlineRuns() const = 0;
213 * @brief Retrieves the underline runs.
215 * @param[out] underlineRuns Pointer to a buffer where the underline runs are copied.
216 * @param[in] index Index of the first underline run to be copied.
217 * @param[in] numberOfRuns Number of underline runs to be copied.
219 virtual void GetUnderlineRuns( GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns ) const = 0;
222 * @brief Retrieve the outline color.
224 * @return The outline color.
226 virtual const Vector4& GetOutlineColor() const = 0;
229 * @brief Retrieves the width of an outline
231 * @return The width of the outline.
233 virtual float GetOutlineWidth() const = 0;
239 } // namespace Toolkit
243 #endif // DALI_TOOLKIT_TEXT_MODEL_INTERFACE_H