#define DALI_INTERNAL_GESTURE_RECOGNIZER_H
/*
- * Copyright (c) 2019 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.
*/
// EXTERNAL INCLUDES
+#include <dali/internal/event/events/gesture-event.h>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/events/gesture.h>
#include <dali/public-api/math/vector2.h>
#include <dali/public-api/object/ref-object.h>
-#include <dali/internal/event/events/gesture-event.h>
namespace Dali
{
-
namespace Integration
{
struct TouchEvent;
namespace Internal
{
-class GestureRequest;
+struct GestureRequest;
class Scene;
-template< typename T>
+template<typename T>
class RecognizerObserver
{
public:
- virtual void Process( Scene& scene, const T& event ) = 0;
+ virtual void Process(Scene& scene, const T& event) = 0;
- virtual ~RecognizerObserver(){};
+ virtual ~RecognizerObserver() = default;
+ ;
};
-
/**
* Abstract Base class for all adaptor gesture detectors.
*
* Returns the type of gesture detector.
* @return Type of gesture detector.
*/
- Gesture::Type GetType() const { return mType; }
+ GestureType::Value GetType() const
+ {
+ return mType;
+ }
+ /**
+ * Called when we get a touch event.
+ * @param[in] scene The scene the touch event has occurred on
+ * @param[in] event The latest touch event
+ */
void SendEvent(Scene& scene, const Integration::TouchEvent& event)
{
mScene = &scene;
}
protected:
-
/**
- * Protected Constructor. Should only be able to create derived class objects.
+ * Protected Constructor. Should only be able to create derived class objects.
* @param[in] screenSize The size of the screen.
* @param[in] detectorType The type of gesture detector.
*/
- GestureRecognizer( Vector2 screenSize, Gesture::Type detectorType )
+ GestureRecognizer(Vector2 screenSize, GestureType::Value detectorType)
: mScreenSize(screenSize),
mType(detectorType),
mScene(nullptr)
}
/**
+ * Protected Constructor. Should only be able to create derived class objects.
+ *
+ * Use this constructor with the screen size is not used in the dereived class.
+ * @param[in] detectorType The type of gesture detector.
+ */
+ GestureRecognizer(GestureType::Value detectorType)
+ : GestureRecognizer(Vector2::ZERO, detectorType)
+ {
+ }
+
+ /**
* Virtual destructor.
*/
- virtual ~GestureRecognizer() {}
+ ~GestureRecognizer() override = default;
protected:
- Vector2 mScreenSize;
- Gesture::Type mType;
- Scene* mScene;
+ Vector2 mScreenSize;
+ GestureType::Value mType;
+ Scene* mScene;
};
-typedef IntrusivePtr<GestureRecognizer> GestureRecognizerPtr;
+using GestureRecognizerPtr = IntrusivePtr<GestureRecognizer>;
} // namespace Internal