#define DALI_INTERNAL_GESTURE_H
/*
- * Copyright (c) 2020 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.
*/
// INTERNAL INCLUDES
-#include <dali/public-api/events/gesture.h>
#include <dali/integration-api/events/event.h>
+#include <dali/public-api/events/gesture.h>
#include <dali/public-api/object/base-object.h>
namespace Dali
{
-
namespace Internal
{
-
class Gesture;
using GesturePtr = IntrusivePtr<Gesture>;
class Gesture : public BaseObject
{
public:
-
/**
* @brief Get the gesture type.
*
* @brief Set the state of the gesture.
* @param[in] state The state of the gesture to set
*/
- inline void SetState( GestureState state )
+ inline void SetState(GestureState state)
{
mState = state;
}
- /**
+ /**
* @brief Get the state of the gesture.
*
* @return The state of the gesture.
* @brief Set The time the gesture took place.
* @param[in] time The time the gesture took place. to set
*/
- inline void SetTime( uint32_t time )
+ inline void SetTime(uint32_t time)
{
mTime = time;
}
return mTime;
}
- Gesture(const Gesture&) = delete; ///< Deleted copy constructor
- Gesture(Gesture&&) = delete; ///< Deleted move constructor
+ /**
+ * @brief Sets the value of which source the gesture was started with. (ex : mouse)
+ * @param[in] source The gesture source type.
+ */
+ inline void SetSourceType(GestureSourceType source)
+ {
+ mSourceType = source;
+ }
+
+ /**
+ * @brief Gets the value of which source the gesture was started with.
+ * @return The gesture source type.
+ */
+ inline GestureSourceType GetSourceType() const
+ {
+ return mSourceType;
+ }
+
+ /**
+ * @brief Sets the value of source data.
+ * @param[in] data The gesture source data.
+ */
+ inline void SetSourceData(GestureSourceData data)
+ {
+ mSourceData = data;
+ }
+
+ /**
+ * @brief Gets the data of source type.
+ * @return The gesture source data.
+ */
+ inline GestureSourceData GetSourceData() const
+ {
+ return mSourceData;
+ }
+
+ Gesture(const Gesture&) = delete; ///< Deleted copy constructor
+ Gesture(Gesture&&) = delete; ///< Deleted move constructor
Gesture& operator=(const Gesture&) = delete; ///< Deleted copy assignment operator
- Gesture& operator=(Gesture&&) = delete; ///< Deleted move assignment operator
+ Gesture& operator=(Gesture&&) = delete; ///< Deleted move assignment operator
protected:
-
/**
* 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.
*/
Gesture(GestureType::Value gestureType, GestureState gestureState)
- : mGestureType( gestureType ),
- mState( gestureState )
+ : mGestureType(gestureType),
+ mState(gestureState),
+ mSourceType(GestureSourceType::INVALID),
+ mSourceData(GestureSourceData::INVALID)
{
}
*
* A reference counted object may only be deleted by calling Unreference()
*/
- virtual ~Gesture() = default;
+ ~Gesture() override = default;
private:
GestureType::Value mGestureType;
- GestureState mState;
- uint32_t mTime{0u};
+ GestureState mState;
+ uint32_t mTime{0u};
+ GestureSourceType mSourceType;
+ GestureSourceData mSourceData;
};
} // namespace Internal
*/
inline Internal::Gesture& GetImplementation(Dali::Gesture& gesture)
{
- DALI_ASSERT_ALWAYS( gesture && "gesture handle is empty" );
+ DALI_ASSERT_ALWAYS(gesture && "gesture handle is empty");
BaseObject& handle = gesture.GetBaseObject();
inline const Internal::Gesture& GetImplementation(const Dali::Gesture& gesture)
{
- DALI_ASSERT_ALWAYS( gesture && "gesture handle is empty" );
+ DALI_ASSERT_ALWAYS(gesture && "gesture handle is empty");
const BaseObject& handle = gesture.GetBaseObject();