[4.0] Supports screen rotation.
[platform/core/uifw/dali-core.git] / dali / internal / event / common / stage-impl.h
old mode 100644 (file)
new mode 100755 (executable)
index 415f87b..35db048
@@ -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) 2017 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>
@@ -44,6 +45,7 @@ struct Vector2;
 namespace Integration
 {
 class SystemOverlay;
+class RenderController;
 }
 
 namespace Internal
@@ -75,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.
@@ -145,6 +150,14 @@ public:
   void SurfaceResized( float width, float height );
 
   /**
+   * Used to calculate the size and orientation of the stage and indirectly, the root actor.
+   * @param [in] width  The new surface width.
+   * @param [in] height The new surface height.
+   * @param [in] orientation The new surface orientation.
+   */
+  void SurfaceResized( float width, float height, int orientation );
+
+  /**
    * 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
@@ -307,6 +320,13 @@ public:
   void EmitKeyEventSignal(const KeyEvent& event);
 
   /**
+   * 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.
+   */
+  bool EmitKeyEventGeneratedSignal(const KeyEvent& event);
+
+  /**
    * Emits the event processing finished signal.
    *
    * @see Dali::Stage::SignalEventProcessingFinished()
@@ -372,6 +392,11 @@ public:
   Dali::Stage::SceneCreatedSignalType& SceneCreatedSignal();
 
   /**
+   * @copydoc Dali::DevelStage::KeyEventGeneratedSignal()
+   */
+  Dali::DevelStage::KeyEventGeneratedSignalType& KeyEventGeneratedSignal();
+
+  /**
    * 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,6 +437,11 @@ 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 );
@@ -421,6 +451,27 @@ public: // Implementation of EventThreadServices
    */
   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 +480,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,6 +499,8 @@ private:
 
   NotificationManager& mNotificationManager;
 
+  Integration::RenderController& mRenderController;
+
   // The stage-size may be less than surface-size (reduced by top-margin)
   Vector2 mSize;
   Vector2 mSurfaceSize;
@@ -482,6 +536,7 @@ private:
 
   // The key event signal
   Dali::Stage::KeyEventSignalType                 mKeyEventSignal;
+  Dali::DevelStage::KeyEventGeneratedSignalType   mKeyEventGeneratedSignal;
 
   // The event processing finished signal
   Dali::Stage::EventProcessingFinishedSignalType  mEventProcessingFinishedSignal;
@@ -497,6 +552,13 @@ private:
   Dali::Stage::ContextStatusSignal mContextRegainedSignal;
 
   Dali::Stage::SceneCreatedSignalType mSceneCreatedSignal;
+
+  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.
+
+  bool mNeedToRotation:1;
+  int mCurrentOrientation;
 };
 
 } // namespace Internal
@@ -523,4 +585,4 @@ inline const Internal::Stage& GetImplementation(const Dali::Stage& stage)
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_STAGE_H__
+#endif // DALI_INTERNAL_STAGE_H