[3.0] Replaced deprecated touch api in indicator
[platform/core/uifw/dali-adaptor.git] / adaptors / ecore / common / ecore-indicator-impl.h
index 801c12e..544e92b 100644 (file)
  */
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/actors/image-actor.h>
 #include <dali/public-api/animation/animation.h>
 #include <dali/public-api/events/pan-gesture.h>
 #include <dali/public-api/events/pan-gesture-detector.h>
 #include <dali/public-api/rendering/renderer.h>
+#include <dali/public-api/images/image.h>
+#include <dali/public-api/object/any.h>
 
 // INTERNAL INCLUDES
 #include <base/interfaces/indicator-interface.h>
+#include <native-image-source.h>
 #include <indicator-buffer.h>
 #include <ecore-server-connection.h>
 #include <shared-file.h>
@@ -62,6 +64,16 @@ public:
     CONNECTED
   };
 
+  /**
+   * copied from ecore_evas_extn_engine.h
+   */
+  enum BufferType
+  {
+    BUFFER_TYPE_SHM = 0,        ///< shared memory-based buffer backend
+    BUFFER_TYPE_DRI2_PIXMAP,    ///< dri2 pixmap-based buffer backend
+    BUFFER_TYPE_EVASGL_PIXMAP,  ///< pixmap backend for Evas GL only (DEPRECATED)
+    BUFFER_TYPE_GL_PIXMAP,      ///< double buffered GL pixmap backend
+  };
 
 protected:
   /**
@@ -184,6 +196,12 @@ public:  // Dali::Internal::Adaptor::IndicicatorInterface
    */
   virtual bool SendMessage( int messageDomain, int messageId, const void *data, int size );
 
+  /**
+   * Update native indicator image
+   * @param[in] source Native indicator image source
+   */
+  void UpdateIndicatorImage( Dali::Any source );
+
 private:
   /**
    * Initialize the indicator actors
@@ -202,13 +220,19 @@ private:
   void SetForegroundImage( Dali::Texture texture );
 
   /**
+   * Set the texture to be rendered as indicator foreground
+   * @param[in] image The foreground image.
+   */
+  void SetForegroundNativeImage( Dali::Image image );
+
+  /**
    * Touch event callback.
-   * It should pass the valid touch event to indicator server
+   * It should pass the valid touch data to indicator server
    *
    * @param[in] indicator  The indicator actor that was touched
-   * @param[in] touchEvent The touch event
+   * @param[in] touchData The touch data
    */
-  bool OnTouched(Dali::Actor indicator, const TouchEvent& touchEvent);
+  bool OnTouched(Dali::Actor indicator, const TouchData& touchData);
 
   /**
    * Pan gesture callback.
@@ -223,9 +247,9 @@ private:
    * Touch event callback on stage.
    * If stage is touched, hide showing indicator image
    *
-   * @param[in] touchEvent The touch event
+   * @param[in] touchEvent The touch data
    */
-  void OnStageTouched(const Dali::TouchEvent& touchEvent);
+  void OnStageTouched(const Dali::TouchData& touchData);
 
   /**
    * Connect to the indicator service
@@ -280,6 +304,22 @@ private:
   void LoadPixmapImage( Ecore_Ipc_Event_Server_Data *epcEvent );
 
   /**
+   * Update top margin of the stage as much as indicator height
+   */
+  void UpdateTopMargin();
+
+  /**
+   * Setup native indicator image
+   * @param[in] epcEvent The event containing the image data information
+   */
+  void SetupNativeIndicatorImage( Ecore_Ipc_Event_Server_Data *epcEvent );
+
+  /**
+   * Update the visibility and position of the actors
+   */
+  void UpdateVisibility();
+
+  /**
    * Inform dali that the indicator data has been updated.
    * @param[in] bufferNumber The shared file number
    */
@@ -336,6 +376,11 @@ private:
    */
   void OnAnimationFinished( Dali::Animation& animation );
 
+  /**
+   * Set up native indicator image
+   */
+  void SetupNativeIndicatorImage();
+
 private: // Implementation of ServerConnection::Observer
   /**
    * @copydoc Dali::Internal::Adaptor::ServerConnection::Observer::DataReceived()
@@ -390,6 +435,7 @@ private:
 
   IndicatorBufferPtr               mIndicatorBuffer;     ///< class which handles indicator rendering
   PixmapId                         mPixmap;              ///< Pixmap including indicator content
+  Dali::NativeImageSourcePtr       mNativeImageSource;
   Dali::Renderer                   mForegroundRenderer;  ///< Renderer renders the indicator foreground
   Dali::Renderer                   mBackgroundRenderer;  ///< Renderer renders the indicator background
 
@@ -424,7 +470,13 @@ private:
   int                              mCurrentSharedFile;   ///< Current shared file number
   SharedFileInfo                   mSharedFileInfo[SHARED_FILE_NUMBER];    ///< Table to store shared file info
 
+  BufferType                       mSharedBufferType;    ///< Shared buffer type which is used to render indicator
+
+  struct Impl; ///< Contains Ecore specific information
+  Impl* mImpl; ///< Created on construction and destroyed on destruction.
+
   bool                             mBackgroundVisible;   ///< Indicate whether background is visible
+  int                              mTopMargin;   ///< Top margin of the stage for indicator
 };
 
 } // Adaptor