[Tizen] Add KEYBOARD_FOCUSABLE_CHILDREN property. 51/267651/1 accepted/tizen/6.0/unified/20211216.155548 submit/tizen_6.0/20211216.043505
authorjoogab.yun <joogab.yun@samsung.com>
Thu, 19 Aug 2021 08:18:21 +0000 (17:18 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Wed, 8 Dec 2021 06:36:19 +0000 (15:36 +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 605c267..d41ad54 100755 (executable)
@@ -2522,6 +2522,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;
index bb7c0d3..714215a 100644 (file)
@@ -160,7 +160,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 34c50d7..c6ee84f 100644 (file)
@@ -142,6 +142,7 @@ DALI_PROPERTY("updateSizeHint", VECTOR2, true, false, false, Dali::DevelActor::P
 DALI_PROPERTY("captureAllTouchAfterStart", BOOLEAN, true, false, false, Dali::DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START)
 DALI_PROPERTY("touchAreaOffset", RECTANGLE, true, false, false, Dali::DevelActor::Property::TOUCH_AREA_OFFSET)
 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
@@ -1449,6 +1450,7 @@ Actor::Actor(DerivedType derivedType, const SceneGraph::Node& node)
   mSensitive(true),
   mLeaveRequired(false),
   mKeyboardFocusable(false),
+  mKeyboardFocusableChildren(true),
   mTouchFocusable(false),
   mOnSceneSignalled(false),
   mInsideOnSizeSet(false),
index 5a038ff..7a4a9af 100644 (file)
@@ -1337,6 +1337,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.
    */
@@ -2080,6 +2096,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 ce4cc93..4953f48 100644 (file)
@@ -591,6 +591,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
@@ -1632,6 +1642,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