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=3f420b5c3a0b2c3238f4ed6af46863b03b85ecbc;hp=cd96e00b6c30c8d6d49be05debc803f83be71c13;hb=2ef1ec2dc06370b206f95db44c0a59259ce2f7d1;hpb=a455f2fbd87ecda74aa084741cc8666db0cf7e43 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 cd96e00..3f420b5 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -116,6 +116,7 @@ DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollStopMode", DALI_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextLabel, "lineCount", INTEGER, LINE_COUNT ) DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "lineWrapMode", INTEGER, LINE_WRAP_MODE ) DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextLabel, "textDirection", INTEGER, TEXT_DIRECTION ) +DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextLabel, "verticalLineAlignment", INTEGER, VERTICAL_LINE_ALIGNMENT ) DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT( Toolkit, TextLabel, "textColor", Color::BLACK, TEXT_COLOR ) DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, TextLabel, "textColorRed", TEXT_COLOR_RED, TEXT_COLOR, 0 ) DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, TextLabel, "textColorGreen", TEXT_COLOR_GREEN, TEXT_COLOR, 1 ) @@ -410,8 +411,12 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr if( impl.mController ) { const float lineSpacing = value.Get(); - impl.mController->SetDefaultLineSpacing( lineSpacing ); - impl.mTextUpdateNeeded = true; + + // Don't trigger anything if the line spacing didn't change + if( impl.mController->SetDefaultLineSpacing( lineSpacing ) ) + { + impl.mTextUpdateNeeded = true; + } } break; } @@ -489,8 +494,37 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr } break; } + case Toolkit::DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT: + { + if( impl.mController && impl.mController->GetTextModel() ) + { + DevelText::VerticalLineAlignment::Type alignment = static_cast( value.Get() ); + + impl.mController->SetVerticalLineAlignment( alignment ); + + // Property doesn't affect the layout, only Visual must be updated + TextVisual::EnableRendererUpdate( impl.mVisual ); + + // No need to trigger full re-layout. Instead call UpdateRenderer() directly + TextVisual::UpdateRenderer( impl.mVisual ); + } + break; + } + } + + // Request relayout when text update is needed. It's necessary to call it + // as changing the property not via UI interaction brings no effect if only + // the mTextUpdateNeeded is changed. + if( impl.mTextUpdateNeeded ) + { + // need to request relayout as size of text may have changed + impl.RequestTextRelayout(); } } + + + + } Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index index ) @@ -761,6 +795,14 @@ Property::Value TextLabel::GetProperty( BaseObject* object, Property::Index inde } break; } + case Toolkit::DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT: + { + if( impl.mController ) + { + value = impl.mController->GetVerticalLineAlignment(); + } + break; + } } }