Merge "Fix for multi-language support." into devel/master
[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) 2017 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/internal/text/layouts/layout-alignment.h>
26 #include <dali-toolkit/internal/text/line-run.h>
27 #include <dali-toolkit/internal/text/text-definitions.h>
28
29 namespace Dali
30 {
31
32 namespace Toolkit
33 {
34
35 namespace Text
36 {
37
38 /**
39  * @brief Interface class used to retrieve the text's model from the text-controller.
40  */
41 class ModelInterface
42 {
43 public:
44   /**
45    * @brief Virtual destructor.
46    */
47   virtual ~ModelInterface()
48   {}
49
50   /**
51    * @brief Retrives the control's size.
52    *
53    * @return The control's size.
54    */
55   virtual const Size& GetControlSize() const = 0;
56
57   /**
58    * @brief Retrives the layout's size.
59    *
60    * @return The layout's size.
61    */
62   virtual const Size& GetLayoutSize() const = 0;
63
64   /**
65    * @brief Retrieves the text's scroll position.
66    *
67    * @return The scroll position.
68    */
69   virtual const Vector2& GetScrollPosition() const = 0;
70
71   /**
72    * @brief Retrieves the text's horizontal alignment.
73    *
74    * @return The horizontal alignment.
75    */
76   virtual Layout::HorizontalAlignment GetHorizontalAlignment() const = 0;
77
78   /**
79    * @brief Retrieves the text's vertical alignment.
80    *
81    * @return The vertical alignment.
82    */
83   virtual Layout::VerticalAlignment GetVerticalAlignment() const = 0;
84
85   /**
86    * @brief Whether the text elide property is enabled.
87    *
88    * @return @e true if the text elide property is enabled, @e false otherwise.
89    */
90   virtual bool IsTextElideEnabled() const = 0;
91
92   /**
93    * @brief Retrieves the number of laid-out lines.
94    *
95    * @return The number of laid-out lines.
96    */
97   virtual Length GetNumberOfLines() const = 0;
98
99   /**
100    * @brief Retrieves the laid-out lines.
101    *
102    * @return A pointer to the vector with the laid-out lines.
103    */
104   virtual const LineRun* const GetLines() const = 0;
105
106   /**
107    * @brief Retrieves the number of laid-out glyphs.
108    *
109    * @return The number of laid-out glyphs.
110    */
111   virtual Length GetNumberOfGlyphs() const = 0;
112
113   /**
114    * @brief Retrieves the laid-out glyphs.
115    *
116    * @return A pointer to the vector with the laid-out glyphs.
117    */
118   virtual const GlyphInfo* const GetGlyphs() const = 0;
119
120   /**
121    * @brief Retrieves the text layout.
122    *
123    * @return A pointer to the vector with the positions for each glyph.
124    */
125   virtual const Vector2* const GetLayout() const = 0;
126
127   /**
128    * @brief Retrieves the vector of colors.
129    *
130    * @return Pointer to the vector of colors.
131    */
132   virtual const Vector4* const GetColors() const = 0;
133
134   /**
135    * @brief Retrieves the vector of indices to the vector of colors.
136    *
137    * @return Pointer to a vector which stores for each glyph the index to the vector of colors.
138    */
139   virtual const ColorIndex* const GetColorIndices() const = 0;
140
141   /**
142    * @brief Retrieves the text's default color.
143    *
144    * @return The default color.
145    */
146   virtual const Vector4& GetDefaultColor() const = 0;
147
148   /**
149    * @brief Retrieves the shadow offset, 0 indicates no shadow.
150    *
151    * @return The shadow offset.
152    */
153   virtual const Vector2& GetShadowOffset() const = 0;
154
155   /**
156    * @brief Retrieves the shadow color.
157    *
158    * @return The shadow color.
159    */
160   virtual const Vector4& GetShadowColor() const = 0;
161
162   /**
163    * @brief Retrieves the underline color.
164    *
165    * @return The underline color.
166    */
167   virtual const Vector4& GetUnderlineColor() const = 0;
168
169   /**
170    * @brief Returns whether underline is enabled or not.
171    *
172    * @return The underline state.
173    */
174   virtual bool IsUnderlineEnabled() const = 0;
175
176   /**
177    * @brief Retrieves the underline height override
178    *
179    * @return Returns the override height for an underline, 0 indicates that adaptor will determine the height
180    */
181   virtual float GetUnderlineHeight() const = 0;
182
183   /**
184    * @brief Retrieves the number of underline runs.
185    *
186    * @return The number of underline runs.
187    */
188   virtual Length GetNumberOfUnderlineRuns() const = 0;
189
190   /**
191    * @brief Retrieves the underline runs.
192    *
193    * @param[out] underlineRuns Pointer to a buffer where the underline runs are copied.
194    * @param[in] index Index of the first underline run to be copied.
195    * @param[in] numberOfRuns Number of underline runs to be copied.
196    */
197   virtual void GetUnderlineRuns( GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns ) const = 0;
198 };
199
200 } // namespace Text
201
202 } // namespace Toolkit
203
204 } // namespace Dali
205
206 #endif // DALI_TOOLKIT_TEXT_MODEL_INTERFACE_H