DALi Version 2.1.5
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-view.h
1 #ifndef DALI_TOOLKIT_TEXT_VIEW_H
2 #define DALI_TOOLKIT_TEXT_VIEW_H
3
4 /*
5  * Copyright (c) 2021 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 // INTERNAL INCLUDES
22 #include <dali-toolkit/internal/text/text-view-interface.h>
23 #include <dali-toolkit/internal/text/visual-model-impl.h>
24
25 namespace Dali
26 {
27 namespace Toolkit
28 {
29 namespace Text
30 {
31 /**
32  * @brief View provides an interface between the Text layout engine and rendering back-end.
33  */
34 class View : public ViewInterface
35 {
36 public:
37   /**
38    * @brief Create a new instance of a View.
39    */
40   View();
41
42   /**
43    * @brief Virtual destructor.
44    */
45   virtual ~View();
46
47   /**
48    * @brief Set the visual model.
49    *
50    * @param[in] visualModel The visual model used by the View.
51    */
52   void SetVisualModel(VisualModelPtr visualModel);
53
54   /**
55    * @copydoc Dali::Toolkit::Text::ViewInterface::GetControlSize()
56    */
57   const Vector2& GetControlSize() const override;
58
59   /**
60    * @copydoc Dali::Toolkit::Text::ViewInterface::GetLayoutSize()
61    */
62   const Vector2& GetLayoutSize() const override;
63
64   /**
65    * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfGlyphs()
66    */
67   Length GetNumberOfGlyphs() const override;
68
69   /**
70    * @copydoc Dali::Toolkit::Text::ViewInterface::GetGlyphs()
71    */
72   virtual Length GetGlyphs(GlyphInfo* glyphs,
73                            Vector2*   glyphPositions,
74                            float&     minLineOffset,
75                            GlyphIndex glyphIndex,
76                            Length     numberOfGlyphs) const;
77
78   /**
79    * @copydoc Dali::Toolkit::Text::ViewInterface::GetColors()
80    */
81   const Vector4* const GetColors() const override;
82
83   /**
84    * @copydoc Dali::Toolkit::Text::ViewInterface::GetColorIndices()
85    */
86   const ColorIndex* const GetColorIndices() const override;
87
88   /**
89    * @copydoc Dali::Toolkit::Text::ViewInterface::GetBackgroundColors()
90    */
91   const Vector4* const GetBackgroundColors() const override;
92
93   /**
94    * @copydoc Dali::Toolkit::Text::ViewInterface::GetBackgroundColorIndices()
95    */
96   const ColorIndex* const GetBackgroundColorIndices() const override;
97
98   /**
99    * @copydoc Dali::Toolkit::Text::ViewInterface::IsMarkupBackgroundColorSet()
100    */
101   bool const IsMarkupBackgroundColorSet() const;
102
103   /**
104    * @copydoc Dali::Toolkit::Text::ViewInterface::GetTextColor()
105    */
106   const Vector4& GetTextColor() const override;
107
108   /**
109    * @copydoc Dali::Toolkit::Text::ViewInterface::GetShadowOffset()
110    */
111   const Vector2& GetShadowOffset() const override;
112
113   /**
114    * @copydoc Dali::Toolkit::Text::ViewInterface::GetShadowColor()
115    */
116   const Vector4& GetShadowColor() const override;
117
118   /**
119    * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineColor()
120    */
121   const Vector4& GetUnderlineColor() const override;
122
123   /**
124    * @copydoc Dali::Toolkit::Text::ViewInterface::IsUnderlineEnabled()
125    */
126   bool IsUnderlineEnabled() const override;
127
128   /**
129   * @copydoc Dali::Toolkit::Text::ViewInterface::GetHyphens()
130   */
131   const GlyphInfo* GetHyphens() const override;
132
133   /**
134   * @copydoc Dali::Toolkit::Text::ViewInterface::GetHyphens()
135   */
136   const Length* GetHyphenIndices() const override;
137
138   /**
139   * @copydoc Dali::Toolkit::Text::ViewInterface::GetHyphens()
140   */
141   Length GetHyphensCount() const override;
142
143   /**
144    * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineHeight()
145    */
146   float GetUnderlineHeight() const override;
147
148   /**
149    * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineType()
150    */
151   Text::Underline::Type GetUnderlineType() const override;
152
153   /**
154    * @copydoc Dali::Toolkit::Text::ViewInterface::GetDashedUnderlineWidth()
155    */
156   float GetDashedUnderlineWidth() const override;
157
158   /**
159    * @copydoc Dali::Toolkit::Text::ViewInterface::GetDashedUnderlineGap()
160    */
161   float GetDashedUnderlineGap() const override;
162
163   /**
164    * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfUnderlineRuns()
165    */
166   Length GetNumberOfUnderlineRuns() const override;
167
168   /**
169    * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineRuns()
170    */
171   virtual void GetUnderlineRuns(GlyphRun*         underlineRuns,
172                                 UnderlineRunIndex index,
173                                 Length            numberOfRuns) const;
174
175   /**
176    * @copydoc Dali::Toolkit::Text::ViewInterface::GetOutlineColor()
177    */
178   const Vector4& GetOutlineColor() const override;
179
180   /**
181    * @copydoc Dali::Toolkit::Text::ViewInterface::GetOutlineWidth()
182    */
183   uint16_t GetOutlineWidth() const override;
184
185   /**
186   * @copydoc Dali::Toolkit::Text::ViewInterface::GetEllipsisPosition()
187   */
188   DevelText::EllipsisPosition::Type GetEllipsisPosition() const override;
189
190   /**
191    * @copydoc Dali::Toolkit::Text::ViewInterface::IsTextElideEnabled()
192    */
193   bool IsTextElideEnabled() const override;
194
195   /**
196    * @copydoc Dali::Toolkit::Text::ViewInterface::GetStartIndexOfElidedGlyphs()
197    */
198   GlyphIndex GetStartIndexOfElidedGlyphs() const override;
199
200   /**
201    * @copydoc Dali::Toolkit::Text::ViewInterface::GetEndIndexOfElidedGlyphs()
202    */
203   GlyphIndex GetEndIndexOfElidedGlyphs() const override;
204
205   /**
206    * @copydoc Dali::Toolkit::Text::ViewInterface::GetFirstMiddleIndexOfElidedGlyphs()
207    */
208   GlyphIndex GetFirstMiddleIndexOfElidedGlyphs() const override;
209
210   /**
211    * @copydoc Dali::Toolkit::Text::ViewInterface::GetSecondMiddleIndexOfElidedGlyphs()
212    */
213   GlyphIndex GetSecondMiddleIndexOfElidedGlyphs() const override;
214
215   /**
216    * @copydoc Dali::Toolkit::Text::ViewInterface::GetStrikethroughColor()
217    */
218   const Vector4& GetStrikethroughColor() const override;
219
220   /**
221    * @copydoc Dali::Toolkit::Text::ViewInterface::IsStrikethroughEnabled()
222    */
223   bool IsStrikethroughEnabled() const override;
224
225   /**
226    * @copydoc Dali::Toolkit::Text::ViewInterface::GetStrikethroughHeight()
227    */
228   float GetStrikethroughHeight() const override;
229
230 private:
231   // Undefined
232   View(const View& handle);
233
234   // Undefined
235   View& operator=(const View& handle);
236
237 private:
238   struct Impl;
239   Impl* mImpl;
240 };
241 } // namespace Text
242
243 } // namespace Toolkit
244
245 } // namespace Dali
246
247 #endif // DALI_TOOLKIT_TEXT_VIEW_H