This is a property that allows you to have focus even when touched.
It works only when KEYBOARD_FOCUSABLE is set to true.
KEYBOARD_FOCUSABLE : whether the view can have focus or not
TOUCH_FOCUSABLE : Whether the user can focus by touch
Change-Id: Id991d7a0bd734718164b874f013e24235476e789
END_TEST;
}
+int UtcDaliActorSetTouchFocusable(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ actor.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, true);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == true);
+
+ actor.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, false);
+ DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == false);
+ END_TEST;
+}
+
+int UtcDaliActorIsTouchFocusable(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+
+ DALI_TEST_CHECK(actor.GetProperty<bool>(DevelActor::Property::TOUCH_FOCUSABLE) == false);
+ END_TEST;
+}
+
int UtcDaliActorRemoveConstraints(void)
{
tet_infoline(" UtcDaliActorRemoveConstraints");
* @note Color of each renderer will be blended with rendering framebuffer.
* @note To check the blend equation is supported in the system, use Dali::Capabilities::IsBlendEquationSupported
*/
- BLEND_EQUATION
+ BLEND_EQUATION,
+
+ /**
+ * @brief Sets whether this view can focus by touch. If user sets this to true, the actor will be focused when user touch it.
+ * @code
+ * Actor actor = Actor::New();
+ * actor.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true); // whether the view can have focus or not with keyboard navigation.
+ * actor.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, true); // Whether the user can focus by touch, user can set focus by touching the actor.
+ * @endcode
+ * @details Name "touchFocusable", type Property::BOOLEAN.
+ */
+ TOUCH_FOCUSABLE
};
} // namespace Property
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("blendEquation", INTEGER, true, false, false, Dali::DevelActor::Property::BLEND_EQUATION)
+DALI_PROPERTY("touchFocusable", BOOLEAN, true, false, false, Dali::DevelActor::Property::TOUCH_FOCUSABLE)
DALI_PROPERTY_TABLE_END(DEFAULT_ACTOR_PROPERTY_START_INDEX, ActorDefaultProperties)
// Signals
mSensitive(true),
mLeaveRequired(false),
mKeyboardFocusable(false),
+ mTouchFocusable(false),
mOnSceneSignalled(false),
mInsideOnSizeSet(false),
mInheritPosition(true),
}
/**
+ * Set whether this view can focus by touch.
+ * @param[in] focusable focuable by touch.
+ */
+ void SetTouchFocusable(bool focusable)
+ {
+ mTouchFocusable = focusable;
+ }
+
+ /**
+ * This returns whether this actor can focus by touch.
+ * @return true if this actor can focus by touch.
+ */
+ bool IsTouchFocusable() const
+ {
+ return mTouchFocusable;
+ }
+
+ /**
* Query whether the application or derived actor type requires intercept touch events.
* @return True if intercept touch events are required.
*/
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 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
bool mInheritPosition : 1; ///< Cached: Whether the parent's position should be inherited.
break;
}
+ case Dali::DevelActor::Property::TOUCH_FOCUSABLE:
+ {
+ bool value = false;
+ if(property.Get(value))
+ {
+ actor.SetTouchFocusable(value);
+ }
+ break;
+ }
+
default:
{
// this can happen in the case of a non-animatable default property so just do nothing
break;
}
+ case Dali::DevelActor::Property::TOUCH_FOCUSABLE:
+ {
+ value = actor.IsTouchFocusable();
+ break;
+ }
+
default:
{
// Must be a scene-graph only property
{
bool IsActorHittable(Actor* actor) override
{
- return actor->GetTouchRequired() && // Does the Application or derived actor type require a touch event?
- actor->IsHittable(); // Is actor sensitive, visible and on the scene?
+ return (actor->GetTouchRequired() || actor->IsTouchFocusable()) && // Does the Application or derived actor type require a touch event? or focusable by touch?
+ actor->IsHittable(); // Is actor sensitive, visible and on the scene?
}
bool DescendActorHierarchy(Actor* actor) override