[AT-SPI] Support gaining keyboard focus in TextField, TextEditor
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / text-controls / text-editor-impl.cpp
index 74f3732..5aa9ce2 100644 (file)
@@ -1215,6 +1215,9 @@ void TextEditor::OnInitialize()
   self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT );
   self.OnSceneSignal().Connect( this, &TextEditor::OnSceneConnect );
 
+  //Enable highightability
+  self.SetProperty( Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, true );
+
   DevelControl::SetInputMethodContext( *this, mInputMethodContext );
 
   // Creates an extra control to be used as stencil buffer.
@@ -1232,6 +1235,11 @@ void TextEditor::OnInitialize()
   mStencil.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
 
   self.Add( mStencil );
+
+  DevelControl::SetAccessibilityConstructor( self, []( Dali::Actor actor ) {
+    return std::unique_ptr< Dali::Accessibility::Accessible >(
+      new AccessibleImpl( actor, Dali::Accessibility::Role::ENTRY ) );
+  } );
 }
 
 void TextEditor::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
@@ -1463,6 +1471,12 @@ void TextEditor::OnKeyInputFocusLost()
   EmitKeyInputFocusSignal( false ); // Calls back into the Control hence done last.
 }
 
+bool TextEditor::OnAccessibilityActivated()
+{
+  SetKeyInputFocus();
+  return true;
+}
+
 void TextEditor::OnTap( const TapGesture& gesture )
 {
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor::OnTap %p\n", mController.Get() );
@@ -1872,10 +1886,6 @@ TextEditor::TextEditor()
   mScrollBarEnabled( false ),
   mScrollStarted( false )
 {
-  DevelControl::SetAccessibilityConstructor( Self(), []( Dali::Actor actor ) {
-    return std::unique_ptr< Dali::Accessibility::Accessible >(
-        new AccessibleImpl( actor, Dali::Accessibility::Role::ENTRY ) );
-  } );
 }
 
 TextEditor::~TextEditor()