-#ifndef __DALI_GESTURE_H__
-#define __DALI_GESTURE_H__
+#ifndef DALI_GESTURE_H
+#define DALI_GESTURE_H
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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 <cstdint> // uint32_t
+
// INTERNAL INCLUDES
#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/events/gesture-enumerations.h>
+#include <dali/public-api/object/base-handle.h>
+
+namespace Dali
+{
+/**
+ * @addtogroup dali_core_events
+ * @{
+ */
-namespace Dali DALI_IMPORT_API
+namespace Internal DALI_INTERNAL
{
+class Gesture;
+}
/**
* @brief Base structure for different gestures that an application can receive.
* To receive a particular gesture, the application has to create and connect to the appropriate
* GestureDetector.
*
+ * @SINCE_1_9.28
+ * @note An instance of this class cannot be created.
* @see GestureDetector
*
- * @note An instance of this class cannot be created.
*/
-struct Gesture
+class DALI_CORE_API Gesture : public BaseHandle
{
+public:
/**
- * @brief Copy constructor.
+ * @brief Creates an uninitialized Gesture handle.
+ *
+ * Calling member functions with an uninitialized Actor handle is not allowed.
+ * @SINCE_1_9.28
*/
- Gesture( const Gesture& rhs );
+ Gesture();
/**
- * @brief Assignment operator.
+ * @brief Copy constructor.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the copied handle
*/
- Gesture& operator=( const Gesture& rhs );
+ Gesture(const Gesture& rhs);
- // Destruction
+ /**
+ * @brief Move constructor.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the handle to move
+ */
+ Gesture(Gesture&& rhs) noexcept;
/**
- * @brief Virtual destructor.
+ * @brief Assignment operator.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the copied handle
+ * @return A reference to this
*/
- virtual ~Gesture();
+ Gesture& operator=(const Gesture& rhs);
/**
- * @brief Type of gesture.
+ * @brief Move assignment operator.
+ * @SINCE_1_9.28
+ * @param[in] rhs A reference to the handle to move
+ * @return A reference to this
*/
- enum Type
- {
- Pinch = 1 << 0, ///< When two touch points move away or towards each other.
- Pan = 1 << 1, ///< When the user drags their finger(s) in a particular direction.
- Tap = 1 << 2, ///< When the user taps the screen.
- LongPress = 1 << 3 ///< When the user continues to touch the same area on the screen for the device configured time.
- };
+ Gesture& operator=(Gesture&& rhs) noexcept;
/**
- * @brief State of the gesture.
+ * @brief Non virtual destructor.
+ * @SINCE_1_9.28
*/
- enum State
- {
- Clear, ///< There is no state associated with this gesture.
- Started, ///< The touched points on the screen have moved enough to be considered a gesture.
- Continuing, ///< The gesture is continuing.
- Finished, ///< The user has lifted a finger or touched an additional point on the screen.
- Cancelled, ///< The gesture has been cancelled.
- Possible ///< A gesture is possible.
- };
-
- // Data
+ ~Gesture();
/**
* @brief The gesture type.
+ * @SINCE_1_9.28
+ * @return The gesture type
*/
- Type type;
+ GestureType::Value GetType() const;
/**
* @brief The gesture state.
*
* Please see the description in the sub-classes to see the states
* used by the actual gesture.
+ * @SINCE_1_9.28
+ * @return The state of the gesture
*/
- State state;
+ GestureState GetState() const;
/**
* @brief The time the gesture took place.
+ * @SINCE_1_9.28
+ * @return The time the gesture took place
*/
- unsigned int time;
+ uint32_t GetTime() const;
-protected: // Creation
+ /**
+ * @brief Gets the value of which source the gesture was started with. (ex : mouse)
+ * @SINCE_2_2.0
+ * @return The gesture input source.
+ */
+ GestureSourceType GetSourceType() const;
/**
- * @brief This constructor is only used by derived classes.
- *
- * @param[in] gestureType The type of gesture event.
- * @param[in] gestureState The state of the gesture event.
+ * @brief Gets the data of the source type.
+ * @SINCE_2_2.0
+ * @return The gesture source data.
*/
- Gesture(Type gestureType, State gestureState);
+ GestureSourceData GetSourceData() const;
+public: // Not intended for application developers
+ /// @cond internal
+ /**
+ * @brief Internal constructor.
+ * @SINCE_1_9.28
+ * @param[in] gesture Pointer to internal gesture
+ */
+ explicit DALI_INTERNAL Gesture(Internal::Gesture* gesture);
+ /// @endcond
};
+/**
+ * @}
+ */
} // namespace Dali
-#endif // __DALI_GESTURE_H__
+#endif // DALI_GESTURE_H