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>
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 );
82 public: // from Visual::Base
85 * @copydoc Visual::Base::GetHeightForWidth()
87 float GetHeightForWidth( float width ) const;
90 * @copydoc Visual::Base::GetNaturalSize()
92 virtual void SetSize( const Vector2& size );
95 * @copydoc Visual::Base::GetNaturalSize()
97 virtual void GetNaturalSize( Vector2& naturalSize );
100 * @copydoc Visual::Base::CreatePropertyMap()
102 virtual void DoCreatePropertyMap( Property::Map& map ) const;
107 * @brief Constructor.
109 * @param[in] factoryCache The VisualFactoryCache object
111 TextVisual( VisualFactoryCache& factoryCache );
114 * @brief A reference counted object may only be deleted by calling Unreference().
116 virtual ~TextVisual();
121 * @copydoc Visual::Base::DoSetProperties()
123 virtual void DoSetProperties( const Property::Map& propertyMap );
126 * @copydoc Visual::Base::DoSetOnStage()
128 virtual void DoSetOnStage( Actor& actor );
131 * @copydoc Visual::Base::DoSetOffStage()
133 virtual void DoSetOffStage( Actor& actor );
136 *@copydoc Visual::Base::DoSetProperty
138 virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
141 * @copydoc Visual::Base::DoGetProperty
143 virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
148 * @brief Render view, create and attach actor(s) to this TextView.
149 * @todo In a next patch a new text render back-end won't add extra actors.
154 Text::ControllerPtr mController; ///< The text's controller.
155 WeakHandle<Actor> mSelf;
157 Text::RendererPtr mRenderer;
158 Actor mRenderableActor;
160 int mRenderingBackend;
161 bool mHasBeenStaged : 1;
164 } // namespace Internal
166 } // namespace Toolkit
170 #endif /* DALI_TOOLKIT_INTERNAL_TEXT_VISUAL_H */