2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit/internal/controls/text-controls/text-label-impl.h>
22 #include <dali/public-api/object/type-registry-helper.h>
23 #include <dali/integration-api/debug.h>
26 #include <dali-toolkit/public-api/text/rendering-backend.h>
27 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
28 #include <dali-toolkit/internal/text/property-string-parser.h>
29 #include <dali-toolkit/internal/text/rendering/text-backend.h>
30 #include <dali-toolkit/internal/text/text-effects-style.h>
31 #include <dali-toolkit/internal/text/text-font-style.h>
32 #include <dali-toolkit/internal/text/text-view.h>
33 #include <dali-toolkit/internal/text/text-definitions.h>
34 #include <dali-toolkit/internal/styling/style-manager-impl.h>
36 using Dali::Toolkit::Text::LayoutEngine;
37 using Dali::Toolkit::Text::Backend;
50 const unsigned int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
56 #if defined ( DEBUG_ENABLED )
57 Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, true, "LOG_TEXT_CONTROLS");
60 const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] =
62 { "BEGIN", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_BEGIN },
63 { "CENTER", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_CENTER },
64 { "END", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_END },
66 const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE ) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] );
68 const Scripting::StringEnum VERTICAL_ALIGNMENT_STRING_TABLE[] =
70 { "TOP", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_TOP },
71 { "CENTER", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_CENTER },
72 { "BOTTOM", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_BOTTOM },
74 const unsigned int VERTICAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( VERTICAL_ALIGNMENT_STRING_TABLE ) / sizeof( VERTICAL_ALIGNMENT_STRING_TABLE[0] );
79 return Toolkit::TextLabel::New();
82 // Setup properties, signals and actions using the type-registry.
83 DALI_TYPE_REGISTRATION_BEGIN( Toolkit::TextLabel, Toolkit::Control, Create );
85 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "renderingBackend", INTEGER, RENDERING_BACKEND )
86 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "text", STRING, TEXT )
87 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "fontFamily", STRING, FONT_FAMILY )
88 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "fontStyle", STRING, FONT_STYLE )
89 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "pointSize", FLOAT, POINT_SIZE )
90 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "multiLine", BOOLEAN, MULTI_LINE )
91 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "horizontalAlignment", STRING, HORIZONTAL_ALIGNMENT )
92 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "verticalAlignment", STRING, VERTICAL_ALIGNMENT )
93 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "textColor", VECTOR4, TEXT_COLOR )
94 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadowOffset", VECTOR2, SHADOW_OFFSET )
95 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadowColor", VECTOR4, SHADOW_COLOR )
96 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineEnabled", BOOLEAN, UNDERLINE_ENABLED )
97 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineColor", VECTOR4, UNDERLINE_COLOR )
98 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underlineHeight", FLOAT, UNDERLINE_HEIGHT )
99 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "enableMarkup", BOOLEAN, ENABLE_MARKUP )
100 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "enableAutoScroll", BOOLEAN, ENABLE_AUTO_SCROLL )
101 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollSpeed", INTEGER, AUTO_SCROLL_SPEED )
102 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollLoopCount", INTEGER, AUTO_SCROLL_LOOP_COUNT )
103 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollGap", FLOAT, AUTO_SCROLL_GAP )
104 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "lineSpacing", FLOAT, LINE_SPACING )
105 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underline", STRING, UNDERLINE )
106 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadow", STRING, SHADOW )
107 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "emboss", STRING, EMBOSS )
108 DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "outline", STRING, OUTLINE )
110 DALI_TYPE_REGISTRATION_END()
116 Toolkit::TextLabel TextLabel::New()
118 // Create the implementation, temporarily owned by this handle on stack
119 IntrusivePtr< TextLabel > impl = new TextLabel();
121 // Pass ownership to CustomActor handle
122 Toolkit::TextLabel handle( *impl );
124 // Second-phase init of the implementation
125 // This can only be done after the CustomActor connection has been made...
131 void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
133 Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( Dali::BaseHandle( object ) );
137 TextLabel& impl( GetImpl( label ) );
140 case Toolkit::TextLabel::Property::RENDERING_BACKEND:
142 int backend = value.Get< int >();
144 #ifndef ENABLE_VECTOR_BASED_TEXT_RENDERING
145 if( Text::RENDERING_VECTOR_BASED == backend )
147 backend = TextAbstraction::BITMAP_GLYPH; // Fallback to bitmap-based rendering
150 if( impl.mRenderingBackend != backend )
152 impl.mRenderingBackend = backend;
153 impl.mRenderer.Reset();
155 if( impl.mController )
157 // When using the vector-based rendering, the size of the GLyphs are different
158 TextAbstraction::GlyphType glyphType = (Text::RENDERING_VECTOR_BASED == impl.mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH;
159 impl.mController->SetGlyphType( glyphType );
164 case Toolkit::TextLabel::Property::TEXT:
166 if( impl.mController )
168 impl.mController->SetText( value.Get< std::string >() );
172 case Toolkit::TextLabel::Property::FONT_FAMILY:
174 if( impl.mController )
176 const std::string fontFamily = value.Get< std::string >();
178 DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextLabel::SetProperty Property::FONT_FAMILY newFont(%s)\n", fontFamily.c_str() );
179 impl.mController->SetDefaultFontFamily( fontFamily );
183 case Toolkit::TextLabel::Property::FONT_STYLE:
185 SetFontStyleProperty( impl.mController, value, Text::FontStyle::DEFAULT );
188 case Toolkit::TextLabel::Property::POINT_SIZE:
190 if( impl.mController )
192 const float pointSize = value.Get< float >();
194 if( !Equals( impl.mController->GetDefaultPointSize(), pointSize ) )
196 impl.mController->SetDefaultPointSize( pointSize );
201 case Toolkit::TextLabel::Property::MULTI_LINE:
203 if( impl.mController )
205 impl.mController->SetMultiLineEnabled( value.Get< bool >() );
209 case Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT:
211 if( impl.mController )
213 LayoutEngine::HorizontalAlignment alignment( LayoutEngine::HORIZONTAL_ALIGN_BEGIN );
214 if( Scripting::GetEnumeration< Toolkit::Text::LayoutEngine::HorizontalAlignment >( value.Get< std::string >().c_str(),
215 HORIZONTAL_ALIGNMENT_STRING_TABLE,
216 HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT,
219 impl.mController->SetHorizontalAlignment( alignment );
224 case Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT:
226 if( impl.mController )
228 LayoutEngine::VerticalAlignment alignment( LayoutEngine::VERTICAL_ALIGN_BOTTOM );
229 if( Scripting::GetEnumeration< Toolkit::Text::LayoutEngine::VerticalAlignment >( value.Get< std::string >().c_str(),
230 VERTICAL_ALIGNMENT_STRING_TABLE,
231 VERTICAL_ALIGNMENT_STRING_TABLE_COUNT,
234 impl.mController->SetVerticalAlignment( alignment );
240 case Toolkit::TextLabel::Property::TEXT_COLOR:
242 if( impl.mController )
244 const Vector4 textColor = value.Get< Vector4 >();
245 if( impl.mController->GetTextColor() != textColor )
247 impl.mController->SetTextColor( textColor );
248 impl.mRenderer.Reset();
254 case Toolkit::TextLabel::Property::SHADOW_OFFSET:
256 if( impl.mController )
258 const Vector2 shadowOffset = value.Get< Vector2 >();
259 if ( impl.mController->GetShadowOffset() != shadowOffset )
261 impl.mController->SetShadowOffset( shadowOffset );
262 impl.mRenderer.Reset();
267 case Toolkit::TextLabel::Property::SHADOW_COLOR:
269 if( impl.mController )
271 const Vector4 shadowColor = value.Get< Vector4 >();
272 if ( impl.mController->GetShadowColor() != shadowColor )
274 impl.mController->SetShadowColor( shadowColor );
275 impl.mRenderer.Reset();
280 case Toolkit::TextLabel::Property::UNDERLINE_COLOR:
282 if( impl.mController )
284 const Vector4 color = value.Get< Vector4 >();
285 if ( impl.mController->GetUnderlineColor() != color )
287 impl.mController->SetUnderlineColor( color );
288 impl.mRenderer.Reset();
293 case Toolkit::TextLabel::Property::UNDERLINE_ENABLED:
295 if( impl.mController )
297 const bool enabled = value.Get< bool >();
298 if ( impl.mController->IsUnderlineEnabled() != enabled )
300 impl.mController->SetUnderlineEnabled( enabled );
301 impl.mRenderer.Reset();
307 case Toolkit::TextLabel::Property::UNDERLINE_HEIGHT:
309 if( impl.mController )
311 float height = value.Get< float >();
312 if( fabsf( impl.mController->GetUnderlineHeight() - height ) > Math::MACHINE_EPSILON_1000 )
314 impl.mController->SetUnderlineHeight( height );
315 impl.mRenderer.Reset();
320 case Toolkit::TextLabel::Property::ENABLE_MARKUP:
322 if( impl.mController )
324 const bool enableMarkup = value.Get<bool>();
325 impl.mController->SetMarkupProcessorEnabled( enableMarkup );
329 case Toolkit::TextLabel::Property::ENABLE_AUTO_SCROLL:
331 if( impl.mController )
333 const bool enableAutoScroll = value.Get<bool>();
334 // If request to auto scroll is the same as current state then do nothing.
335 if ( enableAutoScroll != impl.mController->IsAutoScrollEnabled() )
337 // If request is disable (false) and auto scrolling is enabled then need to stop it
338 if ( enableAutoScroll == false )
340 if( impl.mTextScroller )
342 impl.mTextScroller->SetLoopCount( 0 ); // Causes the current animation to finish playing (0)
345 // If request is enable (true) then start autoscroll as not already running
348 impl.mController->GetLayoutEngine().SetTextEllipsisEnabled( false );
349 impl.mController->SetAutoScrollEnabled( enableAutoScroll );
355 case Toolkit::TextLabel::Property::AUTO_SCROLL_SPEED:
357 if( !impl.mTextScroller )
359 impl.mTextScroller = Text::TextScroller::New( impl );
361 impl.mTextScroller->SetSpeed( value.Get<int>() );
364 case Toolkit::TextLabel::Property::AUTO_SCROLL_LOOP_COUNT:
366 if( !impl.mTextScroller )
368 impl.mTextScroller = Text::TextScroller::New( impl );
370 impl.mTextScroller->SetLoopCount( value.Get<int>() );
373 case Toolkit::TextLabel::Property::AUTO_SCROLL_GAP:
375 if( !impl.mTextScroller )
377 impl.mTextScroller = Text::TextScroller::New( impl );
379 impl.mTextScroller->SetGap( value.Get<float>() );
382 case Toolkit::TextLabel::Property::LINE_SPACING:
384 if( impl.mController )
386 const float lineSpacing = value.Get<float>();
387 impl.mController->SetDefaultLineSpacing( lineSpacing );
388 impl.mRenderer.Reset();
392 case Toolkit::TextLabel::Property::UNDERLINE:
394 const bool update = SetUnderlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
397 impl.mRenderer.Reset();
401 case Toolkit::TextLabel::Property::SHADOW:
403 const bool update = SetShadowProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
406 impl.mRenderer.Reset();
410 case Toolkit::TextLabel::Property::EMBOSS:
412 const bool update = SetEmbossProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
415 impl.mRenderer.Reset();
419 case Toolkit::TextLabel::Property::OUTLINE:
421 const bool update = SetOutlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
424 impl.mRenderer.Reset();
432 Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index index )
434 Property::Value value;
436 Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( Dali::BaseHandle( object ) );
440 TextLabel& impl( GetImpl( label ) );
443 case Toolkit::TextLabel::Property::RENDERING_BACKEND:
445 value = impl.mRenderingBackend;
448 case Toolkit::TextLabel::Property::TEXT:
450 if( impl.mController )
453 impl.mController->GetText( text );
458 case Toolkit::TextLabel::Property::FONT_FAMILY:
460 if( impl.mController )
462 value = impl.mController->GetDefaultFontFamily();
466 case Toolkit::TextLabel::Property::FONT_STYLE:
468 GetFontStyleProperty( impl.mController, value, Text::FontStyle::DEFAULT );
471 case Toolkit::TextLabel::Property::POINT_SIZE:
473 if( impl.mController )
475 value = impl.mController->GetDefaultPointSize();
479 case Toolkit::TextLabel::Property::MULTI_LINE:
481 if( impl.mController )
483 value = impl.mController->IsMultiLineEnabled();
487 case Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT:
489 if( impl.mController )
491 const char* name = Scripting::GetEnumerationName< Toolkit::Text::LayoutEngine::HorizontalAlignment >( impl.mController->GetHorizontalAlignment(),
492 HORIZONTAL_ALIGNMENT_STRING_TABLE,
493 HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
496 value = std::string( name );
501 case Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT:
503 if( impl.mController )
505 const char* name = Scripting::GetEnumerationName< Toolkit::Text::LayoutEngine::VerticalAlignment >( impl.mController->GetVerticalAlignment(),
506 VERTICAL_ALIGNMENT_STRING_TABLE,
507 VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
510 value = std::string( name );
515 case Toolkit::TextLabel::Property::TEXT_COLOR:
517 if ( impl.mController )
519 value = impl.mController->GetTextColor();
523 case Toolkit::TextLabel::Property::SHADOW_OFFSET:
525 if ( impl.mController )
527 value = impl.mController->GetShadowOffset();
531 case Toolkit::TextLabel::Property::SHADOW_COLOR:
533 if ( impl.mController )
535 value = impl.mController->GetShadowColor();
539 case Toolkit::TextLabel::Property::UNDERLINE_COLOR:
541 if ( impl.mController )
543 value = impl.mController->GetUnderlineColor();
547 case Toolkit::TextLabel::Property::UNDERLINE_ENABLED:
549 if ( impl.mController )
551 value = impl.mController->IsUnderlineEnabled();
555 case Toolkit::TextLabel::Property::UNDERLINE_HEIGHT:
557 if ( impl.mController )
559 value = impl.mController->GetUnderlineHeight();
563 case Toolkit::TextLabel::Property::ENABLE_MARKUP:
565 if( impl.mController )
567 value = impl.mController->IsMarkupProcessorEnabled();
571 case Toolkit::TextLabel::Property::ENABLE_AUTO_SCROLL:
573 if( impl.mController )
575 value = impl.mController->IsAutoScrollEnabled();
579 case Toolkit::TextLabel::Property::AUTO_SCROLL_SPEED:
581 TextLabel& impl( GetImpl( label ) );
582 if ( impl.mTextScroller )
584 value = impl.mTextScroller->GetSpeed();
588 case Toolkit::TextLabel::Property::AUTO_SCROLL_LOOP_COUNT:
590 if( impl.mController )
592 TextLabel& impl( GetImpl( label ) );
593 if ( impl.mTextScroller )
595 value = impl.mTextScroller->GetLoopCount();
600 case Toolkit::TextLabel::Property::AUTO_SCROLL_GAP:
602 TextLabel& impl( GetImpl( label ) );
603 if ( impl.mTextScroller )
605 value = impl.mTextScroller->GetGap();
609 case Toolkit::TextLabel::Property::LINE_SPACING:
611 if( impl.mController )
613 value = impl.mController->GetDefaultLineSpacing();
617 case Toolkit::TextLabel::Property::UNDERLINE:
619 GetUnderlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
622 case Toolkit::TextLabel::Property::SHADOW:
624 GetShadowProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
627 case Toolkit::TextLabel::Property::EMBOSS:
629 GetEmbossProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
632 case Toolkit::TextLabel::Property::OUTLINE:
634 GetOutlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
643 void TextLabel::OnInitialize()
647 mController = Text::Controller::New( this );
649 // When using the vector-based rendering, the size of the GLyphs are different
650 TextAbstraction::GlyphType glyphType = (Text::RENDERING_VECTOR_BASED == mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH;
651 mController->SetGlyphType( glyphType );
653 // Use height-for-width negotiation by default
654 self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
655 self.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
657 // Enable the text ellipsis.
658 LayoutEngine& engine = mController->GetLayoutEngine();
660 engine.SetTextEllipsisEnabled( true ); // If false then text larger than control will overflow
661 engine.SetCursorWidth( 0u ); // Do not layout space for the cursor.
663 self.OnStageSignal().Connect( this, &TextLabel::OnStageConnect );
666 void TextLabel::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
668 DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextLabel::OnStyleChange\n");
672 case StyleChange::DEFAULT_FONT_CHANGE:
674 // Property system did not set the font so should update it.
675 const std::string& newFont = GetImpl( styleManager ).GetDefaultFontFamily();
676 DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::OnStyleChange StyleChange::DEFAULT_FONT_CHANGE newFont(%s)\n", newFont.c_str() );
677 mController->UpdateAfterFontChange( newFont );
682 case StyleChange::DEFAULT_FONT_SIZE_CHANGE:
684 GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
688 case StyleChange::THEME_CHANGE:
690 GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) );
697 Vector3 TextLabel::GetNaturalSize()
699 return mController->GetNaturalSize();
702 float TextLabel::GetHeightForWidth( float width )
704 return mController->GetHeightForWidth( width );
707 void TextLabel::OnRelayout( const Vector2& size, RelayoutContainer& container )
709 DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::OnRelayout\n" );
711 const Text::Controller::UpdateTextType updateTextType = mController->Relayout( size );
713 if( ( Text::Controller::NONE_UPDATED != ( Text::Controller::MODEL_UPDATED & updateTextType ) ) ||
718 mRenderer = Backend::Get().NewRenderer( mRenderingBackend );
724 void TextLabel::RequestTextRelayout()
729 void TextLabel::RenderText()
731 DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::RenderText IsAutoScrollEnabled[%s] [%p]\n", ( mController->IsAutoScrollEnabled())?"true":"false", this );
734 Actor renderableActor;
736 float alignmentOffset = 0.f;
739 renderableActor = mRenderer->Render( mController->GetView(),
744 if( renderableActor != mRenderableActor )
746 UnparentAndReset( mRenderableActor );
748 if( renderableActor )
750 const Vector2& scrollOffset = mController->GetScrollPosition();
751 renderableActor.SetPosition( scrollOffset.x + alignmentOffset, scrollOffset.y );
753 self.Add( renderableActor );
755 mRenderableActor = renderableActor;
757 if ( mController->IsAutoScrollEnabled() )
759 SetUpAutoScrolling();
764 void TextLabel::SetUpAutoScrolling()
766 const Size& controlSize = mController->GetView().GetControlSize();
767 const Size offScreenSize = GetNaturalSize().GetVectorXY(); // As relayout of text may not be done at this point natural size is used to get size. Single line scrolling only.
768 const float alignmentOffset = mController->GetAutoScrollLineAlignment();
769 const Text::CharacterDirection direction = mController->GetAutoScrollDirection();
771 DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::SetUpAutoScrolling alignmentOffset[%f] offScreenSize[%f,%f] controlSize[%f,%f]\n",
772 alignmentOffset, offScreenSize.x,offScreenSize.y , controlSize.x,controlSize.y );
774 if ( !mTextScroller )
776 DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::SetUpAutoScrolling Creating default TextScoller\n" );
778 // If speed, loopCount or gap not set via property system then will need to create a TextScroller with defaults
779 mTextScroller = Text::TextScroller::New( *this );
781 mTextScroller->SetParameters( mRenderableActor, controlSize, offScreenSize, direction, alignmentOffset );
784 self.Add( mTextScroller->GetScrollingText() );
785 self.Add( mTextScroller->GetSourceCamera() );
788 void TextLabel::OnStageConnect( Dali::Actor actor )
790 if ( mHasBeenStaged )
796 mHasBeenStaged = true;
800 void TextLabel::OnStageConnection( int depth )
802 // Call the Control::OnStageConnection() to set the depth of the background.
803 Control::OnStageConnection( depth );
805 // The depth of the text renderer is set in the RenderText() called from OnRelayout().
808 void TextLabel::ScrollingFinished()
810 // Pure Virtual from TextScroller Interface
811 DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::ScrollingFinished\n");
812 mController->SetAutoScrollEnabled( false );
813 mController->GetLayoutEngine().SetTextEllipsisEnabled( true );
814 RequestTextRelayout();
817 TextLabel::TextLabel()
818 : Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
819 mRenderingBackend( DEFAULT_RENDERING_BACKEND ),
820 mHasBeenStaged( false )
824 TextLabel::~TextLabel()
828 } // namespace Internal
830 } // namespace Toolkit