Making DALi public API typesafe using guaranteed types; uint8_t, uint32_t
[platform/core/uifw/dali-core.git] / dali / public-api / events / touch-point.h
index d5038ef..e6f099b 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_TOUCH_POINT_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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/vector-wrapper.h>
 #include <dali/public-api/actors/actor.h>
 #include <dali/public-api/math/vector2.h>
 
-namespace Dali DALI_IMPORT_API
+namespace Dali
 {
+/**
+ * @addtogroup dali_core_events
+ * @{
+ */
 
 /**
  * @brief A TouchPoint represents a point on the screen that is currently being touched
  * or where touch has stopped.
+ * @SINCE_1_0.0
  */
-struct TouchPoint
+struct DALI_CORE_API TouchPoint
 {
   // Enumerations
 
   /**
-   * @brief Touch state
+   * @brief Enumeration for Touch state.
+   * @SINCE_1_0.0
    */
   enum State
   {
-    Down,        /**< Screen touched */
-    Up,          /**< Touch stopped */
-    Motion,      /**< Finger dragged */
-    Leave,       /**< Leave the boundary of an actor */
-    Stationary,  /**< No change from last event.  Useful when a multi-touch event occurs where
-                      all points are sent but indicates that this particular point has not changed
-                      since the last time */
-    Interrupted, /**< A system event has occurred which has interrupted the touch event sequence. */
-    Last         /**< Number of states. */
+    Started,        /**< Touch or hover started */
+    Finished,       /**< Touch or hover finished */
+    Down = Started, /**< Screen touched */
+    Up = Finished,  /**< Touch stopped */
+    Motion,         /**< Finger dragged or hovered */
+    Leave,          /**< Leave the boundary of an actor */
+    Stationary,     /**< No change from last event.  Useful when a multi-point event occurs where
+                         all points are sent but indicates that this particular point has not changed
+                         since the last time */
+    Interrupted,    /**< A system event has occurred which has interrupted the touch or hover event sequence. */
+    Last            /**< Number of states. */
   };
 
   // Construction & Destruction
 
   /**
-   * @brief Constructor
+   * @brief Constructor.
    *
-   * @param[in]  id       The touch device ID.
-   * @param[in]  state    The state.
-   * @param[in]  screenX  The X co-ordinate relative to the screen's origin.
-   * @param[in]  screenY  The Y co-ordinate relative to the screen's origin.
+   * @SINCE_1_0.0
+   * @param[in] id      The touch device ID
+   * @param[in] state   The state
+   * @param[in] screenX The X co-ordinate relative to the screen's origin
+   * @param[in] screenY The Y co-ordinate relative to the screen's origin
    */
-  TouchPoint(int id, State state, float screenX, float screenY);
+  TouchPoint(int32_t id, State state, float screenX, float screenY);
 
   /**
-   * @brief Constructor
+   * @brief Constructor.
    *
-   * @param[in]  id       The touch device ID.
-   * @param[in]  state    The state.
-   * @param[in]  screenX  The X co-ordinate relative to the screen's origin.
-   * @param[in]  screenY  The Y co-ordinate relative to the screen's origin.
-   * @param[in]  localX   The X co-ordinate relative to the top-left (0.0, 0.0, 0.5) of the actor.
-   * @param[in]  localY   The Y co-ordinate relative to the top-left (0.0, 0.0, 0.5) of the actor.
+   * @SINCE_1_0.0
+   * @param[in] id      The touch device ID
+   * @param[in] state   The state
+   * @param[in] screenX The X co-ordinate relative to the screen's origin
+   * @param[in] screenY The Y co-ordinate relative to the screen's origin
+   * @param[in] localX  The X co-ordinate relative to the top-left (0.0, 0.0, 0.5) of the actor
+   * @param[in] localY  The Y co-ordinate relative to the top-left (0.0, 0.0, 0.5) of the actor
    */
-  TouchPoint(int id, State state, float screenX, float screenY, float localX, float localY);
+  TouchPoint(int32_t id, State state, float screenX, float screenY, float localX, float localY);
 
   /**
-   * @brief Destructor
+   * @brief Destructor.
+   * @SINCE_1_0.0
    */
   ~TouchPoint();
 
@@ -83,7 +98,7 @@ struct TouchPoint
   /**
    * @brief Each touch point has a unique device ID which specifies the touch device for that point.
    */
-  int deviceId;
+  int32_t deviceId;
 
   /**
    * @brief State of the point.
@@ -112,6 +127,13 @@ struct TouchPoint
   Vector2 screen;
 };
 
+typedef std::vector<TouchPoint> TouchPointContainer; ///< Container of touch points. @SINCE_1_0.0
+typedef TouchPointContainer::iterator TouchPointContainerIterator; ///< Iterator for Dali::TouchPointContainer @SINCE_1_0.0
+typedef TouchPointContainer::const_iterator TouchPointContainerConstIterator; ///< Const iterator for Dali::TouchPointContainer @SINCE_1_0.0
+
+/**
+ * @}
+ */
 } // namespace Dali
 
 #endif // __DALI_TOUCH_POINT_H__