Moved Gesture::State and -::Type to gesture-enumerations.h.
[platform/core/uifw/dali-core.git] / dali / internal / event / events / gesture-detector-impl.h
index f827e40..66c9a53 100644 (file)
@@ -1,21 +1,22 @@
-#ifndef __DALI_INTERNAL_GESTURE_DETECTOR_H__
-#define __DALI_INTERNAL_GESTURE_DETECTOR_H__
-
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+#ifndef DALI_INTERNAL_GESTURE_DETECTOR_H
+#define DALI_INTERNAL_GESTURE_DETECTOR_H
+
+/*
+ * Copyright (c) 2020 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 // INTERNAL INCLUDES
 #include <dali/public-api/common/vector-wrapper.h>
@@ -55,7 +56,7 @@ struct DerivedGestureDetectorContainer
 /**
  * @copydoc Dali::GestureDetector
  */
-class GestureDetector : public ProxyObject, public ProxyObject::Observer
+class GestureDetector : public Object, public Object::Observer
 {
 public:
 
@@ -75,9 +76,14 @@ public:
   void DetachAll();
 
   /**
-   * @copydoc Dali::GestureDetector::GetAttachedActors() const
+   * @copydoc Dali::GestureDetector::GetAttachedActorCount() const
+   */
+  size_t GetAttachedActorCount() const;
+
+  /**
+   * @copydoc Dali::GestureDetector::GetAttachedActor() const
    */
-  std::vector<Dali::Actor> GetAttachedActors() const;
+  Dali::Actor GetAttachedActor(size_t index) const;
 
   /**
    * Returns a const reference to the container of attached actor pointers.
@@ -92,15 +98,15 @@ public:
    * Retrieves the type of GestureDetector
    * @return The GestureDetector Type
    */
-  Gesture::Type GetType() const
+  GestureType::Value GetType() const
   {
     return mType;
   }
 
   /**
-   * Checks if the specified actor is still attached.
+   * Checks if the specified actor is still attached or pending attachment.
    * @param[in]  actor  The actor to check.
-   * @return true, if the actor is attached, false otherwise.
+   * @return true, if the actor is attached or pending, false otherwise.
    */
   bool IsAttached(Actor& actor) const;
 
@@ -108,8 +114,11 @@ protected: // Creation & Destruction
 
   /**
    * Construct a new GestureDetector.
+   * @param type the type of gesture
+   * @param pointer to the scene object, nullptr if none
+   * by default GestureDetectors don't have our own scene object
    */
-  GestureDetector(Gesture::Type mType);
+  GestureDetector( GestureType::Value type, const SceneGraph::PropertyOwner* sceneObject = nullptr );
 
   /**
    * A reference counted object may only be deleted by calling Unreference()
@@ -119,25 +128,24 @@ protected: // Creation & Destruction
 private:
 
   // Undefined
-  GestureDetector(const GestureDetector&);
-
-  // Undefined
-  GestureDetector& operator=(const GestureDetector& rhs);
+  GestureDetector() = delete;
+  GestureDetector(const GestureDetector&) = delete;
+  GestureDetector& operator=(const GestureDetector& rhs) = delete;
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::Observer::SceneObjectAdded()
+   * @copydoc Dali::Internal::Object::Observer::SceneObjectAdded()
    */
-  virtual void SceneObjectAdded(ProxyObject& proxy) {}
+  virtual void SceneObjectAdded(Object& object);
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::Observer::SceneObjectAdded()
+   * @copydoc Dali::Internal::Object::Observer::SceneObjectAdded()
    */
-  virtual void SceneObjectRemoved(ProxyObject& proxy) {}
+  virtual void SceneObjectRemoved(Object& object) {}
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::Observer::ProxyDestroyed()
+   * @copydoc Dali::Internal::Object::Observer::ObjectDestroyed()
    */
-  virtual void ProxyDestroyed(ProxyObject& proxy);
+  virtual void ObjectDestroyed(Object& object);
 
   /**
    * For use in derived classes, called after an actor is attached.
@@ -159,106 +167,12 @@ private:
    */
   virtual void OnActorDestroyed(Object& object) = 0;
 
-  /**
-   * Dummy touch event handler.  We do not need to know when touch happens on our actor.  We just
-   * need to connect a function so that our attached actor is checked during our hit testing.
-   * @param[in]  actor  The hit actor (or one of its parents).
-   * @param[in]  event  The touch event.
-   * @return false always as we do not process the event.
-   */
-  bool OnTouchEvent(Dali::Actor actor, const TouchEvent& event);
-
-private: // Default property extensions from ProxyObject
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::IsSceneObjectRemovable()
-   */
-  virtual bool IsSceneObjectRemovable() const;
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyCount()
-   */
-  virtual unsigned int GetDefaultPropertyCount() const;
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndices()
-   */
-  virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyName()
-   */
-  virtual const std::string& GetDefaultPropertyName(Property::Index index) const;
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndex()
-   */
-  virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyWritable()
-   */
-  virtual bool IsDefaultPropertyWritable(Property::Index index) const;
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyAnimatable()
-   */
-  virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyAConstraintInput()
-   */
-  virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyType()
-   */
-  virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::SetDefaultProperty()
-   */
-  virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::SetCustomProperty()
-   */
-  virtual void SetCustomProperty( Property::Index index, const CustomProperty& entry, const Property::Value& value );
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultProperty()
-   */
-  virtual Property::Value GetDefaultProperty( Property::Index index ) const;
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::InstallSceneObjectProperty()
-   */
-  virtual void InstallSceneObjectProperty( SceneGraph::PropertyBase& newProperty, const std::string& name, unsigned int index );
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::GetSceneObject()
-   */
-  virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::GetSceneObjectAnimatableProperty()
-   */
-  virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::GetSceneObjectInputProperty()
-   */
-  virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
-
 protected:
 
-  Gesture::Type                 mType;                  ///< The gesture detector will detect this type of gesture.
-  GestureDetectorActorContainer mAttachedActors;        ///< Proxy<Node>::Observer is used to provide weak-pointer behaviour
+  GestureType::Value            mType;                  ///< The gesture detector will detect this type of gesture.
+  GestureDetectorActorContainer mAttachedActors;        ///< Object::Observer is used to provide weak-pointer behaviour
+  GestureDetectorActorContainer mPendingAttachActors;   ///< Object::Observer is used to provide weak-pointer behaviour
   GestureEventProcessor&        mGestureEventProcessor; ///< A reference to the gesture event processor.
-
-private:
-
-  SlotDelegate< GestureDetector > mSlotDelegate;
 };
 
 } // namespace Internal
@@ -285,4 +199,4 @@ inline const Internal::GestureDetector& GetImplementation(const Dali::GestureDet
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_GESTURE_DETECTOR_H__
+#endif // DALI_INTERNAL_GESTURE_DETECTOR_H