Text improvement
[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) 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 // 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
28 namespace Toolkit
29 {
30
31 namespace Text
32 {
33
34 /**
35  * @brief View provides an interface between the Text layout engine and rendering back-end.
36  */
37 class View : public ViewInterface
38 {
39 public:
40
41   /**
42    * @brief Create a new instance of a View.
43    */
44   View();
45
46   /**
47    * @brief Virtual destructor.
48    */
49   virtual ~View();
50
51   /**
52    * @brief Set the visual model.
53    *
54    * @param[in] visualModel The visual model used by the View.
55    */
56   void SetVisualModel( VisualModelPtr visualModel );
57
58   /**
59    * @copydoc Dali::Toolkit::Text::ViewInterface::GetControlSize()
60    */
61   virtual const Vector2& GetControlSize() const;
62
63   /**
64    * @copydoc Dali::Toolkit::Text::ViewInterface::GetLayoutSize()
65    */
66   virtual const Vector2& GetLayoutSize() const;
67
68   /**
69    * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfGlyphs()
70    */
71   virtual Length GetNumberOfGlyphs() const;
72
73   /**
74    * @copydoc Dali::Toolkit::Text::ViewInterface::GetGlyphs()
75    */
76   virtual Length GetGlyphs( GlyphInfo* glyphs,
77                             Vector2* glyphPositions,
78                             float& minLineOffset,
79                             GlyphIndex glyphIndex,
80                             Length numberOfGlyphs ) const;
81
82   /**
83    * @copydoc Dali::Toolkit::Text::ViewInterface::GetColors()
84    */
85   virtual const Vector4* const GetColors() const;
86
87   /**
88    * @copydoc Dali::Toolkit::Text::ViewInterface::GetColorIndices()
89    */
90   virtual const ColorIndex* const GetColorIndices() const;
91
92   /**
93    * @copydoc Dali::Toolkit::Text::ViewInterface::GetTextColor()
94    */
95   virtual const Vector4& GetTextColor() const;
96
97   /**
98    * @copydoc Dali::Toolkit::Text::ViewInterface::GetShadowOffset()
99    */
100   virtual const Vector2& GetShadowOffset() const;
101
102   /**
103    * @copydoc Dali::Toolkit::Text::ViewInterface::GetShadowColor()
104    */
105   virtual const Vector4& GetShadowColor() const;
106
107   /**
108    * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineColor()
109    */
110   virtual const Vector4& GetUnderlineColor() const;
111
112   /**
113    * @copydoc Dali::Toolkit::Text::ViewInterface::IsUnderlineEnabled()
114    */
115   virtual bool IsUnderlineEnabled() const;
116
117   /**
118    * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineHeight()
119    */
120   virtual float GetUnderlineHeight() const;
121
122   /**
123    * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfUnderlineRuns()
124    */
125   virtual Length GetNumberOfUnderlineRuns() const;
126
127   /**
128    * @copydoc Dali::Toolkit::Text::ViewInterface::GetUnderlineRuns()
129    */
130   virtual void GetUnderlineRuns( GlyphRun* underlineRuns,
131                                  UnderlineRunIndex index,
132                                  Length numberOfRuns ) const;
133
134   /**
135    * @copydoc Dali::Toolkit::Text::ViewInterface::GetOutlineColor()
136    */
137   virtual const Vector4& GetOutlineColor() const;
138
139   /**
140    * @copydoc Dali::Toolkit::Text::ViewInterface::GetOutlineWidth()
141    */
142   virtual uint16_t GetOutlineWidth() const;
143
144 private:
145
146   // Undefined
147   View( const View& handle );
148
149   // Undefined
150   View& operator=( const View& handle );
151
152 private:
153
154   struct Impl;
155   Impl* mImpl;
156 };
157 } // namespace Text
158
159 } // namespace Toolkit
160
161 } // namespace Dali
162
163 #endif // DALI_TOOLKIT_TEXT_VIEW_H