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=b6c02d7b3a0f3da78f6ca01b005dc2367d453bc9;hp=e4ba0ad74a07dd5c72333213e447b131767b1b88;hb=646440beeb663fc5efcccadeba73dd46016ed1b3;hpb=589e75120f8d7f883509a56d7aeb459644e83ed9 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 e4ba0ad..b6c02d7 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -21,7 +21,6 @@ // EXTERNAL INCLUDES #include #include -#include #include #include #include @@ -457,7 +456,7 @@ void TextLabel::SetProperty(BaseObject* object, Property::Index index, const Pro } case Toolkit::DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION: { - impl.mController->SetMatchSystemLanguageDirection(value.Get()); + impl.mController->SetMatchLayoutDirection(value.Get() ? DevelText::MatchLayoutDirection::LOCALE : DevelText::MatchLayoutDirection::CONTENTS); break; } case Toolkit::DevelTextLabel::Property::TEXT_FIT: @@ -688,7 +687,7 @@ Property::Value TextLabel::GetProperty(BaseObject* object, Property::Index index } case Toolkit::DevelTextLabel::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION: { - value = impl.mController->IsMatchSystemLanguageDirection(); + value = impl.mController->GetMatchLayoutDirection() != DevelText::MatchLayoutDirection::CONTENTS; break; } case Toolkit::DevelTextLabel::Property::TEXT_FIT: @@ -786,6 +785,8 @@ void TextLabel::OnInitialize() Dali::LayoutDirection::Type layoutDirection = static_cast(stage.GetRootLayer().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get()); mController->SetLayoutDirection(layoutDirection); + self.LayoutDirectionChangedSignal().Connect(this, &TextLabel::OnLayoutDirectionChanged); + // Forward input events to controller EnableGestureDetection(static_cast(GestureType::TAP)); GetTapGestureDetector().SetMaximumTapsRequired(1); @@ -899,8 +900,10 @@ void TextLabel::OnRelayout(const Vector2& size, RelayoutContainer& container) { DALI_LOG_INFO(gLogFilter, Debug::General, "TextLabel::OnRelayout\n"); + Actor self = Self(); + Extents padding; - padding = Self().GetProperty(Toolkit::Control::Property::PADDING); + padding = self.GetProperty(Toolkit::Control::Property::PADDING); Vector2 contentSize(size.x - (padding.start + padding.end), size.y - (padding.top + padding.bottom)); @@ -911,15 +914,8 @@ void TextLabel::OnRelayout(const Vector2& size, RelayoutContainer& container) } // Support Right-To-Left - Dali::LayoutDirection::Type layoutDirection; - if(mController->IsMatchSystemLanguageDirection()) - { - layoutDirection = static_cast(DevelWindow::Get(Self()).GetRootLayer().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get()); - } - else - { - layoutDirection = static_cast(Self().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get()); - } + Dali::LayoutDirection::Type layoutDirection = mController->GetLayoutDirection(self); + const Text::Controller::UpdateTextType updateTextType = mController->Relayout(contentSize, layoutDirection); if((Text::Controller::NONE_UPDATED != (Text::Controller::MODEL_UPDATED & updateTextType)) || mTextUpdateNeeded) @@ -1048,6 +1044,11 @@ void TextLabel::ScrollingFinished() RequestTextRelayout(); } +void TextLabel::OnLayoutDirectionChanged(Actor actor, LayoutDirection::Type type) +{ + mController->ChangedLayoutDirection(); +} + TextLabel::TextLabel() : Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT)), mRenderingBackend(DEFAULT_RENDERING_BACKEND),