Remove incorrect empty Actor handle parameter from Visuals DoInitialize
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / visuals / text / text-visual.h
1 #ifndef DALI_TOOLKIT_INTERNAL_TEXT_VISUAL_H
2 #define DALI_TOOLKIT_INTERNAL_TEXT_VISUAL_H
3
4 /*
5  * Copyright (c) 2016 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
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
26 #include <dali-toolkit/internal/text/rendering/text-renderer.h>
27 #include <dali-toolkit/internal/text/text-controller.h>
28 #include <dali-toolkit/internal/text/text-scroller.h>
29
30 namespace Dali
31 {
32
33 namespace Toolkit
34 {
35
36 namespace Internal
37 {
38
39 class TextVisual;
40 typedef IntrusivePtr< TextVisual > TextVisualPtr;
41
42 /**
43  * The visual which renders text
44  *
45  * The following properties are optional:
46  *
47  * | %Property Name      | Type    |
48  * |---------------------|---------|
49  * | renderingBackend    | INTEGER |
50  * | text                | STRING  |
51  * | fontFamily          | STRING  |
52  * | fontStyle           | STRING  |
53  * | pointSize           | FLOAT   |
54  * | multiLine           | BOOLEAN |
55  * | horizontalAlignment | STRING  |
56  * | verticalAlignment   | STRING  |
57  * | textColor           | VECTOR4 |
58  * | enableMarkup        | BOOLEAN |
59  * | enableAutoScroll    | BOOLEAN |
60  * | autoScrollSpeed     | INTEGER |
61  * | autoScrollLoopCount | INTEGER |
62  * | autoScrollGap       | INTEGER |
63  * | lineSpacing         | FLOAT   |
64  * | underline           | STRING  |
65  * | shadow              | STRING  |
66  * | outline             | STRING  |
67  * | batchingEnabled     | BOOLEAN |
68  *
69  */
70 class TextVisual : public Visual::Base
71 {
72 public:
73
74   /**
75    * @brief Create a new text visual.
76    *
77    * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
78    * @return A smart-pointer to the newly allocated visual.
79    */
80   static TextVisualPtr New( VisualFactoryCache& factoryCache );
81
82   /**
83    * @brief Sets the text control interface which is needed to communicate with a control.
84    * @param[in] controlInterface Pointer to the control-interface.
85    */
86   void SetTextControlInterface( Text::ControlInterface* controlInterface );
87
88 public: // from Visual::Base
89
90   /**
91    * @copydoc Visual::Base::GetHeightForWidth()
92    */
93   float GetHeightForWidth( float width ) const;
94
95   /**
96    * @copydoc Visual::Base::GetNaturalSize()
97    */
98   virtual void SetSize( const Vector2& size );
99
100   /**
101    * @copydoc Visual::Base::GetNaturalSize()
102    */
103   virtual void GetNaturalSize( Vector2& naturalSize ) const;
104
105   /**
106    * @copydoc Visual::Base::CreatePropertyMap()
107    */
108   virtual void DoCreatePropertyMap( Property::Map& map ) const;
109
110 protected:
111
112   /**
113    * @brief Constructor.
114    *
115    * @param[in] factoryCache The VisualFactoryCache object
116    */
117   TextVisual( VisualFactoryCache& factoryCache );
118
119   /**
120    * @brief A reference counted object may only be deleted by calling Unreference().
121    */
122   virtual ~TextVisual();
123
124   // from Visual::Base
125
126   /**
127    * @copydoc Visual::Base::DoSetProperties()
128    */
129   virtual void DoSetProperties( const Property::Map& propertyMap );
130
131   /**
132    * @copydoc Visual::Base::DoSetOnStage()
133    */
134   virtual void DoSetOnStage( Actor& actor );
135
136   /**
137    * @copydoc Visual::Base::DoSetOffStage()
138    */
139   virtual void DoSetOffStage( Actor& actor );
140
141   /**
142    *@copydoc Visual::Base::DoSetProperty
143    */
144   virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
145
146   /**
147    * @copydoc Visual::Base::DoGetProperty
148    */
149   virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
150
151 private:
152
153   /**
154    * @brief Render view, create and attach actor(s) to this TextView.
155    * @todo In a next patch a new text render back-end won't add extra actors.
156    */
157   void RenderText();
158
159   /**
160    * @brief Stops the text auto scroll.
161    */
162   void StopTextAutoScrolling();
163
164   /**
165    * @brief Set up Autoscrolling.
166    */
167   void SetUpAutoScrolling();
168
169 private:
170   Text::ControllerPtr          mController;               ///< The text's controller.
171   Actor                        mSelf;
172
173   Text::RendererPtr            mRenderer;
174   Text::TextScrollerPtr        mTextScroller;
175   Actor                        mRenderableActor;
176
177   int mRenderingBackend;
178   bool mHasBeenStaged           : 1;
179 };
180
181 } // namespace Internal
182
183 } // namespace Toolkit
184
185 } // namespace Dali
186
187 #endif /* DALI_TOOLKIT_INTERNAL_TEXT_VISUAL_H */