Add KEYBOARD_FOCUSABLE_CHILDREN property. 62/262762/6
authorjoogab.yun <joogab.yun@samsung.com>
Thu, 19 Aug 2021 08:18:21 +0000 (17:18 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Fri, 27 Aug 2021 04:24:02 +0000 (13:24 +0900)
Whether the children of this actor can be focusable by keyboard navigation.

Change-Id: I9a2093aeb9bb0a4c3ace6dcb888cbe8b1b1cfd28

automated-tests/src/dali/utc-Dali-Actor.cpp
dali/devel-api/actors/actor-devel.h
dali/internal/event/actors/actor-impl.cpp
dali/internal/event/actors/actor-impl.h
dali/internal/event/actors/actor-property-handler.cpp

index 03936d3..8da28bc 100644 (file)
@@ -2550,6 +2550,30 @@ int UtcDaliActorIsKeyboardFocusable(void)
   END_TEST;
 }
 
+int UtcDaliActorSetKeyboardFocusableChildren(void)
+{
+  TestApplication application;
+
+  Actor actor = Actor::New();
+
+  actor.SetProperty(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN, true);
+  DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == true);
+
+  actor.SetProperty(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN, false);
+  DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == false);
+  END_TEST;
+}
+
+int UtcDaliActorAreChildrenKeyBoardFocusable(void)
+{
+  TestApplication application;
+
+  Actor actor = Actor::New();
+
+  DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == true);
+  END_TEST;
+}
+
 int UtcDaliActorSetTouchFocusable(void)
 {
   TestApplication application;
@@ -7716,12 +7740,12 @@ int UtcDaliActorSwitchParentP(void)
   Actor parent2 = Actor::New();
   application.GetScene().Add(parent2);
 
-  bool  addSignalReceived = false;
+  bool                  addSignalReceived = false;
   ChildAddedSignalCheck addedSignal(addSignalReceived, child);
   DevelActor::ChildAddedSignal(application.GetScene().GetRootLayer()).Connect(&application, addedSignal);
   DALI_TEST_EQUALS(addSignalReceived, false, TEST_LOCATION);
 
-  bool  removedSignalReceived = false;
+  bool                    removedSignalReceived = false;
   ChildRemovedSignalCheck removedSignal(removedSignalReceived, child);
   DevelActor::ChildRemovedSignal(application.GetScene().GetRootLayer()).Connect(&application, removedSignal);
   DALI_TEST_EQUALS(removedSignalReceived, false, TEST_LOCATION);
index 632536d..aca2b6e 100644 (file)
@@ -170,7 +170,14 @@ enum Type
    * @endcode
    * @details Name "touchFocusable", type Property::BOOLEAN.
    */
-  TOUCH_FOCUSABLE
+  TOUCH_FOCUSABLE,
+
+  /**
+   * @brief Whether the children of this actor can be focusable by keyboard navigation. If user sets this to false, the children of this actor will not be focused.
+   * @details Name "keyboardFocusableChildren", type Property::BOOLEAN.
+   * @note Default value is true.
+   */
+  KEYBOARD_FOCUSABLE_CHILDREN
 };
 
 } // namespace Property
index f5be1a7..3fd4f3e 100644 (file)
@@ -149,6 +149,7 @@ DALI_PROPERTY("captureAllTouchAfterStart", BOOLEAN, true, false, false, Dali::De
 DALI_PROPERTY("touchAreaOffset", RECTANGLE, true, false, false, Dali::DevelActor::Property::TOUCH_AREA_OFFSET)
 DALI_PROPERTY("blendEquation", INTEGER, true, false, false, Dali::DevelActor::Property::BLEND_EQUATION)
 DALI_PROPERTY("touchFocusable", BOOLEAN, true, false, false, Dali::DevelActor::Property::TOUCH_FOCUSABLE)
+DALI_PROPERTY("keyboardFocusableChildren", BOOLEAN, true, false, false, Dali::DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN)
 DALI_PROPERTY_TABLE_END(DEFAULT_ACTOR_PROPERTY_START_INDEX, ActorDefaultProperties)
 
 // Signals
@@ -1343,6 +1344,7 @@ Actor::Actor(DerivedType derivedType, const SceneGraph::Node& node)
   mSensitive(true),
   mLeaveRequired(false),
   mKeyboardFocusable(false),
+  mKeyboardFocusableChildren(true),
   mTouchFocusable(false),
   mOnSceneSignalled(false),
   mInsideOnSizeSet(false),
index e7fed21..11bbfa7 100644 (file)
@@ -1334,6 +1334,22 @@ public:
   }
 
   /**
+   * @copydoc Dali::Actor::SetKeyboardFocusableChildren()
+   */
+  void SetKeyboardFocusableChildren(bool focusable)
+  {
+    mKeyboardFocusableChildren = focusable;
+  }
+
+  /**
+   * @copydoc Dali::Actor::AreChildrenKeyBoardFocusable()
+   */
+  bool AreChildrenKeyBoardFocusable() const
+  {
+    return mKeyboardFocusableChildren;
+  }
+
+  /**
    * Set whether this view can focus by touch.
    * @param[in] focusable focuable by touch.
    */
@@ -2086,6 +2102,7 @@ protected:
   bool                     mSensitive : 1;                 ///< Whether the actor emits touch event signals
   bool                     mLeaveRequired : 1;             ///< Whether a touch event signal is emitted when the a touch leaves the actor's bounds
   bool                     mKeyboardFocusable : 1;         ///< Whether the actor should be focusable by keyboard navigation
+  bool                     mKeyboardFocusableChildren : 1; ///< Whether the children of this actor can be focusable by keyboard navigation.
   bool                     mTouchFocusable : 1;            ///< Whether the actor should be focusable by touch
   bool                     mOnSceneSignalled : 1;          ///< Set to true before OnSceneConnection signal is emitted, and false before OnSceneDisconnection
   bool                     mInsideOnSizeSet : 1;           ///< Whether we are inside OnSizeSet
index 9c28f27..6d58df5 100644 (file)
@@ -607,6 +607,16 @@ void Actor::PropertyHandler::SetDefaultProperty(Internal::Actor& actor, Property
       break;
     }
 
+    case Dali::DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN:
+    {
+      bool value = false;
+      if(property.Get(value))
+      {
+        actor.SetKeyboardFocusableChildren(value);
+      }
+      break;
+    }
+
     default:
     {
       // this can happen in the case of a non-animatable default property so just do nothing
@@ -1662,6 +1672,12 @@ bool Actor::PropertyHandler::GetCachedPropertyValue(const Internal::Actor& actor
       break;
     }
 
+    case Dali::DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN:
+    {
+      value = actor.AreChildrenKeyBoardFocusable();
+      break;
+    }
+
     default:
     {
       // Must be a scene-graph only property