New Window constructor added.
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-impl.h
index a11b55d..0d4a4e1 100644 (file)
 #include <dali/public-api/object/base-object.h>
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/render-tasks/render-task-list.h>
-
-#ifdef DALI_ADAPTOR_COMPILATION
-#include <dali/integration-api/scene-holder-impl.h>
-#else
-#include <dali/integration-api/adaptors/scene-holder-impl.h>
-#endif
+#include <dali/public-api/object/property-array.h>
 
 // INTERNAL INCLUDES
-#include <dali/internal/adaptor/common/adaptor-impl.h>
 #include <dali/public-api/adaptor-framework/window.h>
 #include <dali/public-api/adaptor-framework/key-grab.h>
 #include <dali/devel-api/adaptor-framework/window-devel.h>
+#include <dali/integration-api/adaptor-framework/scene-holder-impl.h>
+#include <dali/internal/adaptor/common/adaptor-impl.h>
 #include <dali/internal/window-system/common/event-handler.h>
 
 namespace Dali
@@ -68,10 +64,11 @@ public:
   typedef Dali::Window::FocusChangeSignalType FocusChangeSignalType;
   typedef Dali::Window::ResizeSignalType ResizeSignalType;
   typedef Dali::DevelWindow::VisibilityChangedSignalType VisibilityChangedSignalType;
+  typedef Dali::DevelWindow::TransitionEffectEventSignalType TransitionEffectEventSignalType;
   typedef Signal< void () > SignalType;
 
   /**
-   * Create a new Window. This should only be called once by the Application class
+   * @brief Create a new Window. This should only be called once by the Application class
    * @param[in] positionSize The position and size of the window
    * @param[in] name The window title
    * @param[in] className The window class name
@@ -81,6 +78,17 @@ public:
   static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent = false);
 
   /**
+   * @brief Create a new Window. This should only be called once by the Application class
+   * @param[in] surface The surface used to render on.
+   * @param[in] positionSize The position and size of the window
+   * @param[in] name The window title
+   * @param[in] className The window class name
+   * @param[in] isTransparent Whether window is transparent
+   * @return A newly allocated Window
+   */
+  static Window* New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent = false);
+
+  /**
    * @copydoc Dali::Window::ShowIndicator()
    */
   void ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode );
@@ -147,16 +155,6 @@ public:
   void RemoveAvailableOrientation(Dali::Window::WindowOrientation orientation);
 
   /**
-   * @copydoc Dali::Window::SetAvailableOrientations()
-   */
-  void SetAvailableOrientations(const std::vector<Dali::Window::WindowOrientation>& orientations);
-
-  /**
-   * @copydoc Dali::Window::GetAvailableOrientations()
-   */
-  const std::vector<Dali::Window::WindowOrientation>& GetAvailableOrientations();
-
-  /**
    * @copydoc Dali::Window::SetPreferredOrientation()
    */
   void SetPreferredOrientation(Dali::Window::WindowOrientation orientation);
@@ -351,6 +349,16 @@ public:
    */
   Dali::Window GetParent();
 
+  /**
+   * @copydoc Dali::DevelWindow::GetCurrentOrientation()
+   */
+  Dali::Window::WindowOrientation GetCurrentOrientation() const;
+
+  /**
+   * @copydoc Dali::DevelWindow::SetAvailableOrientations()
+   */
+  void SetAvailableOrientations( const Dali::Vector<Dali::Window::WindowOrientation>& orientations );
+
 public: // Dali::Internal::Adaptor::SceneHolder
 
   /**
@@ -366,6 +374,18 @@ public: // Dali::Internal::Adaptor::SceneHolder
 private:
 
   /**
+   * @brief Enumeration for orietation mode.
+   * The Orientation Mode is related to screen size.
+   * If screen width is longer than height, the Orientation Mode will have LANDSCAPE.
+   * Otherwise screen width is shorter than height or same, the Orientation Mode will have PORTRAIT.
+   */
+  enum class OrientationMode
+  {
+    PORTRAIT = 0,
+    LANDSCAPE
+  };
+
+  /**
    * Private constructor.
    * @sa Window::New()
    */
@@ -379,7 +399,7 @@ private:
   /**
    * Second stage initialization
    */
-  void Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className);
+  void Initialize(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className);
 
   /**
    * Called when the window becomes iconified or deiconified.
@@ -401,6 +421,31 @@ private:
    */
   void OnDeleteRequest();
 
+  /**
+   * Called when the window receives a Transition effect-start/end event.
+   */
+  void OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type );
+
+  /**
+   * @brief Set available orientation to window base.
+   */
+  void SetAvailableAnlges( const std::vector< int >& angles );
+
+  /**
+   * @brief Convert from window orientation to angle using OrientationMode.
+   */
+  int ConvertToAngle( Dali::Window::WindowOrientation orientation );
+
+  /**
+   * @brief Convert from angle to window orientation using OrientationMode.
+   */
+  Dali::Window::WindowOrientation ConvertToOrientation( int angle ) const;
+
+  /**
+   * @brief Check available window orientation for Available orientation.
+   */
+  bool IsOrientationAvailable( Dali::Window::WindowOrientation orientation ) const;
+
 private: // Dali::Internal::Adaptor::SceneHolder
 
   /**
@@ -491,6 +536,11 @@ public: // Signals
    */
   Dali::DevelWindow::EventProcessingFinishedSignalType& EventProcessingFinishedSignal() { return mScene.EventProcessingFinishedSignal(); }
 
+  /**
+   * @copydoc Dali::DevelWindow::TransitionEffectEventSignal()
+   */
+  TransitionEffectEventSignalType& TransitionEffectEventSignal() { return mTransitionEffectEventSignal; }
+
 private:
 
   WindowRenderSurface*                  mWindowSurface;      ///< The window rendering surface
@@ -505,9 +555,9 @@ private:
   Dali::Window::Type                    mType;
   Dali::Window                          mParentWindow;
 
-  OrientationPtr                               mOrientation;
-  std::vector<Dali::Window::WindowOrientation> mAvailableOrientations;
-  Dali::Window::WindowOrientation              mPreferredOrientation;
+  OrientationPtr                        mOrientation;
+  std::vector< int >                    mAvailableAngles;
+  int                                   mPreferredAngle;
 
   int                                   mRotationAngle;     ///< The angle of the rotation
   int                                   mWindowWidth;       ///< The width of the window
@@ -515,6 +565,10 @@ private:
 
   EventHandlerPtr                       mEventHandler;      ///< The window events handler
 
+  OrientationMode                       mOrientationMode;
+
+  int                                   mNativeWindowId;          ///< The Native Window Id
+
   // Signals
   IndicatorSignalType                   mIndicatorVisibilityChangedSignal;
   FocusSignalType                       mFocusChangedSignal;
@@ -523,6 +577,7 @@ private:
   FocusChangeSignalType                 mFocusChangeSignal;
   ResizeSignalType                      mResizeSignal;
   VisibilityChangedSignalType           mVisibilityChangedSignal;
+  TransitionEffectEventSignalType       mTransitionEffectEventSignal;
 };
 
 } // namespace Adaptor