Merge "When matchSystemLanguageDirection is set, it should follow the direction setti...
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / text-controls / text-editor-impl.cpp
old mode 100644 (file)
new mode 100755 (executable)
index efcfe2c..14bac16
@@ -22,6 +22,7 @@
 #include <cstring>
 #include <limits>
 #include <dali/public-api/adaptor-framework/key.h>
+#include <dali/devel-api/adaptor-framework/window-devel.h>
 #include <dali/devel-api/common/stage.h>
 #include <dali/devel-api/actors/actor-devel.h>
 #include <dali/devel-api/object/property-helper-devel.h>
@@ -1400,7 +1401,15 @@ void TextEditor::OnRelayout( const Vector2& size, RelayoutContainer& container )
   Vector2 contentSize( size.x - ( padding.start + padding.end ), size.y - ( padding.top + padding.bottom ) );
 
   // Support Right-To-Left of padding
-  Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
+  Dali::LayoutDirection::Type layoutDirection;
+  if( mController->IsMatchSystemLanguageDirection() )
+  {
+    layoutDirection = static_cast<Dali::LayoutDirection::Type>( DevelWindow::Get( self ).GetRootLayer().GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
+  }
+  else
+  {
+    layoutDirection = static_cast<Dali::LayoutDirection::Type>( self.GetProperty( Dali::Actor::Property::LAYOUT_DIRECTION ).Get<int>() );
+  }
   if( Dali::LayoutDirection::RIGHT_TO_LEFT == layoutDirection )
   {
     std::swap( padding.start, padding.end );
@@ -1592,12 +1601,12 @@ void TextEditor::OnLongPress( const LongPressGesture& gesture )
 
 bool TextEditor::OnKeyEvent( const KeyEvent& event )
 {
-  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor::OnKeyEvent %p keyCode %d\n", mController.Get(), event.keyCode );
+  DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor::OnKeyEvent %p keyCode %d\n", mController.Get(), event.GetKeyCode() );
 
-  if( Dali::DALI_KEY_ESCAPE == event.keyCode && mController->ShouldClearFocusOnEscape() )
+  if( Dali::DALI_KEY_ESCAPE == event.GetKeyCode() && mController->ShouldClearFocusOnEscape() )
   {
     // Make sure ClearKeyInputFocus when only key is up
-    if( event.state == KeyEvent::Up )
+    if( event.GetState() == KeyEvent::UP )
     {
       ClearKeyInputFocus();
     }
@@ -1852,7 +1861,7 @@ void TextEditor::OnSceneConnection( int depth )
   Control::OnSceneConnection( depth );
 }
 
-bool TextEditor::OnTouched( Actor actor, const TouchData& touch )
+bool TextEditor::OnTouched( Actor actor, const TouchEvent& touch )
 {
   return false;
 }