3790fd0418961115a5d3a223c677bf7fea5f538c
[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::GetTextColor()
100    */
101   const Vector4& GetTextColor() const override;
102
103   /**
104    * @copydoc Dali::Toolkit::Text::ViewInterface::GetShadowOffset()
105    */
106   const Vector2& GetShadowOffset() const override;
107
108   /**
109    * @copydoc Dali::Toolkit::Text::ViewInterface::GetShadowColor()
110    */
111   const Vector4& GetShadowColor() const override;
112
113   /**
114    * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineColor()
115    */
116   const Vector4& GetUnderlineColor() const override;
117
118   /**
119    * @copydoc Dali::Toolkit::Text::ViewInterface::IsUnderlineEnabled()
120    */
121   bool IsUnderlineEnabled() const override;
122
123   /**
124   * @copydoc Dali::Toolkit::Text::ViewInterface::GetHyphens()
125   */
126   const GlyphInfo* GetHyphens() const override;
127
128   /**
129   * @copydoc Dali::Toolkit::Text::ViewInterface::GetHyphens()
130   */
131   const Length* GetHyphenIndices() const override;
132
133   /**
134   * @copydoc Dali::Toolkit::Text::ViewInterface::GetHyphens()
135   */
136   Length GetHyphensCount() const override;
137
138   /**
139    * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineHeight()
140    */
141   float GetUnderlineHeight() const override;
142
143   /**
144    * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfUnderlineRuns()
145    */
146   Length GetNumberOfUnderlineRuns() const override;
147
148   /**
149    * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineRuns()
150    */
151   virtual void GetUnderlineRuns(GlyphRun*         underlineRuns,
152                                 UnderlineRunIndex index,
153                                 Length            numberOfRuns) const;
154
155   /**
156    * @copydoc Dali::Toolkit::Text::ViewInterface::GetOutlineColor()
157    */
158   const Vector4& GetOutlineColor() const override;
159
160   /**
161    * @copydoc Dali::Toolkit::Text::ViewInterface::GetOutlineWidth()
162    */
163   uint16_t GetOutlineWidth() const override;
164
165 private:
166   // Undefined
167   View(const View& handle);
168
169   // Undefined
170   View& operator=(const View& handle);
171
172 private:
173   struct Impl;
174   Impl* mImpl;
175 };
176 } // namespace Text
177
178 } // namespace Toolkit
179
180 } // namespace Dali
181
182 #endif // DALI_TOOLKIT_TEXT_VIEW_H