END_TEST;
}
+int UtcDaliActorSetUserInteractionEnabled(void)
+{
+ TestApplication application;
+ Actor actor = Actor::New();
+
+ bool enabled = !actor.GetProperty<bool>(DevelActor::Property::USER_INTERACTION_ENABLED);
+
+ actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, enabled);
+
+ DALI_TEST_CHECK(enabled == actor.GetProperty<bool>(DevelActor::Property::USER_INTERACTION_ENABLED));
+ END_TEST;
+}
+
+int UtcDaliActorIsUserInteractionEnabled(void)
+{
+ TestApplication application;
+ Actor actor = Actor::New();
+ actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, true);
+
+ DALI_TEST_CHECK(true == actor.GetProperty<bool>(DevelActor::Property::USER_INTERACTION_ENABLED));
+ END_TEST;
+}
+
int UtcDaliActorRemoveConstraints(void)
{
tet_infoline(" UtcDaliActorRemoveConstraints");
*/
#include <dali-test-suite-utils.h>
+#include <dali/devel-api/actors/actor-devel.h>
#include <dali/devel-api/events/hover-event-devel.h>
#include <dali/integration-api/events/hover-event-integ.h>
#include <dali/integration-api/render-task-list-integ.h>
END_TEST;
}
+int UtcDaliHoverActorBecomesUserInteractionDisabled(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(actor);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Connect to actor's hovered signal
+ SignalData data;
+ HoverEventFunctor functor(data);
+ actor.HoveredSignal().Connect(&application, functor);
+
+ // Emit a started signal
+ application.ProcessEvent(GenerateSingleHover(PointState::STARTED, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::STARTED, data.hoverEvent.GetState(0), TEST_LOCATION);
+ data.Reset();
+
+ // Change actor to disable user interaction.
+ actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, false);
+
+ // Emit a motion signal, signalled with an interrupted
+ application.ProcessEvent(GenerateSingleHover(PointState::MOTION, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, data.hoverEvent.GetState(0), TEST_LOCATION);
+ data.Reset();
+ END_TEST;
+}
+
int UtcDaliHoverMultipleLayers(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliTouchEventActorBecomesUserInteractionDisabled(void)
+{
+ TestApplication application;
+
+ Actor actor = Actor::New();
+ actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f));
+ actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+ application.GetScene().Add(actor);
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Connect to actor's touched signal
+ SignalData data;
+ TouchEventFunctor functor(data);
+ actor.TouchedSignal().Connect(&application, functor);
+
+ // Emit a down signal
+ application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION);
+ data.Reset();
+
+ // Change actor to disable user interaction.
+ actor.SetProperty(DevelActor::Property::USER_INTERACTION_ENABLED, false);
+
+ // Emit a motion signal, signalled with an interrupted
+ application.ProcessEvent(GenerateSingleTouch(PointState::MOTION, Vector2(200.0f, 200.0f)));
+ DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION);
+ DALI_TEST_EQUALS(PointState::INTERRUPTED, data.receivedTouch.points[0].state, TEST_LOCATION);
+ data.Reset();
+ END_TEST;
+}
+
int UtcDaliTouchEventMultipleLayers(void)
{
TestApplication application;
* @details Name "keyboardFocusableChildren", type Property::BOOLEAN.
* @note Default value is true.
*/
- KEYBOARD_FOCUSABLE_CHILDREN
+ KEYBOARD_FOCUSABLE_CHILDREN,
+
+ /**
+ * @brief The flag whether the actor should be enabled all user interaction including touch, focus and activation. this value have higher priority over the sensitve and focusable in negative action.
+ * @details Name "userInteractionEnabled", type Property::BOOLEAN.
+ * @note Default value is true.
+ */
+ USER_INTERACTION_ENABLED,
};
} // namespace Property
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("userInteractionEnabled", BOOLEAN, true, false, false, Dali::DevelActor::Property::USER_INTERACTION_ENABLED)
DALI_PROPERTY_TABLE_END(DEFAULT_ACTOR_PROPERTY_START_INDEX, ActorDefaultProperties)
// Signals
mCaptureAllTouchAfterStart(false),
mIsBlendEquationSet(false),
mNeedGesturePropagation(false),
+ mUserInteractionEnabled(true),
mLayoutDirection(LayoutDirection::LEFT_TO_RIGHT),
mDrawMode(DrawMode::NORMAL),
mColorMode(Node::DEFAULT_COLOR_MODE),
}
/**
+ * Sets whether an actor should be enabled all user interaction including touch, focus and activation.
+ * This value have higher priority over the sensitve and focusable in negative action,
+ * which means IsSensitive() or IsFocusable() and enable is false, actor will not emits touch or focus event.
+ * An actor is enabled by default.
+ *
+ * If the application wishes to temporarily disable user interaction:
+ * @code
+ * actor.SetUserInteractionEnabled(false);
+ * @endcode
+ *
+ * Then, to re-enable user interaction, the application should call:
+ * @code
+ * actor.SetUserInteractionEnabled(true);
+ * @endcode
+ *
+ * @see IsSensitive(), IsHittable(), IsKeyboardFocusable() and IsTouchFocusable().
+ * @note If an actor's disabled, child still can be enabled.
+ * @param[in] enabled true to enable user interaction, false otherwise.
+ */
+ void SetUserInteractionEnabled(bool enabled)
+ {
+ mUserInteractionEnabled = enabled;
+ }
+
+ /**
+ * Query whether an actor is enabled user interaction.
+ * @see SetSensitive(bool)
+ * @return true, if user interaction is enabled, false otherwise.
+ */
+ bool IsUserInteractionEnabled() const
+ {
+ return mUserInteractionEnabled;
+ }
+
+ /**
* @copydoc Dali::Actor::SetDrawMode
*/
void SetDrawMode(DrawMode::Type drawMode);
*/
bool IsHittable() const
{
- return IsSensitive() && IsVisible() && (GetCurrentWorldColor().a > FULLY_TRANSPARENT) && IsNodeConnected();
+ return (IsUserInteractionEnabled()) && IsSensitive() && IsVisible() && (GetCurrentWorldColor().a > FULLY_TRANSPARENT) && IsNodeConnected();
}
/**
bool mCaptureAllTouchAfterStart : 1; ///< Whether the actor should capture all touch after touch starts even if the motion moves outside of the actor area.
bool mIsBlendEquationSet : 1; ///< Flag to identify whether the Blend equation is set
bool mNeedGesturePropagation : 1; ///< Whether the parent listens for gesture events or not
+ bool mUserInteractionEnabled : 1; ///< Whether the actor should be enabled user interaction.
LayoutDirection::Type mLayoutDirection : 2; ///< Layout direction, Left to Right or Right to Left.
DrawMode::Type mDrawMode : 3; ///< Cached: How the actor and its children should be drawn
ColorMode mColorMode : 3; ///< Cached: Determines whether mWorldColor is inherited
break;
}
+ case Dali::DevelActor::Property::USER_INTERACTION_ENABLED:
+ {
+ bool value = false;
+ if(property.Get(value))
+ {
+ actor.SetUserInteractionEnabled(value);
+ }
+ break;
+ }
+
default:
{
// this can happen in the case of a non-animatable default property so just do nothing
break;
}
+ case Dali::DevelActor::Property::USER_INTERACTION_ENABLED:
+ {
+ value = actor.IsUserInteractionEnabled();
+ break;
+ }
+
default:
{
// Must be a scene-graph only property