[Tizen] Relayout again for LTR / RTL order when layout direction is changed. 72/193272/1
authorJoogab Yun <joogab.yun@samsung.com>
Fri, 16 Nov 2018 23:39:06 +0000 (08:39 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Sat, 17 Nov 2018 00:48:35 +0000 (09:48 +0900)
Change-Id: Idf8e74af65e29bbc6d5ade7860ac7795ce31c446

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 b065e99..d125510 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 5595e18..24a5ddc 100755 (executable)
@@ -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();
index 655c335..cc1df34 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 495f789..7adcb8f 100755 (executable)
@@ -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();
index 376709a..eddec25 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 5d0543c..51d8059 100755 (executable)
@@ -4077,6 +4077,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 33f1f8f..c3b8375 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.
 
   /**