[dali_2.0.39] Merge branch 'devel/master' 97/262597/1
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 13 Aug 2021 12:47:35 +0000 (13:47 +0100)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 13 Aug 2021 12:47:35 +0000 (13:47 +0100)
Change-Id: I09a572c57f87c0348992d48988849ca5fa734a57

30 files changed:
automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/accessibility-test-utils.cpp
automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/accessibility-test-utils.h
automated-tests/src/dali-toolkit-internal/utc-Dali-Accessibility-Accessible.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Accessibility-Controls-BridgeUp.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Controller.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp
dali-toolkit/devel-api/controls/accessible-impl.cpp
dali-toolkit/devel-api/controls/accessible-impl.h
dali-toolkit/devel-api/controls/text-controls/text-editor-devel.cpp
dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h
dali-toolkit/devel-api/controls/text-controls/text-field-devel.cpp
dali-toolkit/devel-api/controls/text-controls/text-field-devel.h
dali-toolkit/devel-api/focus-manager/focus-finder.cpp
dali-toolkit/devel-api/visuals/visual-properties-devel.h
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/text/text-controller-event-handler.cpp
dali-toolkit/internal/text/text-controller-event-handler.h
dali-toolkit/internal/text/text-controller-impl-event-handler.cpp
dali-toolkit/internal/text/text-controller-impl-event-handler.h
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller-impl.h
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h
dali-toolkit/internal/text/text-selectable-control-interface.h
dali-toolkit/public-api/dali-toolkit-version.cpp
packaging/dali-toolkit.spec

index 6d61f56..a9d9f03 100644 (file)
@@ -204,10 +204,10 @@ namespace Dali {
             return std::move(std::get<0>(chs));
         }
 
-        std::tuple< int32_t, int32_t, int32_t, int32_t > TestGetExtents(const Address &adr)
+        std::tuple< int32_t, int32_t, int32_t, int32_t > TestGetExtents(const Address &adr, Dali::Accessibility::CoordinateType coordinateType)
         {
             auto wr = static_cast<TestDBusWrapper*>(DBusWrapper::Installed());
-            auto chs = wr->fromTestCall< std::tuple< int32_t, int32_t, int32_t, int32_t > >(adr.GetPath(), "org.a11y.atspi.Component", "GetExtents", std::tuple<uint32_t>(0));
+            auto chs = wr->fromTestCall< std::tuple< int32_t, int32_t, int32_t, int32_t > >(adr.GetPath(), "org.a11y.atspi.Component", "GetExtents", std::make_tuple(static_cast<uint32_t>(coordinateType)));
             return std::move(std::get<0>(chs));
         }
 
index 4966ff2..6c172fd 100644 (file)
@@ -24,7 +24,7 @@ namespace Dali {
         bool TestGrabFocus(const Address &adr);
         bool TestGrabHighlight(const Address &adr);
         bool TestClearHighlight(const Address &adr);
-        std::tuple< int32_t, int32_t, int32_t, int32_t > TestGetExtents(const Address &adr);
+        std::tuple< int32_t, int32_t, int32_t, int32_t > TestGetExtents(const Address &adr, Dali::Accessibility::CoordinateType coordinateType );
         int TestGetMdiZOrder(const Address &adr);
         double TestGetAlpha(const Address &adr);
         void printTree(const Address &root, size_t depth = 0);
index 9b103e8..423893a 100644 (file)
@@ -64,3 +64,69 @@ int utcDaliAccessibilityCheckLabelText(void)
 
   END_TEST;
 }
+
+int UtcDaliAccessibilityCheckShowingState(void)
+{
+  ToolkitTestApplication application;
+
+  auto parentButton = Toolkit::PushButton::New();
+  parentButton.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
+  parentButton.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+  parentButton.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+  parentButton.SetProperty(Actor::Property::POSITION, Dali::Vector2(0.0f, 0.0f));
+  parentButton.SetProperty(Actor::Property::SIZE, Dali::Vector2(200.0f, 200.0f));
+  application.GetScene().Add( parentButton );
+
+  // Toatally inside of parent
+  auto buttonA = Toolkit::PushButton::New();
+  buttonA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+  buttonA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+  buttonA.SetProperty(Actor::Property::POSITION, Dali::Vector2(0.0f, 0.0f));
+  buttonA.SetProperty(Actor::Property::SIZE, Dali::Vector2(100.0f, 100.0f));
+  parentButton.Add(buttonA);
+
+  // Toatally outside of parent
+  auto buttonB = Toolkit::PushButton::New();
+  buttonB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+  buttonB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+  buttonB.SetProperty(Actor::Property::POSITION, Dali::Vector2(300.0f, 300.0f));
+  buttonB.SetProperty(Actor::Property::SIZE, Dali::Vector2(100.0f, 100.0f));
+  parentButton.Add(buttonB);
+
+  // Partially inside of parent
+  auto buttonC = Toolkit::PushButton::New();
+  buttonC.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
+  buttonC.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+  buttonC.SetProperty(Actor::Property::POSITION, Dali::Vector2(100.0f,100.0f));
+  buttonC.SetProperty(Actor::Property::SIZE, Dali::Vector2(200.0f, 200.0f));
+  parentButton.Add(buttonC);
+
+  application.SendNotification();
+  application.Render(16);
+
+  auto q = Dali::Accessibility::Accessible::Get(buttonA);
+  DALI_TEST_CHECK(q);
+  auto states = q->GetStates();
+  DALI_TEST_EQUALS((int) states[Dali::Accessibility::State::SHOWING], (int) true, TEST_LOCATION);
+
+  q = Dali::Accessibility::Accessible::Get(buttonB);
+  DALI_TEST_CHECK(q);
+  states = q->GetStates();
+  DALI_TEST_EQUALS((int) states[Dali::Accessibility::State::SHOWING], (int) false, TEST_LOCATION);
+
+  q = Dali::Accessibility::Accessible::Get(buttonC);
+  DALI_TEST_CHECK(q);
+  states = q->GetStates();
+  DALI_TEST_EQUALS((int) states[Dali::Accessibility::State::SHOWING], (int) true, TEST_LOCATION);
+
+  // Make SHOWING object invisible
+  buttonC.SetProperty(Actor::Property::VISIBLE, false);
+
+  application.SendNotification();
+  application.Render(16);
+
+  states = q->GetStates();
+  DALI_TEST_EQUALS((int) states[Dali::Accessibility::State::SHOWING], (int) false, TEST_LOCATION);
+
+  END_TEST;
+}
\ No newline at end of file
index 5720b4e..0b1ec0e 100644 (file)
@@ -4,6 +4,7 @@
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/devel-api/adaptor-framework/accessibility.h>
 #include <dali/devel-api/adaptor-framework/accessibility-impl.h>
+#include <dali/devel-api/adaptor-framework/window-devel.h>
 #include <dali-toolkit/devel-api/controls/buttons/toggle-button.h>
 #include <dali-toolkit/devel-api/controls/control-devel.h>
 #include <dali-toolkit/devel-api/controls/popup/popup.h>
@@ -694,17 +695,102 @@ int UtcDaliAccessibilityGrabFocus(void)
   END_TEST;
 }
 
-int UtcDaliAccessibilityGetExtents(void)
+int UtcDaliAccessibilityGetExtentsScreenAndWindowPositionMatch(void)
 {
   ToolkitTestApplication application;
+  tet_infoline( "UtcDaliAccessibilityGetExtentsScreenAndWindowPositionMatch" );
 
   Dali::Accessibility::TestEnableSC( true );
 
   auto control = Control::New();
   Stage::GetCurrent().GetRootLayer().Add( control );
 
-  control.SetProperty(Actor::Property::POSITION, Vector3(10, 10, 100));
-  control.SetProperty(Actor::Property::SIZE, Vector2(10, 10));
+  auto window = Dali::DevelWindow::Get( control );
+  DALI_TEST_CHECK( window );
+
+  //window.SetPosition({0,0});
+  DevelWindow::SetPositionSize( window, PositionSize( 0,0,480, 240 ) );
+
+  control.SetProperty( Actor::Property::POSITION, Vector3( 10, 10, 100 ) );
+  control.SetProperty( Actor::Property::SIZE, Vector2( 10, 10 ) );
+
+  application.SendNotification();
+  application.Render( 1 );
+
+  auto a = Dali::Accessibility::Accessible::Get( control );
+  auto a_component = dynamic_cast<Dali::Accessibility::Component*>( a );
+
+  auto extents = a_component->GetExtents( Dali::Accessibility::CoordinateType::SCREEN );
+  DALI_TEST_EQUALS( extents.x, 5.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.y, 5.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.height, 10.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.width, 10.0f, TEST_LOCATION );
+
+  auto bridge_extents = TestGetExtents( a_component -> GetAddress(), Dali::Accessibility::CoordinateType::SCREEN );
+  DALI_TEST_EQUALS( std::get< 0 >( bridge_extents ), 5, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 1 >( bridge_extents ), 5, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 2 >( bridge_extents ), 10, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 3 >( bridge_extents ), 10, TEST_LOCATION );
+
+  extents = a_component->GetExtents( Dali::Accessibility::CoordinateType::WINDOW );
+  DALI_TEST_EQUALS( extents.x, 5.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.y, 5.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.height, 10.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.width, 10.0f, TEST_LOCATION );
+
+  bridge_extents = TestGetExtents( a_component -> GetAddress(), Dali::Accessibility::CoordinateType::WINDOW );
+  DALI_TEST_EQUALS( std::get< 0 >( bridge_extents ), 5, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 1 >( bridge_extents ), 5, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 2 >( bridge_extents ), 10, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 3 >( bridge_extents ), 10, TEST_LOCATION );
+
+  control.SetProperty( Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT, false );
+  application.SendNotification();
+  application.Render( 1 );
+
+  extents = a_component->GetExtents( Dali::Accessibility::CoordinateType::SCREEN );
+  DALI_TEST_EQUALS( extents.x, 10.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.y, 10.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.height, 10.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.width, 10.0f, TEST_LOCATION );
+
+  bridge_extents = TestGetExtents( a_component -> GetAddress(), Dali::Accessibility::CoordinateType::SCREEN );
+  DALI_TEST_EQUALS( std::get< 0 >( bridge_extents ), 10, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 1 >( bridge_extents ), 10, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 2 >( bridge_extents ), 10, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 3 >( bridge_extents ), 10, TEST_LOCATION );
+
+  extents = a_component->GetExtents( Dali::Accessibility::CoordinateType::WINDOW );
+  DALI_TEST_EQUALS( extents.x, 10.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.y, 10.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.height, 10.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.width, 10.0f, TEST_LOCATION );
+
+  bridge_extents = TestGetExtents( a_component -> GetAddress(), Dali::Accessibility::CoordinateType::WINDOW );
+  DALI_TEST_EQUALS( std::get< 0 >( bridge_extents ), 10, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 1 >( bridge_extents ), 10, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 2 >( bridge_extents ), 10, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 3 >( bridge_extents ), 10, TEST_LOCATION );
+
+  Dali::Accessibility::TestEnableSC( false );
+
+  END_TEST;
+}
+
+int UtcDaliAccessibilityGetExtentsScreenAndWindowPositionDoNotMatch(void)
+{
+  ToolkitTestApplication application;
+
+  Dali::Accessibility::TestEnableSC( true );
+
+  auto control = Control::New();
+  Stage::GetCurrent().GetRootLayer().Add( control );
+  auto window = Dali::DevelWindow::Get( control );
+  //window.SetPosition({33,33});
+  DevelWindow::SetPositionSize( window, PositionSize( 33,33,480, 240 ) );
+
+  control.SetProperty( Actor::Property::POSITION, Vector3( 10, 10, 100 ) );
+  control.SetProperty( Actor::Property::SIZE, Vector2( 10, 10 ) );
 
   application.SendNotification();
   application.Render( 1 );
@@ -712,13 +798,25 @@ int UtcDaliAccessibilityGetExtents(void)
   auto a = Dali::Accessibility::Accessible::Get( control );
   auto a_component = dynamic_cast<Dali::Accessibility::Component*>( a );
 
-  auto extents = a_component->GetExtents(Dali::Accessibility::CoordinateType::SCREEN);
+  auto extents = a_component->GetExtents( Dali::Accessibility::CoordinateType::SCREEN );
+  DALI_TEST_EQUALS( extents.x, 38.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.y, 38.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.height, 10.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.width, 10.0f, TEST_LOCATION );
+
+  auto bridge_extents = TestGetExtents( a_component -> GetAddress(), Dali::Accessibility::CoordinateType::SCREEN );
+  DALI_TEST_EQUALS( std::get< 0 >( bridge_extents ), 38, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 1 >( bridge_extents ), 38, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 2 >( bridge_extents ), 10, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 3 >( bridge_extents ), 10, TEST_LOCATION );
+
+  extents = a_component->GetExtents( Dali::Accessibility::CoordinateType::WINDOW );
   DALI_TEST_EQUALS( extents.x, 5.0f, TEST_LOCATION );
   DALI_TEST_EQUALS( extents.y, 5.0f, TEST_LOCATION );
   DALI_TEST_EQUALS( extents.height, 10.0f, TEST_LOCATION );
   DALI_TEST_EQUALS( extents.width, 10.0f, TEST_LOCATION );
 
-  auto bridge_extents = TestGetExtents( a_component -> GetAddress() );
+  bridge_extents = TestGetExtents( a_component -> GetAddress(), Dali::Accessibility::CoordinateType::WINDOW );
   DALI_TEST_EQUALS( std::get< 0 >( bridge_extents ), 5, TEST_LOCATION );
   DALI_TEST_EQUALS( std::get< 1 >( bridge_extents ), 5, TEST_LOCATION );
   DALI_TEST_EQUALS( std::get< 2 >( bridge_extents ), 10, TEST_LOCATION );
@@ -728,13 +826,25 @@ int UtcDaliAccessibilityGetExtents(void)
   application.SendNotification();
   application.Render( 1 );
 
-  extents = a_component->GetExtents(Dali::Accessibility::CoordinateType::SCREEN);
+  extents = a_component->GetExtents( Dali::Accessibility::CoordinateType::SCREEN );
+  DALI_TEST_EQUALS( extents.x, 43.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.y, 43.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.height, 10.0f, TEST_LOCATION );
+  DALI_TEST_EQUALS( extents.width, 10.0f, TEST_LOCATION );
+
+  bridge_extents = TestGetExtents( a_component -> GetAddress(), Dali::Accessibility::CoordinateType::SCREEN );
+  DALI_TEST_EQUALS( std::get< 0 >( bridge_extents ), 43, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 1 >( bridge_extents ), 43, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 2 >( bridge_extents ), 10, TEST_LOCATION );
+  DALI_TEST_EQUALS( std::get< 3 >( bridge_extents ), 10, TEST_LOCATION );
+
+  extents = a_component->GetExtents( Dali::Accessibility::CoordinateType::WINDOW );
   DALI_TEST_EQUALS( extents.x, 10.0f, TEST_LOCATION );
   DALI_TEST_EQUALS( extents.y, 10.0f, TEST_LOCATION );
   DALI_TEST_EQUALS( extents.height, 10.0f, TEST_LOCATION );
   DALI_TEST_EQUALS( extents.width, 10.0f, TEST_LOCATION );
 
-  bridge_extents = TestGetExtents( a_component -> GetAddress() );
+  bridge_extents = TestGetExtents( a_component -> GetAddress(), Dali::Accessibility::CoordinateType::WINDOW );
   DALI_TEST_EQUALS( std::get< 0 >( bridge_extents ), 10, TEST_LOCATION );
   DALI_TEST_EQUALS( std::get< 1 >( bridge_extents ), 10, TEST_LOCATION );
   DALI_TEST_EQUALS( std::get< 2 >( bridge_extents ), 10, TEST_LOCATION );
@@ -1060,24 +1170,25 @@ int UtcDaliAccessibilityCheckHighlight(void)
 
   // Make precondition two children exist in parent area
   PushButton parentButton = PushButton::New();
+  parentButton.SetProperty(Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_TO_BOUNDING_BOX);
   parentButton.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
   parentButton.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
-  parentButton.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(0.0f, 0.0f) );
-  parentButton.SetProperty( Dali::Actor::Property::SIZE, Dali::Vector2(100.0f, 200.0f) );
+  parentButton.SetProperty(Actor::Property::POSITION, Dali::Vector2(0.0f, 0.0f));
+  parentButton.SetProperty(Actor::Property::SIZE, Dali::Vector2(100.0f, 200.0f));
   application.GetScene().Add( parentButton );
 
   PushButton buttonA = PushButton::New();
   buttonA.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
   buttonA.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
-  buttonA.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(0.0f, 0.0f) );
-  buttonA.SetProperty( Dali::Actor::Property::SIZE, Dali::Vector2(100.0f, 100.0f) );
+  buttonA.SetProperty(Actor::Property::POSITION, Dali::Vector2(0.0f, 0.0f));
+  buttonA.SetProperty(Actor::Property::SIZE, Dali::Vector2(100.0f, 100.0f));
   parentButton.Add(buttonA);
 
   PushButton buttonB = PushButton::New();
   buttonB.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
   buttonB.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
-  buttonB.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(0.0f, 100.0f) );
-  buttonB.SetProperty( Dali::Actor::Property::SIZE, Dali::Vector2(100.0f, 100.0f) );
+  buttonB.SetProperty(Actor::Property::POSITION, Dali::Vector2(0.0f, 100.0f));
+  buttonB.SetProperty(Actor::Property::SIZE, Dali::Vector2(100.0f, 100.0f));
   parentButton.Add(buttonB);
   Wait(application);
 
@@ -1088,9 +1199,9 @@ int UtcDaliAccessibilityCheckHighlight(void)
   Wait(application);
 
   // Move first child (A) out of parent area through the parent's area top edge - single move outed event expected for A object and OUTGOING_TOP_LEFT direction
-  buttonA.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(0.0f, -200.0f) );
+  buttonA.SetProperty(Actor::Property::POSITION, Dali::Vector2(0.0f, -200.0f));
   Wait(application);
-  // Need one more seding notificaiton to get correct updated position
+  // Need one more notificaiton to get correct updated position
   application.SendNotification();
   DALI_TEST_EQUALS( true, Dali::Accessibility::TestGetMoveOutedCalled(), TEST_LOCATION );
 
@@ -1100,7 +1211,7 @@ int UtcDaliAccessibilityCheckHighlight(void)
   // Move first child (A) outside of parent area (both start and end position are outside of parent area) - no move outed event expected for A object
   buttonA.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(0.0f, -300.0f) );
   Wait(application);
-  // Need one more seding notificaiton to get correct updated position
+  // Need one more notificaiton to get correct updated position
   application.SendNotification();
   DALI_TEST_EQUALS( false, Dali::Accessibility::TestGetMoveOutedCalled(), TEST_LOCATION );
 
@@ -1117,7 +1228,7 @@ int UtcDaliAccessibilityCheckHighlight(void)
   // B: (0,100) --> (0, 50)
   buttonB.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(0.0f, 50.0f) );
   Wait(application);
-  // Need one more seding notificaiton to get correct updated position
+  // Need one more notificaiton to get correct updated position
   application.SendNotification();
   DALI_TEST_EQUALS( false, Dali::Accessibility::TestGetMoveOutedCalled(), TEST_LOCATION );
 
@@ -1125,9 +1236,9 @@ int UtcDaliAccessibilityCheckHighlight(void)
   Dali::Accessibility::TestResetMoveOutedCalled();
 
   // Move second child (B) out of parent area through the parent's area right edge - single move outed event expected for B object and OUTGOING_BOTTOM_RIGHT direction
-  buttonB.SetProperty( Dali::Actor::Property::POSITION, Dali::Vector2(300.0f, 100.0f) );
+  buttonB.SetProperty(Actor::Property::POSITION, Dali::Vector2(300.0f, 100.0f));
   Wait(application);
-  // Need one more seding notificaiton to get correct updated position
+  // Need one more notificaiton to get correct updated position
   application.SendNotification();
   DALI_TEST_EQUALS( true, Dali::Accessibility::TestGetMoveOutedCalled(), TEST_LOCATION );
 
index bb3ed33..c89a025 100755 (executable)
@@ -475,6 +475,9 @@ int UtcDaliTextControllerTextPopupButtonTouched(void)
   // Sets some text.
   controller->SetText( "Hello world" );
 
+  // When the TextSelectionPopup is active, the controller has focus.
+  controller->KeyboardFocusGainEvent();
+
   // Select the whole text.
   button = PushButton::DownCast( textPopup.FindChildByName( OPTION_SELECT_ALL ) );
   DALI_TEST_CHECK( button );
index b518743..9b1d0ff 100644 (file)
@@ -3242,6 +3242,65 @@ int UtcDaliTextEditorSelectWholeText(void)
   END_TEST;
 }
 
+int UtcDaliTextEditorSelectText(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliTextEditorSelectText ");
+
+  TextEditor textEditor = TextEditor::New();
+
+  application.GetScene().Add( textEditor );
+
+  textEditor.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) );
+  textEditor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+  textEditor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+
+  // Avoid a crash when core load gl resources.
+  application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+  application.SendNotification();
+  application.Render();
+
+  DevelTextEditor::SelectText( textEditor ,0, 5 );
+
+  application.SendNotification();
+  application.Render();
+
+  // Nothing is selected
+  std::string selectedText = textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT ).Get<std::string>();
+  DALI_TEST_EQUALS( "", selectedText, TEST_LOCATION );
+
+  textEditor.SetProperty( TextEditor::Property::TEXT, "Hello world" );
+
+  application.SendNotification();
+  application.Render();
+
+  DevelTextEditor::SelectText( textEditor, 0, 5 );
+
+  application.SendNotification();
+  application.Render();
+
+  selectedText = textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT ).Get<std::string>();
+  DALI_TEST_EQUALS( "Hello", selectedText, TEST_LOCATION );
+
+  DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_START ).Get<int>(), 0, TEST_LOCATION );
+  DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_END ).Get<int>(), 5, TEST_LOCATION );
+
+  // world is selected
+  DevelTextEditor::SelectText( textEditor, 6, 11 );
+
+  application.SendNotification();
+  application.Render();
+
+  selectedText = textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT ).Get<std::string>();
+  DALI_TEST_EQUALS( "world", selectedText, TEST_LOCATION );
+
+  DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_START ).Get<int>(), 6, TEST_LOCATION );
+  DALI_TEST_EQUALS( textEditor.GetProperty( DevelTextEditor::Property::SELECTED_TEXT_END ).Get<int>(), 11, TEST_LOCATION );
+
+  END_TEST;
+}
+
 int UtcDaliTextEditorSelectNone(void)
 {
   ToolkitTestApplication application;
@@ -3465,6 +3524,7 @@ int UtcDaliTextEditorPrimaryCursorPosition(void)
   textEditor.SetProperty( DevelTextEditor::Property::PRIMARY_CURSOR_POSITION, 3);
   application.SendNotification();
   application.Render();
+  textEditor.SetKeyInputFocus();
 
   application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
 
index f6e24e6..d89428a 100644 (file)
@@ -3482,6 +3482,66 @@ int UtcDaliTextFieldSelectWholeText(void)
   END_TEST;
 }
 
+int UtcDaliTextFieldSelectText(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline(" UtcDaliTextFieldSelectText ");
+
+  TextField textField = TextField::New();
+
+  application.GetScene().Add( textField );
+
+  textField.SetProperty( Actor::Property::SIZE, Vector2( 300.f, 50.f ) );
+  textField.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT );
+  textField.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT );
+
+  // Avoid a crash when core load gl resources.
+  application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+  application.SendNotification();
+  application.Render();
+
+  DevelTextField::SelectText( textField, 0, 5 );
+
+  application.SendNotification();
+  application.Render();
+
+  // Nothing is selected
+  std::string selectedText = textField.GetProperty( DevelTextField::Property::SELECTED_TEXT ).Get<std::string>();
+  DALI_TEST_EQUALS( "", selectedText, TEST_LOCATION );
+
+  textField.SetProperty( TextField::Property::TEXT, "Hello world" );
+
+  application.SendNotification();
+  application.Render();
+
+  // Hello is selected
+  DevelTextField::SelectText( textField, 0, 5 );
+
+  application.SendNotification();
+  application.Render();
+
+  selectedText = textField.GetProperty( DevelTextField::Property::SELECTED_TEXT ).Get<std::string>();
+  DALI_TEST_EQUALS( "Hello", selectedText, TEST_LOCATION );
+
+  DALI_TEST_EQUALS( textField.GetProperty( DevelTextField::Property::SELECTED_TEXT_START ).Get<int>(), 0, TEST_LOCATION );
+  DALI_TEST_EQUALS( textField.GetProperty( DevelTextField::Property::SELECTED_TEXT_END ).Get<int>(), 5, TEST_LOCATION );
+
+  // world is selected
+  DevelTextField::SelectText( textField, 6, 11 );
+
+  application.SendNotification();
+  application.Render();
+
+  selectedText = textField.GetProperty( DevelTextField::Property::SELECTED_TEXT ).Get<std::string>();
+  DALI_TEST_EQUALS( "world", selectedText, TEST_LOCATION );
+
+  DALI_TEST_EQUALS( textField.GetProperty( DevelTextField::Property::SELECTED_TEXT_START ).Get<int>(), 6, TEST_LOCATION );
+  DALI_TEST_EQUALS( textField.GetProperty( DevelTextField::Property::SELECTED_TEXT_END ).Get<int>(), 11, TEST_LOCATION );
+
+  END_TEST;
+}
+
 int UtcDaliTextFieldSelectNone(void)
 {
   ToolkitTestApplication application;
@@ -3675,6 +3735,7 @@ int UtcDaliTextFieldPrimaryCursorPosition(void)
   textField.SetProperty( DevelTextField::Property::PRIMARY_CURSOR_POSITION, 3);
   application.SendNotification();
   application.Render();
+  textField.SetKeyInputFocus();
 
   application.ProcessEvent( GenerateKey( "D", "", "D", KEY_D_CODE, 0, 0, Integration::KeyEvent::DOWN, "D", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
 
index 774a280..9f1c78e 100644 (file)
@@ -24,6 +24,7 @@
 #endif
 
 #include <dali/devel-api/actors/actor-devel.h>
+#include <dali/devel-api/adaptor-framework/window-devel.h>
 
 // INTERNAL INCLUDES
 #include <dali-toolkit/devel-api/asset-manager/asset-manager.h>
@@ -199,6 +200,37 @@ std::string AccessibleImpl::GetLocalizedRoleName()
   return GetLocaleText(GetRoleName());
 }
 
+bool AccessibleImpl::IsShowing()
+{
+  Dali::Actor self = Self();
+  if(self.GetProperty(Dali::DevelActor::Property::CULLED).Get<bool>() || !self.GetCurrentProperty<bool>(Actor::Property::VISIBLE))
+  {
+    return false;
+  }
+
+  auto* child  = this;
+  auto* parent = dynamic_cast<Toolkit::DevelControl::AccessibleImpl*>(child->GetParent());
+  if(!parent)
+  {
+    return true;
+  }
+
+  auto childExtent = child->GetExtents(Dali::Accessibility::CoordinateType::WINDOW);
+  while(parent)
+  {
+    auto control      = Dali::Toolkit::Control::DownCast(parent->Self());
+    auto clipMode     = control.GetProperty(Actor::Property::CLIPPING_MODE).Get<bool>();
+    auto parentExtent = parent->GetExtents(Dali::Accessibility::CoordinateType::WINDOW);
+    if ((clipMode != ClippingMode::DISABLED) && !parentExtent.Intersects(childExtent))
+    {
+      return false;
+    }
+    parent = dynamic_cast<Toolkit::DevelControl::AccessibleImpl*>(parent->GetParent());
+  }
+
+  return true;
+}
+
 Dali::Accessibility::States AccessibleImpl::CalculateStates()
 {
   Dali::Actor self = Self();
@@ -224,8 +256,7 @@ Dali::Accessibility::States AccessibleImpl::CalculateStates()
   {
     state[Dali::Accessibility::State::MODAL] = true;
   }
-  state[Dali::Accessibility::State::SHOWING] = !self.GetProperty(Dali::DevelActor::Property::CULLED).Get<bool>() && self.GetCurrentProperty<bool>(Actor::Property::VISIBLE);
-
+  state[Dali::Accessibility::State::SHOWING] = IsShowing();
   state[Dali::Accessibility::State::DEFUNCT] = !self.GetProperty(Dali::DevelActor::Property::CONNECTED_TO_SCENE).Get<bool>();
   return state;
 }
@@ -278,7 +309,16 @@ Dali::Rect<> AccessibleImpl::GetExtents(Dali::Accessibility::CoordinateType type
   Vector3 anchorPointOffSet = size * (positionUsesAnchorPoint ? self.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT) : AnchorPoint::TOP_LEFT);
   Vector2 position = Vector2((screenPosition.x - anchorPointOffSet.x), (screenPosition.y - anchorPointOffSet.y));
 
-  return {position.x, position.y, size.x, size.y};
+  if(type == Dali::Accessibility::CoordinateType::WINDOW)
+  {
+    return {position.x, position.y, size.x, size.y};
+  }
+  else // Dali::Accessibility::CoordinateType::SCREEN
+  {
+    auto window = Dali::DevelWindow::Get(self);
+    auto windowPosition = window.GetPosition();
+    return {position.x + windowPosition.GetX(), position.y + windowPosition.GetY(), size.x, size.y};
+  }
 }
 
 int16_t AccessibleImpl::GetMdiZOrder()
index c8c1361..aa5084a 100644 (file)
@@ -76,6 +76,12 @@ protected:
    */
   void UnregisterPositionPropertyNotification();
 
+  /**
+   * @brief Check if the actor is showing
+   * @return True if the actor is showing
+   */
+  bool IsShowing();
+
 public:
   AccessibleImpl(Dali::Actor self, Dali::Accessibility::Role role, bool modal = false);
 
index a685aee..2e263ce 100644 (file)
@@ -55,6 +55,11 @@ void SelectNone(TextEditor textEditor)
   GetImpl(textEditor).SelectNone();
 }
 
+void SelectText(TextEditor textEditor, const uint32_t start, const uint32_t end)
+{
+  GetImpl(textEditor).SelectText(start, end);
+}
+
 void ScrollBy(TextEditor textEditor, Vector2 scroll)
 {
   GetImpl(textEditor).ScrollBy(scroll);
index 695ca1b..2d14542 100644 (file)
@@ -363,6 +363,21 @@ DALI_TOOLKIT_API void SelectWholeText(TextEditor textEditor);
 DALI_TOOLKIT_API void SelectNone(TextEditor textEditor);
 
 /**
+ * @brief Select the text from start index to end index of TextEditor.
+ * @note
+ * The selection index is based on the cursor index.
+ *
+ * text   H e l l o
+ * index 0 1 2 3 4 5
+ * if textEditor.SelectText(1, 4); is executed, "ell" is selected.
+ *
+ * @param[in] textEditor The instance of TextEditor.
+ * @param[in] start The start index of the text to select. (The starting point of start index is 0.)
+ * @param[in] end The end index of the text to select. (If end index > text's length, the end index is set to the length of the text.)
+ */
+DALI_TOOLKIT_API void SelectText(TextEditor textEditor, const uint32_t start, const uint32_t end);
+
+/**
  * @brief Scroll the TextEditor by specific amount.
  *
  * @param[in] textEditor The instance of TextEditor.
index 727b42a..a5d0428 100644 (file)
@@ -50,6 +50,11 @@ void SelectNone(TextField textField)
   GetImpl(textField).SelectNone();
 }
 
+void SelectText(TextField textField, const uint32_t start, const uint32_t end)
+{
+  GetImpl(textField).SelectText(start, end);
+}
+
 } // namespace DevelTextField
 
 } // namespace Toolkit
index 377b606..bd9c39a 100644 (file)
@@ -291,6 +291,21 @@ DALI_TOOLKIT_API void SelectWholeText(TextField textField);
  */
 DALI_TOOLKIT_API void SelectNone(TextField textField);
 
+/**
+ * @brief Select the text from start index to end index of TextField.
+ * @note
+ * The selection index is based on the cursor index.
+ *
+ * text   H e l l o
+ * index 0 1 2 3 4 5
+ * if textField.SelectText(1, 4); is executed, "ell" is selected.
+ *
+ * @param[in] textField The instance of TextField.
+ * @param[in] start The start index of the text to select. (The starting point of start index is 0.)
+ * @param[in] end The end index of the text to select. (If end index > text's length, the end index is set to the length of the text.)
+ */
+DALI_TOOLKIT_API void SelectText(TextField textField, const uint32_t start, const uint32_t end);
+
 } // namespace DevelTextField
 
 } // namespace Toolkit
index 313fee9..a7324b8 100644 (file)
@@ -129,17 +129,15 @@ static int MinorAxisDistance(Dali::Toolkit::Control::KeyboardFocus::Direction di
     case Dali::Toolkit::Control::KeyboardFocus::RIGHT:\r
     {\r
       // the distance between the center verticals\r
-      return std::abs(\r
-        (((source.top + source.bottom) * 0.5f) -\r
-         (((dest.top + dest.bottom) * 0.5f))));\r
+      return std::abs((source.top + (source.bottom - source.top) * 0.5f) -\r
+                      (dest.top + (dest.bottom - dest.top) * 0.5f));\r
     }\r
     case Dali::Toolkit::Control::KeyboardFocus::UP:\r
     case Dali::Toolkit::Control::KeyboardFocus::DOWN:\r
     {\r
       // the distance between the center horizontals\r
-      return std::abs(\r
-        (((source.left + source.right) * 0.5f) -\r
-         (((dest.left + dest.right) * 0.5f))));\r
+      return std::abs((source.left + (source.right - source.left) * 0.5f) -\r
+                      (dest.left + (dest.right - dest.left) * 0.5f));\r
     }\r
     default:\r
     {\r
@@ -190,19 +188,19 @@ static bool IsCandidate(Dali::Rect<float> srcRect, Dali::Rect<float> destRect, D
   {\r
     case Dali::Toolkit::Control::KeyboardFocus::LEFT:\r
     {\r
-      return (srcRect.right > destRect.right || srcRect.left >= destRect.right) && srcRect.left > destRect.left;\r
+      return (srcRect.right > destRect.right || srcRect.left >= destRect.right);\r
     }\r
     case Dali::Toolkit::Control::KeyboardFocus::RIGHT:\r
     {\r
-      return (srcRect.left < destRect.left || srcRect.right <= destRect.left) && srcRect.right < destRect.right;\r
+      return (srcRect.left < destRect.left || srcRect.right <= destRect.left);\r
     }\r
     case Dali::Toolkit::Control::KeyboardFocus::UP:\r
     {\r
-      return (srcRect.bottom > destRect.bottom || srcRect.top >= destRect.bottom) && srcRect.top > destRect.top;\r
+      return (srcRect.bottom > destRect.bottom || srcRect.top >= destRect.bottom);\r
     }\r
     case Dali::Toolkit::Control::KeyboardFocus::DOWN:\r
     {\r
-      return (srcRect.top < destRect.top || srcRect.bottom <= destRect.top) && srcRect.bottom < destRect.bottom;\r
+      return (srcRect.top < destRect.top || srcRect.bottom <= destRect.top);\r
     }\r
     default:\r
     {\r
index 5d620bb..0042451 100644 (file)
@@ -64,7 +64,7 @@ enum Type
   OPACITY             = Dali::Toolkit::Visual::Property::OPACITY,
 
   /**
-   * @brief The fitting mode of the visual
+   * @brief The fitting mode of the visual.
    * @details Name "fittingMode", type FittingMode (Property::INTEGER) or Property::STRING.
    * @see DevelVisual::FittingMode
    * @note The default is defined by the type of visual (if it's suitable to be stretched or not).
@@ -72,12 +72,12 @@ enum Type
   VISUAL_FITTING_MODE = OPACITY + 1,
 
   /**
-   * @brief The radius for the rounded corners of the visual
+   * @brief The radius for the rounded corners of the visual.
    * @details Name "cornerRadius", type Property::FLOAT or Prooperty::VECTOR4, animatable
    * @note By default, it is Vector::ZERO.
    * @note Only Property::Vector4 can be animated.
    * @note Each radius will clamp internally to the half of smaller of the visual width and visual height.
-   * @note Their may exist some alias when you use it as ClippingMode::CLIP_CHILDREN
+   * @note Their may exist some alias when you use it as ClippingMode::CLIP_CHILDREN.
    * @note Radius value are used in clockwise order from top-left-corner to bottom-left-corner.
    *       When radius is Vector4(x, y, z, w)
    *       x    y
@@ -89,7 +89,7 @@ enum Type
   CORNER_RADIUS = OPACITY + 2,
 
   /**
-   * @brief Whether the corner radius value is relative (percentage [0.0f to 1.0f] of the visual size) or absolute (in world units).
+   * @brief Whether the corner radius value is relative (percentage [0.0f to 0.5f] of the visual size) or absolute (in world units).
    * @details Name "cornerRadiusPolicy", type Property::INTEGER.
    * @see Policy::Type
    * @note By default, it is ABSOLUTE to the visual's size.
@@ -98,16 +98,17 @@ enum Type
   CORNER_RADIUS_POLICY = OPACITY + 3,
 
   /**
-   * @brief The width for the borderline of the visual
+   * @brief The width for the borderline of the visual.
    * @details Name "borderlineWidth", type Property::FLOAT, animatable
    * @note Optional. Default value is 0.0f.
    */
   BORDERLINE_WIDTH = OPACITY + 4,
 
   /**
-   * @brief The color for the borderline of the visual
+   * @brief The color for the borderline of the visual.
    * @details Name "borderlineColor", type Property::VECTOR4, animatable
-   * @note Default value is Color::BLACK
+   * @note Default value is Color::BLACK.
+   * @note This color is affected by opacity.
    */
   BORDERLINE_COLOR = OPACITY + 5,
 
index f74a28d..dd67a85 100644 (file)
@@ -766,7 +766,7 @@ void TextEditor::SetProperty(BaseObject* object, Property::Index index, const Pr
       {
         uint32_t position = static_cast<uint32_t>(value.Get<int>());
         DALI_LOG_INFO(gLogFilter, Debug::General, "TextEditor %p PRIMARY_CURSOR_POSITION %d\n", impl.mController.Get(), position);
-        if(impl.mController->SetPrimaryCursorPosition(position))
+        if(impl.mController->SetPrimaryCursorPosition(position, impl.HasKeyInputFocus()))
         {
           impl.SetKeyInputFocus();
         }
@@ -1245,6 +1245,15 @@ void TextEditor::SelectNone()
   }
 }
 
+void TextEditor::SelectText(const uint32_t start, const uint32_t end)
+{
+  if(mController && mController->IsShowingRealText())
+  {
+    mController->SelectText(start, end);
+    SetKeyInputFocus();
+  }
+}
+
 void TextEditor::ScrollBy(Vector2 scroll)
 {
   if(mController && mController->IsShowingRealText())
index 6b6c377..7ba1190 100644 (file)
@@ -273,6 +273,11 @@ public:
   void SelectNone() override;
 
   /**
+   * @copydoc Text::SelectableControlInterface::SelectText()
+   */
+  void SelectText(const uint32_t start, const uint32_t end) override;
+
+  /**
    * @copydoc Dali::Toolkit::DevelTextEditor::ScrollBy()
    */
   void ScrollBy(Vector2 Scroll);
index 2cce4d2..d2bfc5c 100644 (file)
@@ -752,7 +752,7 @@ void TextField::SetProperty(BaseObject* object, Property::Index index, const Pro
       {
         uint32_t position = static_cast<uint32_t>(value.Get<int>());
         DALI_LOG_INFO(gLogFilter, Debug::General, "TextField %p PRIMARY_CURSOR_POSITION %d\n", impl.mController.Get(), position);
-        if(impl.mController->SetPrimaryCursorPosition(position))
+        if(impl.mController->SetPrimaryCursorPosition(position, impl.HasKeyInputFocus()))
         {
           impl.SetKeyInputFocus();
         }
@@ -1176,6 +1176,15 @@ void TextField::SelectNone()
   }
 }
 
+void TextField::SelectText(const uint32_t start, const uint32_t end)
+{
+  if(mController && mController->IsShowingRealText())
+  {
+    mController->SelectText(start, end);
+    SetKeyInputFocus();
+  }
+}
+
 string TextField::GetSelectedText() const
 {
   string selectedText = "";
index 85d50ef..b1f5991 100644 (file)
@@ -264,6 +264,11 @@ public:
   void SelectNone() override;
 
   /**
+   * @copydoc Text::SelectableControlInterface::SelectText()
+   */
+  void SelectText(const uint32_t start, const uint32_t end) override;
+
+  /**
    * @copydoc Text::SelectableControlInterface::GetSelectedText()
    */
   string GetSelectedText() const override;
index 15805c8..79a917e 100644 (file)
@@ -81,6 +81,13 @@ void Controller::EventHandler::KeyboardFocusLostEvent(Controller& controller)
   {
     if(EventData::INTERRUPTED != controller.mImpl->mEventData->mState)
     {
+      // Init selection position
+      if(controller.mImpl->mEventData->mState == EventData::SELECTING)
+      {
+        controller.mImpl->mEventData->mLeftSelectionPosition  = controller.mImpl->mEventData->mPrimaryCursorPosition;
+        controller.mImpl->mEventData->mRightSelectionPosition = controller.mImpl->mEventData->mPrimaryCursorPosition;
+      }
+
       controller.mImpl->ChangeState(EventData::INACTIVE);
 
       if(!controller.mImpl->IsShowingRealText())
@@ -529,6 +536,27 @@ void Controller::EventHandler::SelectEvent(Controller& controller, float x, floa
   }
 }
 
+void Controller::EventHandler::SelectEvent(Controller& controller, const uint32_t start, const uint32_t end, SelectionType selectType)
+{
+  DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Controller::SelectEvent\n");
+
+  if(NULL != controller.mImpl->mEventData)
+  {
+    if(selectType == SelectionType::RANGE)
+    {
+      Event event(Event::SELECT_RANGE);
+      event.p2.mUint = start;
+      event.p3.mUint = end;
+      controller.mImpl->mEventData->mEventQueue.push_back(event);
+    }
+
+    controller.mImpl->mEventData->mCheckScrollAmount     = true;
+    controller.mImpl->mEventData->mIsLeftHandleSelected  = true;
+    controller.mImpl->mEventData->mIsRightHandleSelected = true;
+    controller.mImpl->RequestRelayout();
+  }
+}
+
 void Controller::EventHandler::ProcessModifyEvents(Controller& controller)
 {
   Vector<ModifyEvent>& events = controller.mImpl->mModifyEvents;
index 092ac58..6e6e068 100644 (file)
@@ -45,6 +45,7 @@ struct Controller::EventHandler
   static void PanEvent(Controller& controller, GestureState state, const Vector2& displacement);
   static void LongPressEvent(Controller& controller, GestureState state, float x, float y);
   static void SelectEvent(Controller& controller, float x, float y, SelectionType selectType);
+  static void SelectEvent(Controller& controller, const uint32_t start, const uint32_t end, SelectionType selectType);
   static void ProcessModifyEvents(Controller& controller);
   static void TextReplacedEvent(Controller& controller);
   static void TextInsertedEvent(Controller& controller);
index 995a800..2aafff7 100644 (file)
@@ -104,6 +104,11 @@ bool ControllerImplEventHandler::ProcessInputEvents(Controller::Impl& impl)
           OnSelectNoneEvent(impl);
           break;
         }
+        case Event::SELECT_RANGE:
+        {
+          OnSelectRangeEvent(impl, *iter);
+          break;
+        }
       }
     }
   }
@@ -658,7 +663,7 @@ void ControllerImplEventHandler::OnSelectAllEvent(Controller::Impl& impl)
   if(impl.mEventData)
   {
     EventData& eventData = *impl.mEventData;
-    if(eventData.mSelectionEnabled)
+    if(eventData.mSelectionEnabled && eventData.mState != EventData::INACTIVE)
     {
       ModelPtr&      model          = impl.mModel;
       const Vector2& scrollPosition = model->mScrollPosition;
@@ -693,6 +698,29 @@ void ControllerImplEventHandler::OnSelectNoneEvent(Controller::Impl& impl)
   }
 }
 
+void ControllerImplEventHandler::OnSelectRangeEvent(Controller::Impl& impl, const Event& event)
+{
+  if(impl.mEventData && impl.mEventData->mSelectionEnabled && impl.mEventData->mState != EventData::INACTIVE)
+  {
+    ModelPtr&      model          = impl.mModel;
+    const Vector2& scrollPosition = model->mScrollPosition;
+
+    // Calculate the selection index.
+    const uint32_t length = static_cast<uint32_t>(model->mLogicalModel->mText.Count());
+    const uint32_t start  = std::min(event.p2.mUint, length);
+    const uint32_t end    = std::min(event.p3.mUint, length);
+
+    if(start != end)
+    {
+      // Calculates the logical position from the x,y coords.
+      impl.RepositionSelectionHandles(0.f - scrollPosition.x, 0.f - scrollPosition.y, Controller::NoTextTap::HIGHLIGHT);
+
+      impl.mEventData->mLeftSelectionPosition  = start;
+      impl.mEventData->mRightSelectionPosition = end;
+    }
+  }
+}
+
 void ControllerImplEventHandler::OnHandlePressed(Controller::Impl& impl, const Event& event, const bool isSmoothHandlePanEnabled)
 {
   ModelPtr&      model          = impl.mModel;
index e1e9dbb..82e5c78 100644 (file)
@@ -104,6 +104,14 @@ struct ControllerImplEventHandler
    */
   static void OnSelectNoneEvent(Controller::Impl& controllerImpl);
 
+  /**
+   * @brief Called by Controller::Impl when a select range event is received.
+   *
+   * @param controllerImpl A reference to Controller::Impl
+   * @param event The event
+   */
+  static void OnSelectRangeEvent(Controller::Impl& controllerImpl, const Event& event);
+
 private:
   /**
    * @brief Called by OnHandleEvent when we are in the Pressed state.
index 279f23b..c31fc93 100644 (file)
@@ -1245,7 +1245,7 @@ CharacterIndex Controller::Impl::GetPrimaryCursorPosition() const
   return mEventData->mPrimaryCursorPosition;
 }
 
-bool Controller::Impl::SetPrimaryCursorPosition(CharacterIndex index)
+bool Controller::Impl::SetPrimaryCursorPosition(CharacterIndex index, bool focused)
 {
   if(nullptr == mEventData)
   {
@@ -1261,10 +1261,14 @@ bool Controller::Impl::SetPrimaryCursorPosition(CharacterIndex index)
 
   uint32_t length                    = static_cast<uint32_t>(mModel->mLogicalModel->mText.Count());
   mEventData->mPrimaryCursorPosition = std::min(index, length);
-  ChangeState(EventData::EDITING);
-  mEventData->mLeftSelectionPosition = mEventData->mRightSelectionPosition = mEventData->mPrimaryCursorPosition;
-  mEventData->mUpdateCursorPosition                                        = true;
-  ScrollTextToMatchCursor();
+  // If there is no focus, only the value is updated.
+  if(focused)
+  {
+    ChangeState(EventData::EDITING);
+    mEventData->mLeftSelectionPosition = mEventData->mRightSelectionPosition = mEventData->mPrimaryCursorPosition;
+    mEventData->mUpdateCursorPosition                                        = true;
+    ScrollTextToMatchCursor();
+  }
   return true;
 }
 
index f6681bd..84d6193 100644 (file)
@@ -66,6 +66,7 @@ struct Event
     SELECT,
     SELECT_ALL,
     SELECT_NONE,
+    SELECT_RANGE,
   };
 
   union Param
@@ -625,7 +626,7 @@ struct Controller::Impl
   /**
    * @copydoc Text::Controller::SetPrimaryCursorPosition()
    */
-  bool SetPrimaryCursorPosition(CharacterIndex index);
+  bool SetPrimaryCursorPosition(CharacterIndex index, bool focused);
 
   /**
    * @copydoc Text::SelectableControlInterface::SetTextSelectionRange()
index 7e0410d..dce67ff 100644 (file)
@@ -1822,6 +1822,11 @@ void Controller::SelectEvent(float x, float y, SelectionType selectType)
   EventHandler::SelectEvent(*this, x, y, selectType);
 }
 
+void Controller::SelectEvent(const uint32_t start, const uint32_t end, SelectionType selectType)
+{
+  EventHandler::SelectEvent(*this, start, end, selectType);
+}
+
 void Controller::SetTextSelectionRange(const uint32_t* start, const uint32_t* end)
 {
   if(mImpl->mEventData)
@@ -1845,7 +1850,7 @@ CharacterIndex Controller::GetPrimaryCursorPosition() const
   return mImpl->GetPrimaryCursorPosition();
 }
 
-bool Controller::SetPrimaryCursorPosition(CharacterIndex index)
+bool Controller::SetPrimaryCursorPosition(CharacterIndex index, bool focused)
 {
   if(mImpl->mEventData)
   {
@@ -1853,7 +1858,7 @@ bool Controller::SetPrimaryCursorPosition(CharacterIndex index)
     mImpl->mEventData->mIsLeftHandleSelected  = true;
     mImpl->mEventData->mIsRightHandleSelected = true;
     mImpl->mEventData->mCheckScrollAmount     = true;
-    if(mImpl->SetPrimaryCursorPosition(index))
+    if(mImpl->SetPrimaryCursorPosition(index, focused) && focused)
     {
       KeyboardFocusGainEvent();
       return true;
@@ -1872,6 +1877,11 @@ void Controller::SelectNone()
   SelectEvent(0.f, 0.f, SelectionType::NONE);
 }
 
+void Controller::SelectText(const uint32_t start, const uint32_t end)
+{
+  SelectEvent(start, end, SelectionType::RANGE);
+}
+
 string Controller::GetSelectedText() const
 {
   string text;
index 63a77a4..8c388b9 100644 (file)
@@ -52,9 +52,10 @@ class RenderingController;
    */
 enum SelectionType
 {
-  INTERACTIVE = 0x0000,
-  ALL         = 0x0001,
-  NONE        = 0x0002
+  INTERACTIVE = 0x0000, ///< Select the word where the cursor is located.
+  ALL         = 0x0001, ///< Select the whole text.
+  NONE        = 0x0002, ///< Unselect the whole text.
+  RANGE       = 0x0003  ///< Select the range text.
 };
 
 typedef IntrusivePtr<Controller> ControllerPtr;
@@ -1588,9 +1589,10 @@ public: // Text-input Event Queuing.
    * @brief Used to set the Primary cursor position.
    *
    * @param[in] index for the Primary cursor position.
+   * @param[in] focused true if UI control has gained focus to receive key event, false otherwise.
    * @return[in] true if cursor position changed, false otherwise.
    */
-  bool SetPrimaryCursorPosition(CharacterIndex index);
+  bool SetPrimaryCursorPosition(CharacterIndex index, bool focused);
 
   /**
    * @brief Creates a selection event.
@@ -1604,6 +1606,18 @@ public: // Text-input Event Queuing.
   void SelectEvent(float x, float y, SelectionType selection);
 
   /**
+   * @brief Creates a selection event with a selection index.
+   *
+   * It could be called from the SelectText().
+   * The start and end parameters are passed through the event.
+   *
+   * @param[in] start The start selection position.
+   * @param[in] end The end selection position.
+   * @param[in] selection type like the range.
+   */
+  void SelectEvent(const uint32_t start, const uint32_t end, SelectionType selection);
+
+  /**
    * @copydoc Text::SelectableControlInterface::SetTextSelectionRange()
    */
   void SetTextSelectionRange(const uint32_t* start, const uint32_t* end);
@@ -1624,6 +1638,11 @@ public: // Text-input Event Queuing.
   void SelectNone();
 
   /**
+   * @copydoc Text::SelectableControlInterface::SelectText()
+   */
+  void SelectText(const uint32_t start, const uint32_t end);
+
+  /**
    * @copydoc Text::SelectableControlInterface::GetSelectedText()
    */
   string GetSelectedText() const;
index da19108..3d5feef 100644 (file)
@@ -61,6 +61,13 @@ public:
   virtual void SelectNone() = 0;
 
   /**
+   * @brief Called to set the selection postions in the texts.
+   * @param start start selection position.
+   * @param end end selection position.
+   */
+  virtual void SelectText(const uint32_t start, const uint32_t end) = 0;
+
+  /**
    * @brief Retrive Selected text.
    * @return The seletced text.
    */
index d46521e..71537c6 100644 (file)
@@ -29,7 +29,7 @@ namespace Toolkit
 {
 const unsigned int TOOLKIT_MAJOR_VERSION = 2;
 const unsigned int TOOLKIT_MINOR_VERSION = 0;
-const unsigned int TOOLKIT_MICRO_VERSION = 38;
+const unsigned int TOOLKIT_MICRO_VERSION = 39;
 const char* const  TOOLKIT_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 7fe7263..a9a7ac0 100644 (file)
@@ -1,6 +1,6 @@
 Name:       dali2-toolkit
 Summary:    Dali 3D engine Toolkit
-Version:    2.0.38
+Version:    2.0.39
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT