[Tizen] Revert "Use touch consumed return to set whether we process a gesture or...
[platform/core/uifw/dali-core.git] / dali / internal / event / actors / actor-impl.cpp
index db54144..4e9205c 100644 (file)
@@ -146,8 +146,9 @@ DALI_PROPERTY("keyboardFocusable", BOOLEAN, true, false, false, Dali::Actor::Pro
 DALI_PROPERTY("siblingOrder", INTEGER, true, false, false, Dali::DevelActor::Property::SIBLING_ORDER)
 DALI_PROPERTY("updateSizeHint", VECTOR2, true, false, false, Dali::DevelActor::Property::UPDATE_SIZE_HINT)
 DALI_PROPERTY("captureAllTouchAfterStart", BOOLEAN, true, false, false, Dali::DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START)
-DALI_PROPERTY("touchArea", VECTOR2, true, false, false, Dali::DevelActor::Property::TOUCH_AREA)
+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
@@ -1123,9 +1124,9 @@ void Actor::SetTransparent(bool transparent)
   SetTransparentMessage(GetEventThreadServices(), GetNode(), transparent);
 }
 
-bool Actor::GetTransparent() const
+bool Actor::IsTransparent() const
 {
-  return GetNode().GetTransparent();
+  return GetNode().IsTransparent();
 }
 
 void Actor::SetDrawMode(DrawMode::Type drawMode)
@@ -1331,7 +1332,7 @@ Actor::Actor(DerivedType derivedType, const SceneGraph::Node& node)
   mTargetPosition(Vector3::ZERO),
   mTargetScale(Vector3::ONE),
   mAnimatedSize(Vector3::ZERO),
-  mTouchArea(Vector2::ZERO),
+  mTouchAreaOffset(0, 0, 0, 0),
   mName(),
   mSortedDepth(0u),
   mDepth(0u),
@@ -1342,6 +1343,7 @@ Actor::Actor(DerivedType derivedType, const SceneGraph::Node& node)
   mSensitive(true),
   mLeaveRequired(false),
   mKeyboardFocusable(false),
+  mTouchFocusable(false),
   mOnSceneSignalled(false),
   mInsideOnSizeSet(false),
   mInheritPosition(true),
@@ -1351,12 +1353,13 @@ Actor::Actor(DerivedType derivedType, const SceneGraph::Node& node)
   mVisible(true),
   mInheritLayoutDirection(true),
   mCaptureAllTouchAfterStart(false),
+  mIsBlendEquationSet(false),
+  mNeedGesturePropagation(false),
   mLayoutDirection(LayoutDirection::LEFT_TO_RIGHT),
   mDrawMode(DrawMode::NORMAL),
   mColorMode(Node::DEFAULT_COLOR_MODE),
   mClippingMode(ClippingMode::DISABLED),
-  mBlendEquation(DevelBlendEquation::ADD),
-  mIsBlendEquationSet(false)
+  mBlendEquation(DevelBlendEquation::ADD)
 {
 }
 
@@ -1397,56 +1400,31 @@ Actor::~Actor()
   delete mRelayoutData;
 }
 
-void Actor::Add(Actor& child)
+void Actor::Add(Actor& child, bool notify)
 {
-  mParentImpl.Add(child);
+  mParentImpl.Add(child, notify);
 }
 
-void Actor::Remove(Actor& child)
+void Actor::Remove(Actor& child, bool notify)
 {
-  mParentImpl.Remove(child);
+  mParentImpl.Remove(child, notify);
 }
 
 void Actor::SwitchParent(Actor& newParent)
 {
-  DALI_ASSERT_ALWAYS(this != &newParent && "Cannot add actor to itself");
-
-  DALI_ASSERT_ALWAYS((this->OnScene() && newParent.OnScene()) && "Both of current parent and new parent must be on Scene");
-
-  Actor* oldParent = this->GetParent();
-  if(oldParent->RemoveWithoutNotify(*this))
+  if(this == &newParent)
   {
-    // Only put in a relayout request if there is a suitable dependency
-    if(oldParent->RelayoutDependentOnChildren())
-    {
-      oldParent->RelayoutRequest();
-    }
+    DALI_LOG_ERROR("Cannot add actor to itself");
+    return;
   }
 
-  newParent.AddWithoutNotify(*this);
-  mParent            = &newParent;
-  Actor* parentActor = static_cast<Actor*>(&newParent);
-  mScene             = parentActor->mScene;
-
-  // Resolve the name and index for the child properties if any
-  ResolveChildProperties();
-
-  this->InheritLayoutDirectionRecursively(newParent.GetLayoutDirection());
-  // Only put in a relayout request if there is a suitable dependency
-  if(newParent.RelayoutDependentOnChildren())
+  if(!this->OnScene() || !newParent.OnScene())
   {
-    newParent.RelayoutRequest();
+    DALI_LOG_ERROR("Both of current parent and new parent must be on Scene");
+    return;
   }
-}
-
-void Actor::AddWithoutNotify(Actor& child)
-{
-  mParentImpl.AddWithoutNotify(child);
-}
 
-bool Actor::RemoveWithoutNotify(Actor& child)
-{
-  return mParentImpl.RemoveWithoutNotify(child);
+  newParent.Add(*this, false);
 }
 
 uint32_t Actor::GetChildCount() const
@@ -1646,8 +1624,6 @@ void Actor::NotifyStageDisconnection()
     {
       mOnSceneSignalled = false; // signal required next time Actor is added
     }
-
-    SetTransparent(false);
   }
 }
 
@@ -1860,7 +1836,7 @@ void Actor::LowerBelow(Internal::Actor& target)
   }
 }
 
-void Actor::SetParent(ActorParent* parent)
+void Actor::SetParent(ActorParent* parent, bool keepOnScene)
 {
   if(parent)
   {
@@ -1871,7 +1847,7 @@ void Actor::SetParent(ActorParent* parent)
     mScene             = parentActor->mScene;
 
     if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
-       parentActor->OnScene())
+       parentActor->OnScene() && !keepOnScene)
     {
       // Instruct each actor to create a corresponding node in the scene graph
       ConnectToScene(parentActor->GetHierarchyDepth());
@@ -1887,7 +1863,7 @@ void Actor::SetParent(ActorParent* parent)
     mParent = nullptr;
 
     if(EventThreadServices::IsCoreRunning() && // Don't emit signals or send messages during Core destruction
-       OnScene())
+       OnScene() && !keepOnScene)
     {
       // Disconnect the Node & its children from the scene-graph.
       DisconnectNodeMessage(GetEventThreadServices().GetUpdateManager(), GetNode());
@@ -1932,6 +1908,16 @@ Rect<> Actor::CalculateScreenExtents() const
   return {position.x, position.y, size.x, size.y};
 }
 
+void Actor::SetNeedGesturePropagation(bool propagation)
+{
+  mNeedGesturePropagation = propagation;
+}
+
+bool Actor::NeedGesturePropagation()
+{
+  return mNeedGesturePropagation;
+}
+
 bool Actor::GetCachedPropertyValue(Property::Index index, Property::Value& value) const
 {
   return PropertyHandler::GetCachedPropertyValue(*this, index, value);