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/devel-api/object/weak-handle.h>
23 #include <dali/public-api/common/intrusive-ptr.h>
26 #include <dali-toolkit/internal/visuals/visual-base-impl.h>
27 #include <dali-toolkit/internal/text/rendering/text-renderer.h>
28 #include <dali-toolkit/internal/text/text-controller.h>
29 #include <dali-toolkit/internal/text/text-scroller.h>
41 typedef IntrusivePtr< TextVisual > TextVisualPtr;
44 * The visual which renders text
46 * The following properties are optional:
48 * | %Property Name | Type |
49 * |---------------------|---------|
50 * | renderingBackend | INTEGER |
52 * | fontFamily | STRING |
53 * | fontStyle | STRING |
54 * | pointSize | FLOAT |
55 * | multiLine | BOOLEAN |
56 * | horizontalAlignment | STRING |
57 * | verticalAlignment | STRING |
58 * | textColor | VECTOR4 |
59 * | enableMarkup | BOOLEAN |
60 * | enableAutoScroll | BOOLEAN |
61 * | autoScrollSpeed | INTEGER |
62 * | autoScrollLoopCount | INTEGER |
63 * | autoScrollGap | INTEGER |
64 * | lineSpacing | FLOAT |
65 * | underline | STRING |
67 * | outline | STRING |
68 * | batchingEnabled | BOOLEAN |
71 class TextVisual : public Visual::Base
76 * @brief Create a new text visual.
78 * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object
79 * @return A smart-pointer to the newly allocated visual.
81 static TextVisualPtr New( VisualFactoryCache& factoryCache );
84 * @brief Sets the text control interface which is needed to communicate with a control.
85 * @param[in] controlInterface Pointer to the control-interface.
87 void SetTextControlInterface( Text::ControlInterface* controlInterface );
89 public: // from Visual::Base
92 * @copydoc Visual::Base::GetHeightForWidth()
94 float GetHeightForWidth( float width ) const;
97 * @copydoc Visual::Base::GetNaturalSize()
99 virtual void SetSize( const Vector2& size );
102 * @copydoc Visual::Base::GetNaturalSize()
104 virtual void GetNaturalSize( Vector2& naturalSize );
107 * @copydoc Visual::Base::CreatePropertyMap()
109 virtual void DoCreatePropertyMap( Property::Map& map ) const;
114 * @brief Constructor.
116 * @param[in] factoryCache The VisualFactoryCache object
118 TextVisual( VisualFactoryCache& factoryCache );
121 * @brief A reference counted object may only be deleted by calling Unreference().
123 virtual ~TextVisual();
128 * @copydoc Visual::Base::DoSetProperties()
130 virtual void DoSetProperties( const Property::Map& propertyMap );
133 * @copydoc Visual::Base::DoSetOnStage()
135 virtual void DoSetOnStage( Actor& actor );
138 * @copydoc Visual::Base::DoSetOffStage()
140 virtual void DoSetOffStage( Actor& actor );
143 *@copydoc Visual::Base::DoSetProperty
145 virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
148 * @copydoc Visual::Base::DoGetProperty
150 virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
155 * @brief Render view, create and attach actor(s) to this TextView.
156 * @todo In a next patch a new text render back-end won't add extra actors.
161 * @brief Stops the text auto scroll.
163 void StopTextAutoScrolling();
166 * @brief Set up Autoscrolling.
168 void SetUpAutoScrolling();
171 Text::ControllerPtr mController; ///< The text's controller.
172 WeakHandle<Actor> mSelf;
174 Text::RendererPtr mRenderer;
175 Text::TextScrollerPtr mTextScroller;
176 Actor mRenderableActor;
178 int mRenderingBackend;
179 bool mHasBeenStaged : 1;
182 } // namespace Internal
184 } // namespace Toolkit
188 #endif /* DALI_TOOLKIT_INTERNAL_TEXT_VISUAL_H */