[Tizen] Relayout again for LTR / RTL order when layout direction is changed.
authorJiyun Yang <ji.yang@samsung.com>
Thu, 22 Nov 2018 05:48:08 +0000 (14:48 +0900)
committerJiyun Yang <ji.yang@samsung.com>
Thu, 22 Nov 2018 05:48:55 +0000 (14:48 +0900)
This reverts commit 4f7683d0c955776f84277e92842b3cedbda9da21.

Change-Id: I714d9722455cc8277b17a7341053823389a67595

dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp
dali-toolkit/internal/controls/text-controls/text-editor-impl.h
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.h
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.h [changed mode: 0644->0755]
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h

index b065e99756390f79b731415bf782f1d8d19b43c2..d1255108d0f5403b745e6cab81e3cdda00cff72b 100755 (executable)
@@ -1247,6 +1247,8 @@ void TextEditor::OnInitialize()
   Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
   mController->SetLayoutDirection( layoutDirection );
 
+  self.LayoutDirectionChangedSignal().Connect( this, &TextEditor::OnLayoutDirectionChanged );
+
   // Forward input events to controller
   EnableGestureDetection( static_cast<Gesture::Type>( 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");
index 5595e188562cc5ee561e9a001976af720cdc95a7..24a5ddcc020678743a164efdf1b8021ff8d9aa51 100755 (executable)
@@ -260,6 +260,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.
    */
index 655c33566a9542ce7c607905dbd33f2a422c3199..cc1df34836811f38ab6210a0eac17dbcb84c4701 100755 (executable)
@@ -1307,6 +1307,8 @@ void TextField::OnInitialize()
   Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
   mController->SetLayoutDirection( layoutDirection );
 
+  self.LayoutDirectionChangedSignal().Connect( this, &TextField::OnLayoutDirectionChanged );
+
   // Forward input events to controller
   EnableGestureDetection( static_cast<Gesture::Type>( 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");
index 495f7899f6590fc19dc985d84def11d1b6aa38bb..7adcb8f91e00e30c0524c2e1b0087b655870b088 100755 (executable)
@@ -241,6 +241,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.
    */
index 376709a082945bd6d5d30df8af3d76a36e944720..eddec25b9470ea4cfd12ccbd825dff1fd60a45a2 100755 (executable)
@@ -888,10 +888,17 @@ void TextLabel::OnInitialize()
   Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
   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");
old mode 100644 (file)
new mode 100755 (executable)
index 85e94ab..b9f3bf8
@@ -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
 
   /**
index 6c1bf75027c7abaa578b5b23aec31581b567c004..6a326463241a33fe55668c9dc8f9687488710ae4 100755 (executable)
@@ -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<OperationsMask>( mImpl->mOperationsPending |
+                                                                           BIDI_INFO );
+  mImpl->RequestRelayout();
+}
+
 // private : Private contructors & copy operator.
 
 Controller::Controller()
index 33f1f8f452a953df33994eea07d503501fda1930..c3b837547c73916e377c43427e84e76a9c2f4170 100755 (executable)
@@ -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.
 
   /**