Merge "Revert "Added UNDERLINE_HEIGHT property to TextLabel to override adaptor metri...
[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 /**
39  * @brief Abstract interface to provide the information necessary displaying text.
40  *
41  * This includes:
42  * - The font & glyph IDs needed to get bitmaps etc. from TextAbstraction
43  * - The visual position of each glyph within the layout
44  * - A window into the text layout e.g. which page of a document to view
45  */
46 class ViewInterface
47 {
48 public:
49
50   /**
51    * @brief Constructor.
52    */
53   ViewInterface();
54
55   /**
56    * @brief Virtual destructor
57    */
58   virtual ~ViewInterface();
59
60   /**
61    * Retrieves the number of glyphs.
62    *
63    * @return The number of glyphs.
64    */
65   virtual Length GetNumberOfGlyphs() const = 0;
66
67   /**
68    * @brief Retrieves glyphs in the given buffer.
69    *
70    * The size of the @p glyphs buffer needs to be big enough to copy the @p numberOfGlyphs.
71    * @param[out] glyphs Pointer to a buffer where the glyphs are copied.
72    * @param[in] glyphIndex Index to the first glyph.
73    * @param[in] numberOfGlyphs Number of glyphs to be copied.
74    */
75   virtual void GetGlyphs( GlyphInfo* glyphs,
76                           GlyphIndex glyphIndex,
77                           Length numberOfGlyphs ) const = 0;
78
79   /**
80    * @brief Retrieves the glyph positions.
81    *
82    * @pre The size of the @p positions buffer needs to be big enough to copy the @p numberOfGlyphs positions.
83    * @param[out] glyphPositions Pointer to a buffer where the glyph positions are copied.
84    * @param[in] glyphIndex Index to the first glyph position.
85    * @param[in] numberOfGlyphs The number of positions to be copied.
86    */
87   virtual void GetGlyphPositions( Vector2* glyphPositions,
88                                   GlyphIndex glyphIndex,
89                                   Length numberOfGlyphs ) const = 0;
90
91   /**
92    * @brief Retrieves the text color
93    *
94    * @return The text color
95    */
96   virtual const Vector4& GetTextColor() const = 0;
97
98   /**
99    * @brief Retrieves the shadow offset, 0 indicates no shadow.
100    *
101    * @return The shadow offset.
102    */
103   virtual const Vector2& GetShadowOffset() const = 0;
104
105   /**
106    * @brief Retrieves the shadow color.
107    *
108    * @return The shadow color.
109    */
110   virtual const Vector4& GetShadowColor() const = 0;
111
112   /**
113    * @brief Retrieves the underline color.
114    *
115    * @return The underline color.
116    */
117   virtual const Vector4& GetUnderlineColor() const = 0;
118
119   /**
120    * @brief Returns whether is underline is enabled or not.
121    *
122    * @return The underline state.
123    */
124   virtual bool IsUnderlineEnabled() const = 0;
125
126 };
127
128 } // namespace Text
129
130 } // namespace Toolkit
131
132 } // namespace Dali
133
134 #endif // __DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H__