Multiple text background color support for left-to-right text only in TextField
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-model-interface.h
1 #ifndef DALI_TOOLKIT_TEXT_MODEL_INTERFACE_H
2 #define DALI_TOOLKIT_TEXT_MODEL_INTERFACE_H
3
4 /*
5  * Copyright (c) 2019 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 // EXTERNAL INCLUDES
22 #include <dali/public-api/math/vector2.h>
23
24 // INTERNAL INCLUDES
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>
30
31 namespace Dali
32 {
33
34 namespace Toolkit
35 {
36
37 namespace Text
38 {
39
40 /**
41  * @brief Interface class used to retrieve the text's model from the text-controller.
42  */
43 class ModelInterface
44 {
45 public:
46   /**
47    * @brief Virtual destructor.
48    */
49   virtual ~ModelInterface()
50   {}
51
52   /**
53    * @brief Retrives the control's size.
54    *
55    * @return The control's size.
56    */
57   virtual const Size& GetControlSize() const = 0;
58
59   /**
60    * @brief Retrives the layout's size.
61    *
62    * @return The layout's size.
63    */
64   virtual const Size& GetLayoutSize() const = 0;
65
66   /**
67    * @brief Retrieves the text's scroll position.
68    *
69    * @return The scroll position.
70    */
71   virtual const Vector2& GetScrollPosition() const = 0;
72
73   /**
74    * @brief Retrieves the text's horizontal alignment.
75    *
76    * @return The horizontal alignment.
77    */
78   virtual HorizontalAlignment::Type GetHorizontalAlignment() const = 0;
79
80   /**
81    * @brief Retrieves the text's vertical alignment.
82    *
83    * @return The vertical alignment.
84    */
85   virtual VerticalAlignment::Type GetVerticalAlignment() const = 0;
86
87   /**
88    * @brief Retrieves the text's vertical line alignment.
89    *
90    * @return The vertical line alignment.
91    */
92   virtual DevelText::VerticalLineAlignment::Type GetVerticalLineAlignment() const = 0;
93
94   /**
95    * @brief Whether the text elide property is enabled.
96    *
97    * @return @e true if the text elide property is enabled, @e false otherwise.
98    */
99   virtual bool IsTextElideEnabled() const = 0;
100
101   /**
102    * @brief Retrieves the number of laid-out lines.
103    *
104    * @return The number of laid-out lines.
105    */
106   virtual Length GetNumberOfLines() const = 0;
107
108   /**
109    * @brief Retrieves the laid-out lines.
110    *
111    * @return A pointer to the vector with the laid-out lines.
112    */
113   virtual const LineRun* const GetLines() const = 0;
114
115   /**
116    * @brief Retrieves the number of script runs.
117    *
118    * @return The number of script runs.
119    */
120   virtual Length GetNumberOfScripts() const = 0;
121
122   /**
123    * @brief Retrieves the script runs.
124    *
125    * @return A pointer to the vector with the runs of characters with the same script..
126    */
127   virtual const ScriptRun* const GetScriptRuns() const = 0;
128
129   /**
130    * @brief Retrieves the number of laid-out glyphs.
131    *
132    * @return The number of laid-out glyphs.
133    */
134   virtual Length GetNumberOfGlyphs() const = 0;
135
136   /**
137    * @brief Retrieves the laid-out glyphs.
138    *
139    * @return A pointer to the vector with the laid-out glyphs.
140    */
141   virtual const GlyphInfo* const GetGlyphs() const = 0;
142
143   /**
144    * @brief Retrieves the text layout.
145    *
146    * @return A pointer to the vector with the positions for each glyph.
147    */
148   virtual const Vector2* const GetLayout() const = 0;
149
150   /**
151    * @brief Retrieves the vector of colors.
152    *
153    * @return Pointer to the vector of colors.
154    */
155   virtual const Vector4* const GetColors() const = 0;
156
157   /**
158    * @brief Retrieves the vector of indices to the vector of colors.
159    *
160    * @return Pointer to a vector which stores for each glyph the index to the vector of colors.
161    */
162   virtual const ColorIndex* const GetColorIndices() const = 0;
163
164   /**
165    * @brief Retrieves the vector of background colors.
166    *
167    * @return Pointer to the vector of background colors.
168    */
169   virtual const Vector4* const GetBackgroundColors() const = 0;
170
171   /**
172    * @brief Retrieves the vector of indices to the vector of background colors.
173    *
174    * @return Pointer to a vector which stores for each glyph the index to the vector of background colors.
175    */
176   virtual const ColorIndex* const GetBackgroundColorIndices() const = 0;
177
178   /**
179    * @brief Retrieves the text's default color.
180    *
181    * @return The default color.
182    */
183   virtual const Vector4& GetDefaultColor() const = 0;
184
185   /**
186    * @brief Retrieves the shadow offset, 0 indicates no shadow.
187    *
188    * @return The shadow offset.
189    */
190   virtual const Vector2& GetShadowOffset() const = 0;
191
192   /**
193    * @brief Retrieves the shadow color.
194    *
195    * @return The shadow color.
196    */
197   virtual const Vector4& GetShadowColor() const = 0;
198
199   /**
200    * @brief Retrieve the shadow blur radius.
201    *
202    * @return The shadow blur radius.
203    */
204   virtual const float& GetShadowBlurRadius() const = 0;
205
206   /**
207    * @brief Retrieves the underline color.
208    *
209    * @return The underline color.
210    */
211   virtual const Vector4& GetUnderlineColor() const = 0;
212
213   /**
214    * @brief Returns whether underline is enabled or not.
215    *
216    * @return The underline state.
217    */
218   virtual bool IsUnderlineEnabled() const = 0;
219
220   /**
221    * @brief Retrieves the underline height override
222    *
223    * @return Returns the override height for an underline, 0 indicates that adaptor will determine the height
224    */
225   virtual float GetUnderlineHeight() const = 0;
226
227   /**
228    * @brief Retrieves the number of underline runs.
229    *
230    * @return The number of underline runs.
231    */
232   virtual Length GetNumberOfUnderlineRuns() const = 0;
233
234   /**
235    * @brief Retrieves the underline runs.
236    *
237    * @param[out] underlineRuns Pointer to a buffer where the underline runs are copied.
238    * @param[in] index Index of the first underline run to be copied.
239    * @param[in] numberOfRuns Number of underline runs to be copied.
240    */
241   virtual void GetUnderlineRuns( GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns ) const = 0;
242
243   /**
244    * @brief Retrieve the outline color.
245    *
246    * @return The outline color.
247    */
248   virtual const Vector4& GetOutlineColor() const = 0;
249
250   /**
251    * @brief Retrieves the width of an outline
252    *
253    * @return The width of the outline.
254    */
255   virtual uint16_t GetOutlineWidth() const = 0;
256
257   /**
258    * @brief Retrieves the background color.
259    *
260    * @return The background color.
261    */
262   virtual const Vector4& GetBackgroundColor() const = 0;
263
264   /**
265    * @brief Returns whether background is enabled or not.
266    *
267    * @return The background state.
268    */
269   virtual bool IsBackgroundEnabled() const = 0;
270
271 };
272
273 } // namespace Text
274
275 } // namespace Toolkit
276
277 } // namespace Dali
278
279 #endif // DALI_TOOLKIT_TEXT_MODEL_INTERFACE_H