Make warning message instead of Assert when getting Child Property
[platform/core/uifw/dali-core.git] / dali / integration-api / events / touch-event-combiner.h
index 5c5fe99..fd2f25a 100644 (file)
@@ -1,41 +1,43 @@
 #ifndef __DALI_INTEGRATION_TOUCH_EVENT_COMBINER_H__
 #define __DALI_INTEGRATION_TOUCH_EVENT_COMBINER_H__
 
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://floralicense.org/license/
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
+/*
+ * Copyright (c) 2014 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
 
 // INTERNAL INCLUDES
 #include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/events/touch-point.h>
 #include <dali/public-api/math/vector2.h>
+#include <dali/integration-api/events/point.h>
 
-namespace Dali DALI_IMPORT_API
+namespace Dali
 {
 
 namespace Integration
 {
 
 struct TouchEvent;
+struct HoverEvent;
 
 /**
  * Dali::Integration::TouchEventCombiner is a utility class, an instance of which, should be created
  * upon initialisation.  It accepts single Point(s) containing information about a touch area and
- * creates a TouchEvent combining the latest event's information with previous TouchPoint(s).
+ * creates a TouchEvent and/or HoverEvent combining the latest event's information with previous Point(s).
  *
- * The created TouchEvent can then be sent to the Dali Core as indicated by the GetNextTouchEvent()
+ * The created TouchEvent and/or HoverEvent can then be sent to the Dali Core as indicated by the GetNextTouchEvent()
  * method.
  *
  * The TouchEventCombiner ensures that the following rules are also adhered to:
@@ -44,10 +46,20 @@ struct TouchEvent;
  * - Motion event throttling is carried out to satisfy the minimum distance and time delta required.
  * - If an interrupted event is received, then any stored Point history is cleared.
  */
-class TouchEventCombiner
+class DALI_IMPORT_API TouchEventCombiner
 {
 public:
 
+  // Enumerations
+
+  enum EventDispatchType
+  {
+    DispatchTouch,      ///< The touch event should be dispatched.
+    DispatchHover,      ///< The hover event should be dispatched.
+    DispatchBoth,       ///< Both touch event and hover event should be dispatched.
+    DispatchNone        ///< Neither touch event nor hover event should be dispatched.
+  };
+
   /**
    * Default Constructor.
    * @note The default minimum motion time is 1 ms between motion events and the default behaviour
@@ -80,19 +92,20 @@ public:
 public:
 
   /**
-   * Allows the caller to pass in a point which is processed and the TouchEvent is appropriately filled with the new,
+   * Allows the caller to pass in a point which is processed and the TouchEvent and/or HoverEvent is appropriately filled with the new,
    * and previously stored Point information.
    *
-   * @note If the thresholds set have not been passed, then false is returned and the TouchEvent should not be sent
+   * @note If the thresholds set have not been passed, then false is returned and the TouchEvent and/or HoverEvent should not be sent
    * to Dali Core.
    *
    * @param[in]   point         The new Point.
    * @param[in]   time          The time the event occurred.
    * @param[out]  touchEvent    This is populated with the correct Point(s) and time information.
+   * @param[out]  hoverEvent    This is populated with the correct Point(s) and time information.
    *
    * @return true if the point is beyond the different thresholds set thus, should be sent to core, false otherwise.
    */
-  bool GetNextTouchEvent( const TouchPoint& point, unsigned long time, TouchEvent& touchEvent );
+  EventDispatchType GetNextTouchEvent( const Point& point, unsigned long time, TouchEvent& touchEvent, HoverEvent& hoverEvent );
 
   /**
    * Sets the minimum time (in ms) that should occur between motion events.
@@ -139,7 +152,7 @@ public:
   /**
    * This resets any information contained by the TouchEventCombiner.
    * This may be required if some platform event has occurred which makes it necessary to reset any
-   * TouchPoint information that the combiner may store.
+   * Point information that the combiner may store.
    */
   void Reset();
 
@@ -147,7 +160,8 @@ private:
 
   struct PointInfo;
   typedef std::vector< PointInfo > PointInfoContainer;
-  PointInfoContainer mPressedPoints; ///< A container of point and time.
+  PointInfoContainer mPressedPoints; ///< A container of touched point and time.
+  PointInfoContainer mHoveredPoints; ///< A container of hovered point and time.
 
   unsigned long mMinMotionTime; ///< The minimum time that should elapse before considering a new motion event.
   Vector2 mMinMotionDistance; ///< The minimum distance in the X and Y direction before considering a new motion event.