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