1 #ifndef DALI_TOOLKIT_INTERNAL_TEXT_VISUAL_H
2 #define DALI_TOOLKIT_INTERNAL_TEXT_VISUAL_H
5 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/common/intrusive-ptr.h>
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>
40 typedef IntrusivePtr< TextVisual > TextVisualPtr;
43 * The visual which renders text
45 * The following properties are optional:
47 * | %Property Name | Type |
48 * |---------------------|---------|
49 * | renderingBackend | INTEGER |
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 |
66 * | outline | STRING |
67 * | batchingEnabled | BOOLEAN |
70 class TextVisual : public Visual::Base
75 * @brief Create a new text visual.
77 * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
78 * @return A smart-pointer to the newly allocated visual.
80 static TextVisualPtr New( VisualFactoryCache& factoryCache );
83 * @brief Sets the text control interface which is needed to communicate with a control.
84 * @param[in] controlInterface Pointer to the control-interface.
86 void SetTextControlInterface( Text::ControlInterface* controlInterface );
88 public: // from Visual::Base
91 * @copydoc Visual::Base::GetHeightForWidth()
93 float GetHeightForWidth( float width ) const;
96 * @copydoc Visual::Base::GetNaturalSize()
98 virtual void SetSize( const Vector2& size );
101 * @copydoc Visual::Base::GetNaturalSize()
103 virtual void GetNaturalSize( Vector2& naturalSize ) const;
106 * @copydoc Visual::Base::CreatePropertyMap()
108 virtual void DoCreatePropertyMap( Property::Map& map ) const;
113 * @brief Constructor.
115 * @param[in] factoryCache The VisualFactoryCache object
117 TextVisual( VisualFactoryCache& factoryCache );
120 * @brief A reference counted object may only be deleted by calling Unreference().
122 virtual ~TextVisual();
127 * @copydoc Visual::Base::DoSetProperties()
129 virtual void DoSetProperties( const Property::Map& propertyMap );
132 * @copydoc Visual::Base::DoSetOnStage()
134 virtual void DoSetOnStage( Actor& actor );
137 * @copydoc Visual::Base::DoSetOffStage()
139 virtual void DoSetOffStage( Actor& actor );
142 *@copydoc Visual::Base::DoSetProperty
144 virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
147 * @copydoc Visual::Base::DoGetProperty
149 virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
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.
160 * @brief Stops the text auto scroll.
162 void StopTextAutoScrolling();
165 * @brief Set up Autoscrolling.
167 void SetUpAutoScrolling();
170 Text::ControllerPtr mController; ///< The text's controller.
173 Text::RendererPtr mRenderer;
174 Text::TextScrollerPtr mTextScroller;
175 Actor mRenderableActor;
177 int mRenderingBackend;
178 bool mHasBeenStaged : 1;
181 } // namespace Internal
183 } // namespace Toolkit
187 #endif /* DALI_TOOLKIT_INTERNAL_TEXT_VISUAL_H */