Skeleton Decorator API
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / 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/public-api/text/text-definitions.h>
23
24 namespace Dali
25 {
26
27 struct Vector2;
28
29 namespace Toolkit
30 {
31
32 namespace Text
33 {
34
35 /**
36  * @brief Abstract interface to provide the information necessary displaying text.
37  *
38  * This includes:
39  * - The font & glyph IDs needed to get bitmaps etc. from TextAbstraction
40  * - The visual position of each glyph within the layout
41  * - A window into the text layout e.g. which page of a document to view
42  */
43 class ViewInterface
44 {
45 public:
46
47   /**
48    * @brief Constructor.
49    */
50   ViewInterface();
51
52   /**
53    * @brief Virtual destructor
54    */
55   virtual ~ViewInterface();
56
57   /**
58    * Retrieves the number of glyphs.
59    *
60    * @return The number of glyphs.
61    */
62   virtual Length GetNumberOfGlyphs() const = 0;
63
64   /**
65    * @brief Retrieves glyphs in the given buffer.
66    *
67    * The size of the @p glyphs buffer needs to be big enough to copy the @p numberOfGlyphs.
68    * @param[out] glyphs Pointer to a buffer where the glyphs are copied.
69    * @param[in] glyphIndex Index to the first glyph.
70    * @param[in] numberOfGlyphs Number of glyphs to be copied.
71    */
72   virtual void GetGlyphs( GlyphIndex glyphIndex,
73                           GlyphInfo* glyphs,
74                           Length numberOfGlyphs ) const = 0;
75
76   /**
77    * @brief Retrieves the glyph positions.
78    *
79    * @pre The size of the @p positions buffer needs to be big enough to copy the @p numberOfGlyphs positions.
80    * @param[in] glyphIndex Index to the first glyph position.
81    * @param[out] glyphPositions Pointer to a buffer where the glyph positions are copied.
82    * @param[in] numberOfGlyphs The number of positions to be copied.
83    */
84   virtual void GetGlyphPositions( GlyphIndex glyphIndex,
85                                   Vector2* glyphPositions,
86                                   Length numberOfGlyphs ) const = 0;
87 };
88
89 } // namespace Text
90
91 } // namespace Toolkit
92
93 } // namespace Dali
94
95 #endif // __DALI_TOOLKIT_TEXT_VIEW_INTERFACE_H__