[dali_1.4.11] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / event-handler.h
index 7f65a46..d0f73e7 100755 (executable)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_EVENT_HANDLER_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 <dali/public-api/common/intrusive-ptr.h>
+
 #include <dali/integration-api/events/key-event-integ.h>
 #include <dali/integration-api/events/point.h>
 #include <dali/integration-api/events/touch-event-combiner.h>
+#include <dali/devel-api/adaptor-framework/clipboard.h>
 #include <dali/devel-api/adaptor-framework/style-monitor.h>
 
 // INTERNAL INCLUDES
-#include <dali/internal/window-system/common/damage-observer.h>
-#include <dali/internal/input/common/drag-and-drop-detector-impl.h>
 #include <dali/internal/accessibility/common/accessibility-adaptor-impl.h>
 #include <dali/internal/clipboard/common/clipboard-event-notifier-impl.h>
+#include <dali/internal/input/common/drag-and-drop-detector-impl.h>
+#include <dali/internal/system/common/core-event-interface.h>
+#include <dali/internal/window-system/common/damage-observer.h>
 #include <dali/internal/window-system/common/rotation-observer.h>
+#include <dali/internal/window-system/common/window-base.h>
 
 namespace Dali
 {
 
+namespace Integration
+{
+
 class RenderSurface;
+class Scene;
+}
 
 namespace Internal
 {
@@ -42,7 +52,6 @@ namespace Internal
 namespace Adaptor
 {
 
-class CoreEventInterface;
 class GestureManager;
 class StyleMonitor;
 
@@ -52,19 +61,18 @@ class StyleMonitor;
  *
  * These TouchEvents are then passed on to Core.
  */
-class EventHandler
+class EventHandler : public ConnectionTracker, public Dali::RefObject
 {
 public:
 
   /**
    * Constructor.
-   * @param[in]  surface                  The surface where events will be sent to.
+   * @param[in]  scene                    The scene where events will be sent to.
    * @param[in]  coreEventInterface       Used to send events to Core.
    * @param[in]  gestureManager           The Gesture Manager.
    * @param[in]  damageObserver           The damage observer (to pass damage events to).
-   * @param[in]  dndDetector              The Drag & Drop listener (to pass DnD events to).
    */
-  EventHandler( RenderSurface* surface, CoreEventInterface& coreEventInterface, GestureManager& gestureManager, DamageObserver& damageObserver, DragAndDropDetectorPtr dndDetector );
+  EventHandler( Dali::Integration::Scene scene, CoreEventInterface& coreEventInterface, GestureManager& gestureManager, DamageObserver& damageObserver );
 
   /**
    * Destructor.
@@ -106,12 +114,6 @@ public:
   void Resume();
 
   /**
-   * Sets the Drag & Drop detector.
-   * @param[in]  detector  An intrusive pointer to the Drag & Drop listener to set. To unset pass in NULL.
-   */
-  void SetDragAndDropDetector( DragAndDropDetectorPtr detector );
-
-  /**
    * Set the rotation observer (note, some adaptors may not have a rotation observer)
    * @param[in] observer The rotation observer
    */
@@ -167,6 +169,58 @@ private:
    */
   void Reset();
 
+  /**
+   * Called when a touch event is received.
+   */
+  void OnTouchEvent( Integration::Point& point, unsigned long timeStamp );
+
+  /**
+   * Called when a mouse wheel is received.
+   */
+  void OnWheelEvent( WheelEvent& wheelEvent );
+
+  /**
+   * Called when a key event is received.
+   */
+  void OnKeyEvent( Integration::KeyEvent& keyEvent );
+
+  /**
+   * Called when the window focus is changed.
+   */
+  void OnFocusChanged( bool focusIn );
+
+  /**
+   * Called when the window is damaged.
+   */
+  void OnWindowDamaged( const DamageArea& area );
+
+  /**
+   * Called when the source window notifies us the content in clipboard is selected.
+   */
+  void OnSelectionDataSend( void* event );
+
+  /**
+   * Called when the source window sends us about the selected content.
+   */
+  void OnSelectionDataReceived( void* event );
+
+  /**
+   * Called when the style is changed.
+   */
+  void OnStyleChanged( StyleChange::Type styleChange );
+
+  /**
+   * Called when Ecore ElDBus accessibility event is received.
+   */
+  void OnAccessibilityNotification( const WindowBase::AccessibilityInfo& info );
+
+private:
+
+  /**
+   * Convert touch event position
+   */
+  void ConvertTouchPosition( Integration::Point& point );
+
 private:
 
   // Undefined
@@ -177,6 +231,7 @@ private:
 
 private:
 
+  Dali::Integration::Scene mScene; ///< The scene the event handler is created for.
   CoreEventInterface& mCoreEventInterface; ///< Used to send events to Core.
   Dali::Integration::TouchEventCombiner mCombiner; ///< Combines multi-touch events.
   GestureManager& mGestureManager; ///< Reference to the GestureManager, set on construction, to send touch events to for analysis.
@@ -184,13 +239,13 @@ private:
   DamageObserver& mDamageObserver; ///< Reference to the DamageObserver, set on construction, to sent damage events to.
   RotationObserver* mRotationObserver; ///< Pointer to rotation observer, if present.
 
-  DragAndDropDetectorPtr mDragAndDropDetector; ///< Pointer to the drag & drop detector, to send Drag & Drop events to.
   Dali::AccessibilityAdaptor mAccessibilityAdaptor; ///< Pointer to the accessibility adaptor
   Dali::ClipboardEventNotifier mClipboardEventNotifier; ///< Pointer to the clipboard event notifier
   Dali::Clipboard mClipboard;///< Pointer to the clipboard
 
-  struct Impl; ///< Implementation
-  Impl* mImpl; ///< Created on construction and destroyed on destruction.
+  int mRotationAngle;
+  int mWindowWidth;
+  int mWindowHeight;
 
   bool mPaused; ///< The paused state of the adaptor.
 };