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=2bdacc4a11cc3e4bc4de09b5fc197071af89ca05;hp=5e5d9baa66c2b08e394d24f2dd7707c1065c452d;hb=c6b64a162088c12ef1b69aa40234e6d4dd772763;hpb=43304152ae02a473296e85846bf8c1b08bd918ac 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 5e5d9ba..2bdacc4 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -23,8 +23,8 @@ #include // INTERNAL INCLUDES -#include -#include +#include +#include using Dali::Toolkit::Text::LayoutEngine; using Dali::Toolkit::Text::Backend; @@ -60,7 +60,7 @@ BaseHandle Create() TypeRegistration mType( typeid(Toolkit::TextLabel), typeid(Toolkit::Control), Create ); -PropertyRegistration property1( mType, "rendering-backend", Toolkit::TextLabel::PROPERTY_RENDERING_BACKEND, Property::UNSIGNED_INTEGER, &TextLabel::SetProperty, &TextLabel::GetProperty ); +PropertyRegistration property1( mType, "rendering-backend", Toolkit::TextLabel::PROPERTY_RENDERING_BACKEND, Property::INTEGER, &TextLabel::SetProperty, &TextLabel::GetProperty ); PropertyRegistration property2( mType, "text", Toolkit::TextLabel::PROPERTY_TEXT, Property::STRING, &TextLabel::SetProperty, &TextLabel::GetProperty ); PropertyRegistration property3( mType, "multi-line", Toolkit::TextLabel::PROPERTY_MULTI_LINE, Property::STRING, &TextLabel::SetProperty, &TextLabel::GetProperty ); @@ -92,12 +92,13 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr { case Toolkit::TextLabel::PROPERTY_RENDERING_BACKEND: { - unsigned int backend = value.Get< unsigned int >(); + unsigned int backend = value.Get< int >(); if( impl.mRenderingBackend != backend ) { - impl.mRenderingBackend = backend; + impl.mRenderingBackend = static_cast< unsigned int >( backend ); impl.mRenderer.Reset(); + impl.RequestTextRelayout(); } break; } @@ -115,6 +116,7 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr { LayoutEngine::Layout layout = value.Get< bool >() ? LayoutEngine::MULTI_LINE_BOX : LayoutEngine::SINGLE_LINE_BOX; impl.mController->GetLayoutEngine().SetLayout( layout ); + impl.RequestTextRelayout(); } break; } @@ -141,6 +143,13 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde case Toolkit::TextLabel::PROPERTY_TEXT: { + if( impl.mController ) + { + std::string text; + impl.mController->GetText( text ); + value = text; + } + DALI_LOG_WARNING( "UTF-8 text representation was discarded\n" ); break; } @@ -149,7 +158,7 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde { if( impl.mController ) { - value = impl.mController->GetLayoutEngine().GetLayout(); + value = static_cast( LayoutEngine::MULTI_LINE_BOX == impl.mController->GetLayoutEngine().GetLayout() ); } break; } @@ -176,21 +185,30 @@ float TextLabel::GetHeightForWidth( float width ) void TextLabel::OnRelayout( const Vector2& size, ActorSizeContainer& container ) { - if( mController->Relayout( size ) ) + if( mController->Relayout( size ) || + !mRenderer ) { if( !mRenderer ) { mRenderer = Backend::Get().NewRenderer( mRenderingBackend ); } + RenderableActor renderableActor; if( mRenderer ) { - Actor renderableActor = mRenderer->Render( mController->GetView() ); + renderableActor = mRenderer->Render( mController->GetView() ); + } + + if( renderableActor != mRenderableActor ) + { + UnparentAndReset( mRenderableActor ); if( renderableActor ) { Self().Add( renderableActor ); } + + mRenderableActor = renderableActor; } } }