Add Overlay Layer in scene
[platform/core/uifw/dali-core.git] / dali / internal / event / common / scene-impl.h
index 1346448..cda29a2 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SCENE_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -38,63 +38,9 @@ struct Event;
 
 namespace Internal
 {
-//@todo Break this dependence somehow.
-namespace Render
-{
-class Renderer;
-}
-
 namespace SceneGraph
 {
 class Scene;
-
-struct DirtyRect
-{
-  DirtyRect(Node* node, Render::Renderer* renderer, int frame, Rect<int>& rect)
-  : node(node),
-    renderer(renderer),
-    frame(frame),
-    rect(rect),
-    visited(true)
-  {
-  }
-
-  DirtyRect()
-  : node(nullptr),
-    renderer(nullptr),
-    frame(0),
-    rect(),
-    visited(true)
-  {
-  }
-
-  bool operator<(const DirtyRect& rhs) const
-  {
-    if(node == rhs.node)
-    {
-      if(renderer == rhs.renderer)
-      {
-        return frame > rhs.frame; // Most recent rects come first
-      }
-      else
-      {
-        return renderer < rhs.renderer;
-      }
-    }
-    else
-    {
-      return node < rhs.node;
-    }
-  }
-
-  Node*             node;
-  Render::Renderer* renderer;
-  int               frame;
-
-  Rect<int> rect;
-  bool      visited;
-};
-
 } // namespace SceneGraph
 
 class EventProcessor;
@@ -116,7 +62,7 @@ public:
   /**
    * @copydoc Dali::Integration::Scene::New
    */
-  static ScenePtr New(Size size, int orientation = 0);
+  static ScenePtr New(Size size, int32_t windowOrientation = 0, int32_t screenOrientation = 0);
 
   /**
    * virtual destructor
@@ -159,6 +105,11 @@ public:
   Dali::Layer GetRootLayer() const;
 
   /**
+   * @copydoc Dali::Integration::Scene::GetOverlayLayer
+   */
+  Dali::Layer GetOverlayLayer();
+
+  /**
    * @copydoc Dali::Integration::Scene::GetLayerCount
    */
   uint32_t GetLayerCount() const;
@@ -240,16 +191,35 @@ public:
    *
    * @param[in] width The width of rotated surface
    * @param[in] height The height of rotated surface
-   * @param[in] orientation The orientation of rotated surface
+   * @param[in] windowOrientation the current window orientation
+   * @param[in] screenOrientation the current screen orientation
    */
-  void SurfaceRotated(float width, float height, int orientation);
+  void SurfaceRotated(float width, float height, int32_t windowOrientation, int32_t screenOrientation);
 
   /**
-   * @brief Get surface's current orientation
-   *
-   * @return surface orientation
+   * @copydoc Dali::Integration::Scene::SetRotationCompletedAcknowledgement
+   */
+  void SetRotationCompletedAcknowledgement();
+
+  /**
+   * @copydoc Dali::Integration::Scene::IsRotationCompletedAcknowledgementSet
+   */
+  bool IsRotationCompletedAcknowledgementSet() const;
+
+  /**
+   * @copydoc Dali::Integration::Scene::GetCurrentSurfaceOrientation
+   */
+  int32_t GetCurrentSurfaceOrientation() const;
+
+  /**
+   * @copydoc Dali::Integration::Scene::GetCurrentScreenOrientation
+   */
+  int32_t GetCurrentScreenOrientation() const;
+
+  /**
+   * @copydoc Dali::Integration::Scene::GetCurrentSurfaceRect
    */
-  int GetSurfaceOrientation();
+  const Rect<int32_t>& GetCurrentSurfaceRect() const;
 
   /**
    * @copydoc Dali::Integration::Scene::IsSurfaceRectChanged
@@ -257,6 +227,11 @@ public:
   bool IsSurfaceRectChanged() const;
 
   /**
+   * @copydoc Dali::Integration::Scene::SetSurfaceRenderTarget
+   */
+  void SetSurfaceRenderTarget(const Graphics::RenderTargetCreateInfo& renderTargetCreateInfo);
+
+  /**
    * Used by the EventProcessor to emit key event signals.
    * @param[in] event The key event.
    */
@@ -270,6 +245,13 @@ public:
   bool EmitKeyEventGeneratedSignal(const Dali::KeyEvent& event);
 
   /**
+   * Used by the KeyEventProcessor to emit InterceptKeyEventSignal signals.
+   * @param[in] event The key event.
+   * @return The return is true if KeyEvent is consumed, otherwise false.
+   */
+  bool EmitInterceptKeyEventSignal(const Dali::KeyEvent& event);
+
+  /**
    * Emits the event processing finished signal.
    *
    * @see Dali::Scene::SignalEventProcessingFinished()
@@ -289,6 +271,13 @@ public:
   void EmitWheelEventSignal(const Dali::WheelEvent& event);
 
   /**
+   * Used by the WheelEventProcessor to emit WheelEventGenerated signals.
+   * @param[in] event The wheel event.
+   * @return The return is true if WheelEvent is consumed, otherwise false.
+   */
+  bool EmitWheelEventGeneratedSignal(const Dali::WheelEvent& event);
+
+  /**
    * @copydoc Dali::Integration::Scene::AddFrameRenderedCallback
    */
   void AddFrameRenderedCallback(std::unique_ptr<CallbackBase> callback, int32_t frameId);
@@ -319,6 +308,11 @@ public:
   Integration::Scene::KeyEventGeneratedSignalType& KeyEventGeneratedSignal();
 
   /**
+   * @copydoc Integration::Scene::InterceptKeyEventSignal()
+   */
+  Integration::Scene::KeyEventGeneratedSignalType& InterceptKeyEventSignal();
+
+  /**
    * @copydoc Integration::Scene::SignalEventProcessingFinished()
    */
   Integration::Scene::EventProcessingFinishedSignalType& EventProcessingFinishedSignal();
@@ -334,11 +328,9 @@ public:
   Integration::Scene::WheelEventSignalType& WheelEventSignal();
 
   /**
-   * @brief Get ItemsDirtyRects
-   *
-   * @return the ItemsDirtyRects
+   * @copydoc Integration::Scene::WheelEventGeneratedSignal()
    */
-  std::vector<Dali::Internal::SceneGraph::DirtyRect>& GetItemsDirtyRects();
+  Integration::Scene::WheelEventGeneratedSignalType& WheelEventGeneratedSignal();
 
 public:
   /**
@@ -351,7 +343,7 @@ public:
    * From RenderTaskDefaults; retrieve the default camera actor.
    * @return The default camera actor.
    */
-  CameraActor& GetDefaultCameraActor() override;
+  CameraActor& GetDefaultCameraActor() const override;
 
 private:
   // Constructor
@@ -361,9 +353,10 @@ private:
    * Second-phase constructor.
    *
    * @param[in] size The size of the set surface
-   * @param[in] orientation The orientation of the set surface for this scene
+   * @param[in] windowOrientation The rotated angle of the set surface for this scene
+   * @param[in] screenOrientation The rotated angle of the screen
    */
-  void Initialize(Size size, int orientation);
+  void Initialize(Size size, int32_t windowOrientation, int32_t screenOrientation);
 
   // Undefined
   Scene(const Scene&) = delete;
@@ -376,9 +369,10 @@ private:
    *
    * @param[in] width The width of rotated surface
    * @param[in] height The height of rotated surface
-   * @param[in] orientation The orientation of rotated surface
+   * @param[in] windowOrientation the current window orientation
+   * @param[in] screenOrientation the current screen orientation
    */
-  void ChangedSurface(float width, float height, int orientation);
+  void ChangedSurface(float width, float height, int32_t windowOrientation, int32_t screenOrientation);
 
 private:
   Internal::SceneGraph::Scene* mSceneObject;
@@ -391,6 +385,8 @@ private:
 
   LayerPtr mRootLayer;
 
+  LayerPtr mOverlayLayer;
+
   // Ordered list of currently on-stage layers
   OwnerPointer<LayerList> mLayerList;
 
@@ -404,11 +400,15 @@ private:
   EventProcessor mEventProcessor;
 
   // The Surface's orientation
-  int mSurfaceOrientation;
+  int32_t mSurfaceOrientation;
+
+  // The Screen's orientation
+  int32_t mScreenOrientation;
 
   // The key event signal
   Integration::Scene::KeyEventSignalType          mKeyEventSignal;
   Integration::Scene::KeyEventGeneratedSignalType mKeyEventGeneratedSignal;
+  Integration::Scene::KeyEventGeneratedSignalType mInterceptKeyEventSignal;
 
   // The event processing finished signal
   Integration::Scene::EventProcessingFinishedSignalType mEventProcessingFinishedSignal;
@@ -417,9 +417,8 @@ private:
   Integration::Scene::TouchEventSignalType mTouchedSignal;
 
   // The wheel event signal
-  Integration::Scene::WheelEventSignalType mWheelEventSignal;
-
-  std::vector<Dali::Internal::SceneGraph::DirtyRect> mItemsDirtyRects;
+  Integration::Scene::WheelEventSignalType          mWheelEventSignal;
+  Integration::Scene::WheelEventGeneratedSignalType mWheelEventGeneratedSignal;
 };
 
 } // namespace Internal