Add UserInteractionEnabled property on actor for controlling user interaction.
[platform/core/uifw/dali-core.git] / dali / devel-api / actors / actor-devel.h
old mode 100755 (executable)
new mode 100644 (file)
index 7b1b7d1..e1a0896
@@ -2,7 +2,7 @@
 #define DALI_ACTOR_DEVEL_H
 
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -120,18 +120,71 @@ enum Type
   CAPTURE_ALL_TOUCH_AFTER_START,
 
   /**
-    * @brief If you set the TOUCH_DELEGATE_AREA on an actor, when you touch the actor, the delegate area is used rather than the size of the actor
-    * @details Name "touchDelegateArea", type Property::Vector2
-    * @note Default is Vector2::ZERO.
-    * @note for example
+    * @brief If you set the TOUCH_AREA_OFFSET on an actor, when you touch the actor, the touch area is expand from the size of actor.
+    * @details Name "touchAreaOffset", type Property::Rect<int> (left, right, bottom, top).
+    * For example
+    * @code{.cpp}
     *  Actor actor = Actor::New();
-    *  actor.SetProperty(Actor::Property::SIZE, Vector2(10.0f, 10.0f));
-    *  actor.SetProperty(DevelActor::Property::TOUCH_DELEGATE_AREA, Vector2(200.0f, 200.0f));
+    *  actor.SetProperty(Actor::Property::SIZE, Vector2(20.0f, 20.0f));
+    *  actor.SetProperty(DevelActor::Property::TOUCH_AREA_OFFSET, Rect<int>(-10, 20, 30, -40));
     *  actor.TouchedSignal().Connect(OnTouchCallback);
     *
-    *  If you want to reset the touch area to an area different with the size of the actor, you can set this TOUCH_DELEGATE_AREA property.
+    * +---------------------+
+    * |         ^           |
+    * |         |           |
+    * |         | -40       |
+    * |         |           |
+    * |         |           |
+    * |    +----+----+      |
+    * |    |         |      |
+    * | -10|         | 20   |
+    * |<---+         +----->|
+    * |    |         |      |
+    * |    |         |      |
+    * |    +----+----+      |
+    * |         |           |
+    * |         | 30        |
+    * |         |           |
+    * |         v           |
+    * +---------------------+
+    * @endcode
+    * The actual touched size is actor.width + touchAreaOffset.right - touchAreaOffset.left and actor.height + touchAreaOffset.bottom - touchAreaOffset.top
     */
-  TOUCH_DELEGATE_AREA
+  TOUCH_AREA_OFFSET,
+
+  /**
+   * @brief Determines which blend equation will be used to render renderers of this actor.
+   * @pre To use Advanced Blend Equation(DevelBlendEquation::MULTIPLY ~ DevelBlendEquation::LUMINOSITY), the color to be rendered should be pre-multipled alpha.
+   * @details Name "blendEquation", type Property::INTEGER.
+   * @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,
+
+  /**
+   * @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,
+
+  /**
+   * @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,
+
+  /**
+  * @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
@@ -263,6 +316,45 @@ DALI_CORE_API ChildOrderChangedSignalType& ChildOrderChangedSignal(Actor actor);
  */
 DALI_CORE_API Actor::TouchEventSignalType& InterceptTouchedSignal(Actor actor);
 
+/**
+ * @brief This is used when the parent actor wants to listen to gesture events.
+ *
+ * @note example The child is overlapped on the parent.
+ * Currently, if you tap a child, the parent cannot listen to the tap event.
+ * Now, If set to SetNeedGesturePropagation(true), the parent can receive gesture events.
+ * Please call this setting inside a gesture callback, it will be reset after the gesture callback is called.
+ * @code
+ * {
+ *    Actor parent = Actor::New();
+ *    Actor child = Actor::New();
+ *    parent.Add(child);
+ *    parentTapDetector = TapGestureDetector::New();
+ *    childTapDetector = TapGestureDetector::New();
+ *    parentTapDetector.Attach(parent);
+ *    childTapDetector.Attach(child);
+ *    parentTapDetector.DetectedSignal().Connect(this, &OnParentTap);
+ *    childTapDetector.DetectedSignal().Connect(this, &OnChildTap);
+ * }
+ * void OnChildTap(Dali::Actor actor, const Dali::TapGesture& tap)
+ * {
+ *    // If you set SetNeedGesturePropagation to true here, the parent actor can also listen to events
+ *    Dali::DevelActor::SetNeedGesturePropagation(Self(), true);
+ * }
+ * @endcode
+ *
+ */
+DALI_CORE_API void SetNeedGesturePropagation(Actor actor, bool propagation);
+
+/**
+ * Switch parent in the same tree.
+ * This method changes the actor's parent with keeping on scene state.
+ * Both of current parent Actor and new parent Actor must already be added on Scene.
+ * This method don't emit notification about add/remove and on/off scene.
+ * @param [in] actor This actor
+ * @param [in] newParent An actor to be a new parent of this actor.
+ */
+DALI_CORE_API void SwitchParent(Actor actor, Actor newParent);
+
 } // namespace DevelActor
 
 } // namespace Dali