-#ifndef __DALI_INTERNAL_GESTURE_PROCESSOR_H__
-#define __DALI_INTERNAL_GESTURE_PROCESSOR_H__
+#ifndef DALI_INTERNAL_GESTURE_PROCESSOR_H
+#define DALI_INTERNAL_GESTURE_PROCESSOR_H
/*
- * Copyright (c) 2014 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.
*/
// INTERNAL INCLUDES
+#include <dali/internal/event/common/object-impl.h>
#include <dali/internal/event/events/gesture-detector-impl.h>
+#include <dali/internal/event/events/gesture-recognizer.h>
#include <dali/internal/event/events/hit-test-algorithm-impl.h>
-#include <dali/internal/event/common/proxy-object.h>
namespace Dali
{
-
class Actor;
namespace Internal
{
-
/**
* Base class for the different Gesture Processors.
*/
-class GestureProcessor : public ProxyObject::Observer
+class GestureProcessor : public Object::Observer
{
-protected:
+public:
+ /**
+ * Process the touch event in the attached recognizer
+ * @param[in] scene Scene.
+ * @param[in] event Touch event to process
+ */
+ void ProcessTouch(Scene& scene, const Integration::TouchEvent& event);
+
+ /**
+ * Returns whether any GestureDetector requires a Core::Update
+ * @return true if update required
+ */
+ inline bool NeedsUpdate()
+ {
+ bool updateRequired = mNeedsUpdate;
+ mNeedsUpdate = false;
+ return updateRequired;
+ }
+protected:
// Construction & Destruction
/**
* Protected constructor. Cannot create an instance of GestureProcessor
*/
- GestureProcessor( Gesture::Type type );
+ GestureProcessor(GestureType::Value type);
/**
* Virtual protected destructor.
*/
- virtual ~GestureProcessor();
+ ~GestureProcessor() override;
// Methods to be used by deriving classes
* @note Uses CheckGestureDetector() to check if a the current gesture matches the criteria the gesture detector requires.
* @pre gestureDetectors should be empty.
*/
- void GetGesturedActor( Actor*& actor, GestureDetectorContainer& gestureDetectors );
+ void GetGesturedActor(Actor*& actor, GestureDetectorContainer& gestureDetectors);
/**
* Calls the emission method in the deriving class for matching gesture-detectors with the hit-actor (or one of its parents).
* and EmitGestureSignal() to emit the signal.
* @pre Hit Testing should already be done.
*/
- void ProcessAndEmit( HitTestAlgorithm::Results& hitTestResults );
+ void ProcessAndEmit(HitTestAlgorithm::Results& hitTestResults);
/**
* Hit test the screen coordinates, and place the results in hitTestResults.
- * @param[in] stage Stage.
+ * @param[in] scene Scene.
* @param[in] screenCoordinates The screen coordinates to test.
* @param[out] hitTestResults Structure to write results into.
* @return false if the system overlay was hit or no actor was hit.
*/
- virtual bool HitTest(Stage& stage, Vector2 screenCoordinates, HitTestAlgorithm::Results& hitTestResults);
+ virtual bool HitTest(Scene& scene, Vector2 screenCoordinates, HitTestAlgorithm::Results& hitTestResults);
/**
* Sets the mCurrentGesturedActor and connects to the required signals.
* @actor actor The actor so set.
*/
- void SetActor( Actor* actor );
+ void SetActor(Actor* actor);
/**
* Resets the set actor and disconnects any connected signals.
Actor* GetCurrentGesturedActor();
private:
-
// For derived classes to override
/**
*
* @return true, if the detector meets the parameters, false otherwise.
*/
- virtual bool CheckGestureDetector( GestureDetector* detector, Actor* actor ) = 0;
+ virtual bool CheckGestureDetector(GestureDetector* detector, Actor* actor) = 0;
/**
* Called by the ProcessAndEmit() method when the gesture meets all applicable criteria and
* @param[in] gestureDetectors The detectors that should emit the signal.
* @param[in] actorCoordinates The local actor coordinates where the gesture took place.
*/
- virtual void EmitGestureSignal( Actor* actor, const GestureDetectorContainer& gestureDetectors, Vector2 actorCoordinates ) = 0;
+ virtual void EmitGestureSignal(Actor* actor, const GestureDetectorContainer& gestureDetectors, Vector2 actorCoordinates) = 0;
// Undefined
- GestureProcessor( const GestureProcessor& );
- GestureProcessor& operator=( const GestureProcessor& );
+ GestureProcessor(const GestureProcessor&);
+ GestureProcessor& operator=(const GestureProcessor&);
// SceneObject overrides
/**
* This will never get called as we do not observe objects that have not been added to the scene.
- * @param[in] proxy The proxy object.
- * @see ProxyObject::Observer::SceneObjectAdded()
+ * @param[in] object The object object.
+ * @see Object::Observer::SceneObjectAdded()
*/
- virtual void SceneObjectAdded(ProxyObject& proxy) { }
+ void SceneObjectAdded(Object& object) override
+ {
+ }
/**
* This will be called when the actor is removed from the stage, we should clear and stop
* observing it.
- * @param[in] proxy The proxy object.
- * @see ProxyObject::Observer::SceneObjectRemoved()
+ * @param[in] object The object object.
+ * @see Object::Observer::SceneObjectRemoved()
*/
- virtual void SceneObjectRemoved(ProxyObject& proxy);
+ void SceneObjectRemoved(Object& object) override;
/**
* This will be called when the actor is destroyed. We should clear the actor.
* No need to stop observing as the object is being destroyed anyway.
- * @see ProxyObject::Observer::ProxyDestroyed()
+ * @see Object::Observer::ObjectDestroyed()
*/
- virtual void ProxyDestroyed(ProxyObject& proxy);
-
-private: // Data
-
- Gesture::Type mType; ///< Type of GestureProcessor
- Actor* mCurrentGesturedActor; ///< The current actor that has been gestured.
- bool mGesturedActorDisconnected:1; ///< Indicates whether the gestured actor has been disconnected from the scene
+ void ObjectDestroyed(Object& object) override;
+
+protected: //Data
+ GestureRecognizerPtr mGestureRecognizer; ///< The gesture recognizer
+ bool mNeedsUpdate; ///< Indicates if any GestureDetector requires a Core::Update
+
+private: // Data
+ GestureType::Value mType; ///< Type of GestureProcessor
+ Actor* mCurrentGesturedActor; ///< The current actor that has been gestured.
+ Integration::Point mPoint; ///< The point of event touched.
+ uint32_t mEventTime; ///< The time the event occurred.
+ bool mGesturedActorDisconnected : 1; ///< Indicates whether the gestured actor has been disconnected from the scene
};
} // namespace Internal
} // namespace Dali
-#endif // __DALI_INTERNAL_GESTURE_PROCESSOR_H__
+#endif // DALI_INTERNAL_GESTURE_PROCESSOR_H