From f6423fd08878a216ebf7560b05cf56a5bf5bff26 Mon Sep 17 00:00:00 2001 From: Jiyun Yang Date: Thu, 22 Nov 2018 14:48:08 +0900 Subject: [PATCH] [Tizen] Relayout again for LTR / RTL order when layout direction is changed. This reverts commit 4f7683d0c955776f84277e92842b3cedbda9da21. Change-Id: I714d9722455cc8277b17a7341053823389a67595 --- dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp | 7 +++++++ dali-toolkit/internal/controls/text-controls/text-editor-impl.h | 7 +++++++ dali-toolkit/internal/controls/text-controls/text-field-impl.cpp | 7 +++++++ dali-toolkit/internal/controls/text-controls/text-field-impl.h | 7 +++++++ dali-toolkit/internal/controls/text-controls/text-label-impl.cpp | 7 +++++++ dali-toolkit/internal/controls/text-controls/text-label-impl.h | 7 +++++++ dali-toolkit/internal/text/text-controller.cpp | 8 ++++++++ dali-toolkit/internal/text/text-controller.h | 5 +++++ 8 files changed, 55 insertions(+) mode change 100644 => 100755 dali-toolkit/internal/controls/text-controls/text-label-impl.h diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp index b065e99..d125510 100755 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -1247,6 +1247,8 @@ void TextEditor::OnInitialize() Dali::LayoutDirection::Type layoutDirection = static_cast( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get() ); mController->SetLayoutDirection( layoutDirection ); + self.LayoutDirectionChangedSignal().Connect( this, &TextEditor::OnLayoutDirectionChanged ); + // Forward input events to controller EnableGestureDetection( static_cast( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) ); GetTapGestureDetector().SetMaximumTapsRequired( 2 ); @@ -1293,6 +1295,11 @@ void TextEditor::OnInitialize() self.Add( mStencil ); } +void TextEditor::OnLayoutDirectionChanged( Dali::Actor actor, Dali::LayoutDirection::Type type ) +{ + mController->UpdateLayoutDirectionChanged( type ); +} + void TextEditor::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor::OnStyleChange\n"); diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.h b/dali-toolkit/internal/controls/text-controls/text-editor-impl.h index 5595e18..24a5ddc 100755 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.h @@ -261,6 +261,13 @@ private: // Implementation void OnScrollIndicatorAnimationFinished( Animation& animation ); /** + * @brief Callbacks when the layout direction changes + * @param[in] actor The actor whose layoutDirection is changed. + * @param[in] type The layoutDirection. + */ + void OnLayoutDirectionChanged( Dali::Actor actor, Dali::LayoutDirection::Type type ); + + /** * Construct a new TextEditor. */ TextEditor(); diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index 655c335..cc1df34 100755 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -1307,6 +1307,8 @@ void TextField::OnInitialize() Dali::LayoutDirection::Type layoutDirection = static_cast( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get() ); mController->SetLayoutDirection( layoutDirection ); + self.LayoutDirectionChangedSignal().Connect( this, &TextField::OnLayoutDirectionChanged ); + // Forward input events to controller EnableGestureDetection( static_cast( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) ); GetTapGestureDetector().SetMaximumTapsRequired( 2 ); @@ -1339,6 +1341,11 @@ void TextField::OnInitialize() } } +void TextField::OnLayoutDirectionChanged( Dali::Actor actor, Dali::LayoutDirection::Type type ) +{ + mController->UpdateLayoutDirectionChanged( type ); +} + void TextField::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnStyleChange\n"); diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.h b/dali-toolkit/internal/controls/text-controls/text-field-impl.h index 495f789..7adcb8f 100755 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.h @@ -242,6 +242,13 @@ private: // Implementation void OnIdleSignal(); /** + * @brief Callbacks when the layout direction changes + * @param[in] actor The actor whose layoutDirection is changed. + * @param[in] type The layoutDirection. + */ + void OnLayoutDirectionChanged( Dali::Actor actor, Dali::LayoutDirection::Type type ); + + /** * Construct a new TextField. */ TextField(); 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 376709a..eddec25 100755 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -888,10 +888,17 @@ void TextLabel::OnInitialize() Dali::LayoutDirection::Type layoutDirection = static_cast( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get() ); mController->SetLayoutDirection( layoutDirection ); + self.LayoutDirectionChangedSignal().Connect( this, &TextLabel::OnLayoutDirectionChanged ); + Layout::Engine& engine = mController->GetLayoutEngine(); engine.SetCursorWidth( 0u ); // Do not layout space for the cursor. } +void TextLabel::OnLayoutDirectionChanged( Dali::Actor actor, Dali::LayoutDirection::Type type ) +{ + mController->UpdateLayoutDirectionChanged( type ); +} + void TextLabel::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change ) { DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextLabel::OnStyleChange\n"); diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.h b/dali-toolkit/internal/controls/text-controls/text-label-impl.h old mode 100644 new mode 100755 index 85e94ab..b9f3bf8 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.h @@ -119,6 +119,13 @@ private: // from TextScroller */ virtual void ScrollingFinished(); + /** + * @brief Callbacks when the layout direction changes + * @param[in] actor The actor whose layoutDirection is changed. + * @param[in] type The layoutDirection. + */ + void OnLayoutDirectionChanged( Dali::Actor actor, Dali::LayoutDirection::Type type ); + private: // Implementation /** diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 6c1bf75..6a32646 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -4078,6 +4078,14 @@ bool Controller::ShouldClearFocusOnEscape() const return mImpl->mShouldClearFocusOnEscape; } +void Controller::UpdateLayoutDirectionChanged( Dali::LayoutDirection::Type type ) +{ + mImpl->mLayoutDirection = type; + mImpl->mOperationsPending = static_cast( mImpl->mOperationsPending | + BIDI_INFO ); + mImpl->RequestRelayout(); +} + // private : Private contructors & copy operator. Controller::Controller() diff --git a/dali-toolkit/internal/text/text-controller.h b/dali-toolkit/internal/text/text-controller.h index 33f1f8f..c3b8375 100755 --- a/dali-toolkit/internal/text/text-controller.h +++ b/dali-toolkit/internal/text/text-controller.h @@ -1361,6 +1361,11 @@ public: // Text-input Event Queuing. */ bool ShouldClearFocusOnEscape() const; + /** + * @brief UpdateLayoutDirectionChanged + */ + void UpdateLayoutDirectionChanged( Dali::LayoutDirection::Type type ); + protected: // Inherit from Text::Decorator::ControllerInterface. /** -- 2.7.4