X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-controls%2Ftext-label-impl.cpp;h=ce08f89473c2c5b438aeb499e0bc00439736fc37;hp=065d0f95c2483a37409e45580884e946b94d0d82;hb=785904f5477a648bc0005dcbb39bd3a85077e32d;hpb=4b9580f45559ab748c5eb33cbe4a771de88770cf diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index 065d0f9..ce08f89 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include using Dali::Toolkit::Text::LayoutEngine; @@ -50,6 +51,10 @@ namespace namespace { +#if defined(DEBUG_ENABLED) + Debug::Filter* gLogFilter = Debug::Filter::New(Debug::Concise, true, "LOG_TEXT_CONTROLS"); +#endif + const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] = { { "BEGIN", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_BEGIN }, @@ -146,7 +151,7 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr if( impl.mController->GetDefaultFontFamily() != fontFamily ) { - impl.mController->SetDefaultFontFamily( fontFamily ); + impl.mController->SetDefaultFontFamily( fontFamily, true ); } } break; @@ -458,7 +463,39 @@ void TextLabel::OnInitialize() void TextLabel::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change ) { - GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) ); + + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextLabel::OnStyleChange\n"); + + switch ( change ) + { + case StyleChange::DEFAULT_FONT_CHANGE: + { + DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::OnStyleChange StyleChange::DEFAULT_FONT_CHANGE\n"); + if ( mController->GetDefaultFontFamily() == "" ) + { + // Property system did not set the font so should update it. + // todo instruct text-controller to update model + } + break; + } + + case StyleChange::DEFAULT_FONT_SIZE_CHANGE: + { + DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::OnStyleChange StyleChange::DEFAULT_FONT_SIZE_CHANGE (%f)\n", mController->GetDefaultPointSize() ); + + if ( (mController->GetDefaultPointSize() <= 0.0f) ) // If DefaultPointSize not set by Property system it will be 0.0f + { + // Property system did not set the PointSize so should update it. + // todo instruct text-controller to update model + } + break; + } + case StyleChange::THEME_CHANGE: + { + GetImpl( styleManager ).ApplyThemeStyle( Toolkit::Control( GetOwner() ) ); + break; + } + } } Vector3 TextLabel::GetNaturalSize() @@ -491,10 +528,11 @@ void TextLabel::RequestTextRelayout() void TextLabel::RenderText() { + Actor self = Self(); Actor renderableActor; if( mRenderer ) { - renderableActor = mRenderer->Render( mController->GetView(), mDepth ); + renderableActor = mRenderer->Render( mController->GetView(), self.GetHierarchyDepth() ); } if( renderableActor != mRenderableActor ) @@ -506,7 +544,7 @@ void TextLabel::RenderText() const Vector2& alignmentOffset = mController->GetAlignmentOffset(); renderableActor.SetPosition( alignmentOffset.x, alignmentOffset.y ); - Self().Add( renderableActor ); + self.Add( renderableActor ); } mRenderableActor = renderableActor; } @@ -531,7 +569,10 @@ void TextLabel::AddDecoration( Actor& actor, bool needsClipping ) void TextLabel::OnStageConnection( int depth ) { - mDepth = depth; + // Call the Control::OnStageConnection() to set the depth of the background. + Control::OnStageConnection( depth ); + + // The depth of the text renderer is set in the RenderText() called from OnRelayout(). } void TextLabel::TextChanged() @@ -547,7 +588,6 @@ void TextLabel::MaxLengthReached() TextLabel::TextLabel() : Control( ControlBehaviour( REQUIRES_STYLE_CHANGE_SIGNALS ) ), mRenderingBackend( DEFAULT_RENDERING_BACKEND ), - mDepth( 0 ), mHasBeenStaged( false ) { }