[Tizen] Revert "Remove StereoMode"
[platform/core/uifw/dali-core.git] / dali / internal / event / common / stage-impl.h
index 1c07cb8..a6aa52e 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_STAGE_H__
-#define __DALI_INTERNAL_STAGE_H__
+#ifndef DALI_INTERNAL_STAGE_H
+#define DALI_INTERNAL_STAGE_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.
@@ -21,6 +21,7 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/object/ref-object.h>
 #include <dali/public-api/common/stage.h>
+#include <dali/devel-api/common/stage-devel.h>
 #include <dali/public-api/object/base-object.h>
 #include <dali/integration-api/context-notifier.h>
 #include <dali/internal/common/owner-pointer.h>
 #include <dali/public-api/math/vector4.h>
 #include <dali/public-api/render-tasks/render-task.h>
 
-#ifdef DYNAMICS_SUPPORT
-#include <dali/internal/event/dynamics/dynamics-declarations.h>
-#include <dali/internal/event/dynamics/dynamics-notifier.h>
-#endif
-
 namespace Dali
 {
 
@@ -49,7 +45,7 @@ struct Vector2;
 namespace Integration
 {
 class SystemOverlay;
-class DynamicsFactory;
+class RenderController;
 }
 
 namespace Internal
@@ -81,16 +77,19 @@ public:
    * @param[in] propertyNotificationManager
    * @param[in] updateManager
    * @param[in] notificationManager
+   * @param[in] renderController
    */
   static StagePtr New( AnimationPlaylist& playlist,
                        PropertyNotificationManager& propertyNotificationManager,
                        SceneGraph::UpdateManager& updateManager,
-                       NotificationManager& notificationManager );
+                       NotificationManager& notificationManager,
+                       Integration::RenderController& renderController );
 
   /**
    * Initialize the stage.
+   * @param[in] renderToFbo Whether to render into a Frame Buffer Object.
    */
-  void Initialize();
+  void Initialize( bool renderToFbo );
 
   /**
    * Uninitialize the stage.
@@ -144,11 +143,20 @@ public:
   void Remove( Actor& actor );
 
   /**
-   * Sets the size of the stage and indirectly, the root actor.
-   * @param [in] width  The new width.
-   * @param [in] height The new height.
+   * Used to calculate the size of the stage and indirectly, the root actor.
+   * @param [in] width  The new surface width.
+   * @param [in] height The new surface height.
    */
-  void SetSize( float width, float height );
+  void SurfaceResized( float width, float height );
+
+  /**
+   * Sets the top margin size.
+   * Available stage size is reduced by this size.
+   * The stage is located below the size at the top of the display
+   * initial size is zero before it is assigned
+   * @param[in] margin margin size
+   */
+  void SetTopMargin( uint32_t margin );
 
   /**
    * Returns the size of the Stage in pixels as a Vector.
@@ -169,6 +177,11 @@ public:
   void CreateDefaultCameraActor();
 
   /**
+   * Set position of default camera for current stage size
+   */
+  void SetDefaultCameraPosition();
+
+  /**
    * From RenderTaskDefaults; retrieve the default root actor.
    * @return The default root actor.
    */
@@ -185,12 +198,12 @@ public:
   /**
    * @copydoc Dali::Stage::GetLayerCount()
    */
-  unsigned int GetLayerCount() const;
+  uint32_t GetLayerCount() const;
 
   /**
    * @copydoc Dali::Stage::GetLayer()
    */
-  Dali::Layer GetLayer( unsigned int depth ) const;
+  Dali::Layer GetLayer( uint32_t depth ) const;
 
   /**
    * @copydoc Dali::Stage::GetRootLayer()
@@ -282,46 +295,38 @@ public:
    */
   void SetDpi( Vector2 dpi );
 
-#ifdef DYNAMICS_SUPPORT
+  NotificationManager& GetNotificationManager()
+  {
+    return mNotificationManager;
+  }
 
   /**
-   * Return the Dynamics Simulation Notifier object
-   * @return The Dynamics Simulation Notifier object
+   * @copydoc Dali::Stage::KeepRendering()
    */
-  DynamicsNotifier& GetDynamicsNotifier();
+  void KeepRendering( float durationSeconds );
 
   /**
-   * @copydoc Dali::Stage::InitializeDynamics
+   * @copydoc Dali::DevelStage::SetRenderingBehavior()
    */
-  DynamicsWorldPtr InitializeDynamics(DynamicsWorldConfigPtr config);
+  void SetRenderingBehavior( DevelStage::Rendering renderingBehavior );
 
   /**
-   * @copydoc Dali::Stage::GetDynamicsWorld
+   * @copydoc Dali::DevelStage::GetRenderingBehavior()
    */
-  DynamicsWorldPtr GetDynamicsWorld();
+  DevelStage::Rendering GetRenderingBehavior() const;
 
   /**
-   * @copydoc Dali::Stage::TerminateDynamics
-   */
-  void TerminateDynamics();
-
-#endif // DYNAMICS_SUPPORT
-
-  NotificationManager& GetNotificationManager()
-  {
-    return mNotificationManager;
-  }
-
-  /**
-   * @copydoc Dali::Stage::KeepRendering()
+   * Used by the EventProcessor to emit key event signals.
+   * @param[in] event The key event.
    */
-  void KeepRendering( float durationSeconds );
+  void EmitKeyEventSignal(const KeyEvent& event);
 
   /**
-   * Used by the EventProcessor to emit key event signals.
+   * Used by the KeyEventProcessor to emit KeyEventGenerated signals.
    * @param[in] event The key event.
+   * @return The return is true if KeyEvent is consumed, otherwise false.
    */
-  void EmitKeyEventSignal(const KeyEvent& event);
+  bool EmitKeyEventGeneratedSignal(const KeyEvent& event);
 
   /**
    * Emits the event processing finished signal.
@@ -332,9 +337,16 @@ public:
 
   /**
    * Emits the touched signal.
+   * @param[in] touchEvent The touch event details (Old API).
    * @param[in] touch The touch event details.
    */
-  void EmitTouchedSignal( const TouchEvent& touch );
+  void EmitTouchedSignal( const TouchEvent& touchEvent, const Dali::TouchData& touch );
+
+  /**
+   * Used by the EventProcessor to emit wheel event signals.
+   * @param[in] event The wheel event.
+   */
+  void EmitWheelEventSignal( const WheelEvent& event );
 
   /**
    * Emits the scene created.
@@ -357,6 +369,16 @@ public:
   Dali::Stage::TouchedSignalType& TouchedSignal();
 
   /**
+    * @copydoc Dali::Stage::TouchSignal()
+    */
+  Dali::Stage::TouchSignalType& TouchSignal();
+
+  /**
+   * @copydoc Dali::Stage::WheelEventSignal()
+   */
+  Dali::Stage::WheelEventSignalType& WheelEventSignal();
+
+  /**
    * @copydoc Dali::Stage::ContextLostSignal()
    */
   Dali::Stage::ContextStatusSignal& ContextLostSignal();
@@ -372,6 +394,21 @@ public:
   Dali::Stage::SceneCreatedSignalType& SceneCreatedSignal();
 
   /**
+   * @copydoc Dali::DevelStage::KeyEventGeneratedSignal()
+   */
+  Dali::DevelStage::KeyEventGeneratedSignalType& KeyEventGeneratedSignal();
+
+  /**
+   * @copydoc Dali::DevelStage::AddFrameCallback()
+   */
+  void AddFrameCallback( FrameCallbackInterface& frameCallback, Actor& rootActor );
+
+  /**
+   * @copydoc Dali::DevelStage::RemoveFrameCallback()
+   */
+  void RemoveFrameCallback( FrameCallbackInterface& frameCallback );
+
+  /**
    * Connects a callback function with the object's signals.
    * @param[in] object The object providing the signal.
    * @param[in] tracker Used to disconnect the signal.
@@ -412,15 +449,41 @@ public: // Implementation of EventThreadServices
   virtual SceneGraph::UpdateManager& GetUpdateManager();
 
   /**
+   * @copydoc EventThreadServices::GetRenderController
+   */
+  virtual Integration::RenderController& GetRenderController();
+
+  /**
    * @copydoc EventThreadServices::ReserveMessageSlot
    */
-  virtual unsigned int* ReserveMessageSlot( std::size_t size, bool updateScene );
+  virtual uint32_t* ReserveMessageSlot( uint32_t size, bool updateScene );
 
   /**
    * @copydoc EventThreadServices::GetEventBufferIndex
    */
   virtual BufferIndex GetEventBufferIndex() const;
 
+  /**
+   * @copydoc EventThreadServices::ForceNextUpdate
+   */
+  virtual void ForceNextUpdate();
+
+  /**
+   * @copydoc EventThreadServices::IsNextUpdateForced
+   */
+  virtual bool IsNextUpdateForced();
+
+  /**
+   * Request that the depth tree is rebuilt
+   */
+  void RequestRebuildDepthTree();
+
+  /**
+   * Rebuilds the depth tree at the end of the event frame if
+   * it was requested this frame.
+   */
+  void RebuildDepthTree();
+
 private:
 
   /**
@@ -429,7 +492,8 @@ private:
   Stage( AnimationPlaylist& playlist,
          PropertyNotificationManager& propertyNotificationManager,
          SceneGraph::UpdateManager& updateManager,
-         NotificationManager& notificationManager );
+         NotificationManager& notificationManager,
+         Integration::RenderController& renderController );
 
   /**
    * A reference counted object may only be deleted by calling Unreference()
@@ -447,8 +511,11 @@ private:
 
   NotificationManager& mNotificationManager;
 
-  // The Actual size of the stage.
+  Integration::RenderController& mRenderController;
+
+  // The stage-size may be less than surface-size (reduced by top-margin)
   Vector2 mSize;
+  Vector2 mSurfaceSize;
 
   // Cached for public GetBackgroundColor()
   Vector4 mBackgroundColor;
@@ -463,21 +530,12 @@ private:
   ViewMode mViewMode;
   float mStereoBase;
 
+  uint32_t mTopMargin;
   Vector2 mDpi;
 
   // The object registry
   ObjectRegistryPtr mObjectRegistry;
 
-#ifdef DYNAMICS_SUPPORT
-
-  DynamicsNotifier mDynamicsNotifier;
-
-  // The Dynamics simulation world object
-  Integration::DynamicsFactory* mDynamicsFactory;   // Not owned pointer to DynamicsFactory (PlatformAbstraction will clean up)
-  DynamicsWorldPtr mDynamicsWorld;
-
-#endif // DYNAMICS_SUPPORT
-
   // The list of render-tasks
   IntrusivePtr<RenderTaskList> mRenderTaskList;
 
@@ -490,17 +548,28 @@ private:
 
   // The key event signal
   Dali::Stage::KeyEventSignalType                 mKeyEventSignal;
+  Dali::DevelStage::KeyEventGeneratedSignalType   mKeyEventGeneratedSignal;
 
   // The event processing finished signal
   Dali::Stage::EventProcessingFinishedSignalType  mEventProcessingFinishedSignal;
 
-  // The touched signal
+  // The touched signals
   Dali::Stage::TouchedSignalType                  mTouchedSignal;
+  Dali::Stage::TouchSignalType                    mTouchSignal;
+
+  // The wheel event signal
+  Dali::Stage::WheelEventSignalType               mWheelEventSignal;
 
   Dali::Stage::ContextStatusSignal mContextLostSignal;
   Dali::Stage::ContextStatusSignal mContextRegainedSignal;
 
   Dali::Stage::SceneCreatedSignalType mSceneCreatedSignal;
+
+  DevelStage::Rendering mRenderingBehavior; ///< The rendering behavior
+
+  bool mDepthTreeDirty:1;  ///< True if the depth tree needs recalculating
+  bool mForceNextUpdate:1; ///< True if the next rendering is really required.
+  bool mRenderToFbo:1;     ///< Whether to render to a Frame Buffer Object.
 };
 
 } // namespace Internal
@@ -527,4 +596,4 @@ inline const Internal::Stage& GetImplementation(const Dali::Stage& stage)
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_STAGE_H__
+#endif // DALI_INTERNAL_STAGE_H