From c6ac9b60e05831c2a0b9676a9d5d170477e48b56 Mon Sep 17 00:00:00 2001 From: "joogab.yun" Date: Thu, 19 Aug 2021 17:18:21 +0900 Subject: [PATCH] Add KEYBOARD_FOCUSABLE_CHILDREN property. Whether the children of this actor can be focusable by keyboard navigation. Change-Id: I9a2093aeb9bb0a4c3ace6dcb888cbe8b1b1cfd28 --- automated-tests/src/dali/utc-Dali-Actor.cpp | 28 ++++++++++++++++++++-- dali/devel-api/actors/actor-devel.h | 9 ++++++- dali/internal/event/actors/actor-impl.cpp | 2 ++ dali/internal/event/actors/actor-impl.h | 17 +++++++++++++ .../event/actors/actor-property-handler.cpp | 16 +++++++++++++ 5 files changed, 69 insertions(+), 3 deletions(-) diff --git a/automated-tests/src/dali/utc-Dali-Actor.cpp b/automated-tests/src/dali/utc-Dali-Actor.cpp index 03936d3..8da28bc 100644 --- a/automated-tests/src/dali/utc-Dali-Actor.cpp +++ b/automated-tests/src/dali/utc-Dali-Actor.cpp @@ -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(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == true); + + actor.SetProperty(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN, false); + DALI_TEST_CHECK(actor.GetProperty(DevelActor::Property::KEYBOARD_FOCUSABLE_CHILDREN) == false); + END_TEST; +} + +int UtcDaliActorAreChildrenKeyBoardFocusable(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + + DALI_TEST_CHECK(actor.GetProperty(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); diff --git a/dali/devel-api/actors/actor-devel.h b/dali/devel-api/actors/actor-devel.h index 632536d..aca2b6e 100644 --- a/dali/devel-api/actors/actor-devel.h +++ b/dali/devel-api/actors/actor-devel.h @@ -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 diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index f5be1a7..3fd4f3e 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -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), diff --git a/dali/internal/event/actors/actor-impl.h b/dali/internal/event/actors/actor-impl.h index e7fed21..11bbfa7 100644 --- a/dali/internal/event/actors/actor-impl.h +++ b/dali/internal/event/actors/actor-impl.h @@ -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 diff --git a/dali/internal/event/actors/actor-property-handler.cpp b/dali/internal/event/actors/actor-property-handler.cpp index 9c28f27..6d58df5 100644 --- a/dali/internal/event/actors/actor-property-handler.cpp +++ b/dali/internal/event/actors/actor-property-handler.cpp @@ -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 -- 2.7.4