Minimal Model/View implementation
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / public-api / text / text-view.h
1 #ifndef __DALI_TOOLKIT_TEXT_VIEW_H__
2 #define __DALI_TOOLKIT_TEXT_VIEW_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/common/intrusive-ptr.h>
23 #include <dali/public-api/object/ref-object.h>
24
25 // INTERNAL INCLUDES
26 #include <dali-toolkit/public-api/text/text-view-interface.h>
27 #include <dali-toolkit/public-api/text/visual-model.h>
28
29 namespace Dali
30 {
31
32 struct Vector2;
33
34 namespace Toolkit
35 {
36
37 namespace Text
38 {
39
40 class View;
41 typedef IntrusivePtr<View> ViewPtr;
42
43 /**
44  * @brief View provides an interface between the Text layout engine and rendering back-end.
45  */
46 class View : public RefObject, public ViewInterface
47 {
48 public:
49
50   /**
51    * @brief Create a new instance of a View.
52    *
53    * @return A pointer to a new View.
54    */
55   static ViewPtr New();
56
57   /**
58    * @brief Set the visual model.
59    *
60    * @param[in] visualModel The visual model used by the View.
61    */
62   void SetVisualModel( VisualModelPtr visualModel );
63
64   /**
65    * @copydoc Dali::Toolkit::Text::ViewInterface::GetNumberOfGlyphs()
66    */
67   virtual Length GetNumberOfGlyphs() const;
68
69   /**
70    * @copydoc Dali::Toolkit::Text::ViewInterface::GetGlyphs()
71    */
72   virtual void GetGlyphs( GlyphIndex glyphIndex,
73                           GlyphInfo* glyphs,
74                           Length numberOfGlyphs ) const;
75
76   /**
77    * @copydoc Dali::Toolkit::Text::ViewInterface::GetGlyphPositions()
78    */
79   virtual void GetGlyphPositions( GlyphIndex glyphIndex,
80                                   Vector2* glyphPositions,
81                                   Length numberOfGlyphs ) const;
82
83 protected:
84
85   /**
86    * @brief A reference counted object may only be deleted by calling Unreference().
87    */
88   virtual ~View();
89
90 private:
91
92   /**
93    * @brief Private constructor.
94    */
95   View();
96
97   // Undefined
98   View( const View& handle );
99
100   // Undefined
101   View& operator=( const View& handle );
102
103 private:
104
105   struct Impl;
106   Impl* mImpl;
107 };
108 } // namespace Text
109
110 } // namespace Toolkit
111
112 } // namespace Dali
113
114 #endif // __DALI_TOOLKIT_TEXT_VIEW_H__