Changes after Custom actor impl extension, cleanup, extension and test cases for...
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-view-interface.h
1 #ifndef __DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H__
2 #define __DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H__
3
4 /*
5  * Copyright (c) 2015 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/vector4.h>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/internal/text/text-definitions.h>
26
27 namespace Dali
28 {
29
30 struct Vector2;
31
32 namespace Toolkit
33 {
34
35 namespace Text
36 {
37
38 struct LineRun;
39
40 /**
41  * @brief Abstract interface to provide the information necessary displaying text.
42  *
43  * This includes:
44  * - The font & glyph IDs needed to get bitmaps etc. from TextAbstraction
45  * - The visual position of each glyph within the layout
46  * - A window into the text layout e.g. which page of a document to view
47  */
48 class ViewInterface
49 {
50 public:
51
52   /**
53    * @brief Constructor.
54    */
55   ViewInterface();
56
57   /**
58    * @brief Virtual destructor
59    */
60   virtual ~ViewInterface();
61
62   /**
63    * Retrieves the number of glyphs.
64    *
65    * @return The number of glyphs.
66    */
67   virtual Length GetNumberOfGlyphs() const = 0;
68
69   /**
70    * @brief Retrieves glyphs and positions in the given buffers.
71    *
72    * @note The size of the @p glyphs and @p glyphPositions buffers need to be big enough to copy the @p numberOfGlyphs glyphs and positions.
73    * @note The returned number of glyphs may be less than @p numberOfGlyphs if a line has ellipsis.
74    *
75    * @param[out] glyphs Pointer to a buffer where the glyphs are copied.
76    * @param[out] glyphPositions Pointer to a buffer where the glyph positions are copied.
77    * @param[in] glyphIndex Index to the first glyph.
78    * @param[in] numberOfGlyphs Number of glyphs to be copied.
79    *
80    * @return The number of glyphs.
81    */
82   virtual Length GetGlyphs( GlyphInfo* glyphs,
83                             Vector2* glyphPositions,
84                             GlyphIndex glyphIndex,
85                             Length numberOfGlyphs ) const = 0;
86
87   /**
88    * @brief Retrieves the text color
89    *
90    * @return The text color
91    */
92   virtual const Vector4& GetTextColor() const = 0;
93
94   /**
95    * @brief Retrieves the shadow offset, 0 indicates no shadow.
96    *
97    * @return The shadow offset.
98    */
99   virtual const Vector2& GetShadowOffset() const = 0;
100
101   /**
102    * @brief Retrieves the shadow color.
103    *
104    * @return The shadow color.
105    */
106   virtual const Vector4& GetShadowColor() const = 0;
107
108   /**
109    * @brief Retrieves the underline color.
110    *
111    * @return The underline color.
112    */
113   virtual const Vector4& GetUnderlineColor() const = 0;
114
115   /**
116    * @brief Returns whether underline is enabled or not.
117    *
118    * @return The underline state.
119    */
120   virtual bool IsUnderlineEnabled() const = 0;
121
122   /**
123    * @brief Retrieves the underline height override
124    *
125    * @return Returns the override height for an underline, 0 indicates that adaptor will determine the height
126    */
127   virtual float GetUnderlineHeight() const = 0;
128
129 };
130
131 } // namespace Text
132
133 } // namespace Toolkit
134
135 } // namespace Dali
136
137 #endif // __DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H__