Ensure BaseHandle class move noexcept (core public-api)
[platform/core/uifw/dali-core.git] / dali / public-api / events / wheel-event.h
index 7fb4c45..b1da5c0 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_WHEEL_EVENT_H__
-#define __DALI_WHEEL_EVENT_H__
+#ifndef DALI_WHEEL_EVENT_H
+#define DALI_WHEEL_EVENT_H
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
  *
  */
 
+// EXTERNAL INCLUDES
+#include <cstdint> // uint32_t
+
 // INTERNAL INCLUDES
 #include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/math/vector2.h>
-
+#include <dali/public-api/object/base-handle.h>
 
 namespace Dali
 {
+namespace Internal DALI_INTERNAL
+{
+class WheelEvent;
+}
+
+/**
+ * @addtogroup dali_core_events
+ * @{
+ */
 
 /**
- * @brief The wheel event structure is used to store a wheel rolling, it facilitates
+ * @brief The wheel event class is used to store a wheel rolling, it facilitates
  * processing of the wheel rolling and passing to other libraries like Toolkit.
  *
  * There is a key modifier which relates to keys like alt, shift and control functions are
@@ -35,103 +47,163 @@ namespace Dali
  *
  * We support a mouse device and there may be another custom device that support the wheel event. The device type is specified as \e type.
  * The mouse wheel event can be sent to the specific actor but the custom wheel event will be sent to the stage.
+ * @SINCE_1_0.0
  */
-struct DALI_IMPORT_API WheelEvent
+class DALI_CORE_API WheelEvent : public BaseHandle
 {
+public:
   // Enumerations
 
   /**
-   * @brief Specifies the type of the wheel event.
+   * @brief Enumeration for specifying the type of the wheel event.
+   * @SINCE_1_0.0
    */
   enum Type
   {
-    MOUSE_WHEEL,      ///< Mouse wheel event
-    CUSTOM_WHEEL      ///< Custom wheel event
+    MOUSE_WHEEL, ///< Mouse wheel event @SINCE_1_0.0
+    CUSTOM_WHEEL ///< Custom wheel event @SINCE_1_0.0
   };
 
+  // Construction & Destruction
+
   /**
-   * @brief Default constructor.
+   * @brief An uninitialized WheelEvent instance.
+   *
+   * Calling member functions with an uninitialized WheelEvent handle is not allowed.
+   * @SINCE_1_0.0
    */
   WheelEvent();
 
   /**
-   * @brief Constructor.
+   * @brief Copy constructor.
    *
-   * @param[in]  type       The type of the wheel event
-   * @param[in]  direction  The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel)
-   * @param[in]  modifiers  modifier keys pressed during the event (such as shift, alt and control)
-   * @param[in]  point      The co-ordinates of the cursor relative to the top-left of the screen.
-   * @param[in]  z          The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise)
-   * @param[in]  timeStamp  The time the wheel is being rolled.
+   * @SINCE_1_9.26
+   * @param[in] rhs The WheelEvent to copy from
    */
-  WheelEvent( Type type, int direction, unsigned int modifiers, Vector2 point, int z, unsigned int timeStamp );
+  WheelEvent(const WheelEvent& rhs);
+
+  /**
+   * @brief Move constructor.
+   *
+   * @SINCE_1_9.26
+   * @param[in] rhs A reference to the moved WheelEvent
+   */
+  WheelEvent(WheelEvent&& rhs) noexcept;
 
   /**
    * @brief Destructor.
+   * @SINCE_1_0.0
    */
   ~WheelEvent();
 
   /**
-   * @brief Check to see if Shift key modifier has been supplied.
+   * @brief Copy assignment operator.
    *
-   * @return bool true if shift modifier
+   * @SINCE_1_9.26
+   * @param[in] rhs The WheelEvent to copy from
+   * @return A reference to this
+   */
+  WheelEvent& operator=(const WheelEvent& rhs);
+
+  /**
+   * @brief Move assignment operator.
+   *
+   * @SINCE_1_9.26
+   * @param[in] rhs A reference to the moved WheelEvent
+   * @return A reference to this
+   */
+  WheelEvent& operator=(WheelEvent&& rhs) noexcept;
+
+  /**
+   * @brief Checks to see if Shift key modifier has been supplied.
+   *
+   * @SINCE_1_0.0
+   * @return True if shift modifier
    */
   bool IsShiftModifier() const;
 
   /**
-   * @brief Check to see if Ctrl (control) key modifier has been supplied.
+   * @brief Checks to see if Ctrl (control) key modifier has been supplied.
    *
-   * @return bool true if ctrl modifier
+   * @SINCE_1_0.0
+   * @return True if ctrl modifier
    */
   bool IsCtrlModifier() const;
 
   /**
-   * @brief Check to see if Alt key modifier has been supplied.
+   * @brief Checks to see if Alt key modifier has been supplied.
    *
-   * @return bool true if alt modifier
+   * @SINCE_1_0.0
+   * @return True if alt modifier
    */
   bool IsAltModifier() const;
 
-  // Data
+  // Getters
 
   /**
-   * @brief Type of the event
+   * @brief Get the type of the wheel event.
    *
-   * @see Type
+   * @SINCE_1_9.26
+   * @return The type of the wheel event
    */
-  Type type;
+  Type GetType() const;
 
   /**
-   * @brief The direction in which the wheel is being rolled.
+   * @brief Get the direction in which the wheel is being rolled.
    *
-   * 0 means the default vertical wheel, and 1 means horizontal wheel
+   * @SINCE_1_9.26
+   * @return The direction of wheel rolling (0 = default vertical wheel, 1 = horizontal wheel)
    */
-  int direction;
+  int32_t GetDirection() const;
 
   /**
-   * @brief Modifier keys pressed during the event (such as shift, alt and control).
+   * @brief Get the modifier keys pressed during the event (such as shift, alt and control).
+   *
+   * @SINCE_1_9.26
+   * @return The modifier keys pressed during the event
    */
-  unsigned int modifiers;
+  uint32_t GetModifiers() const;
 
   /**
-   * @brief The co-ordinates of the cursor relative to the top-left of the screen
+   * @brief Get the co-ordinates of the cursor relative to the top-left of the screen
    * when the wheel is being rolled.
+   *
+   * @SINCE_1_9.26
+   * @return The co-ordinates of the cursor relative to the top-left of the screen
    */
-  Vector2 point;
+  const Vector2& GetPoint() const;
 
   /**
-   * @brief The offset of the wheel rolling, where positive value means rolling down or clockwise
-   * and negative value means rolling up or counter-clockwise.
+   * @brief Get the offset of the wheel rolling
+   *
+   * @SINCE_1_9.26
+   * @return The offset of rolling (positive value means roll down or clockwise, and negative value means roll up or counter-clockwise)
    */
-  int z;
+  int32_t GetDelta() const;
 
   /**
-   * @brief The time when the wheel is being rolled.
+   * @brief Get the time when the wheel is being rolled.
+   *
+   * @SINCE_1_9.26
+   * @return The time when the wheel is being rolled
    */
-  unsigned int timeStamp;
+  uint32_t GetTime() const;
 
+public: // Not intended for application developers
+  /// @cond internal
+  /**
+   * @brief This constructor is used internally to Create an initialized WheelEvent handle.
+   *
+   * @SINCE_1_9.26
+   * @param[in] wheelEvent A pointer to a newly allocated Dali resource
+   */
+  explicit DALI_INTERNAL WheelEvent(Internal::WheelEvent* hoverEvent);
+  /// @endcond
 };
 
+/**
+ * @}
+ */
 } // namespace Dali
 
-#endif // __DALI_WHEEL_EVENT_H__
+#endif // DALI_WHEEL_EVENT_H