Add Window::SetLayout method
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / windows / window-base-win.h
old mode 100755 (executable)
new mode 100644 (file)
index f19fdfc..90c8d21
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_WINDOWSYSTEM_WINDOW_BASE_WIN_H
 
 /*
- * Copyright (c) 2018 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.
@@ -20,8 +20,8 @@
 
 // INTERNAL INCLUDES
 #include <dali/internal/window-system/common/window-base.h>
-#include <dali/internal/window-system/windows/platform-implement-win.h>
 #include <dali/internal/window-system/windows/event-system-win.h>
+#include <dali/internal/window-system/windows/platform-implement-win.h>
 
 namespace Dali
 {
@@ -29,7 +29,6 @@ namespace Internal
 {
 namespace Adaptor
 {
-
 class Window;
 class WindowRenderSurface;
 class WindowRenderSurfaceWin;
@@ -40,11 +39,10 @@ class WindowRenderSurfaceWin;
 class WindowBaseWin : public WindowBase
 {
 public:
-
   /**
    * @brief Constructor
    */
-  WindowBaseWin( PositionSize positionSize, Any surface, bool isTransparent );
+  WindowBaseWin(PositionSize positionSize, Any surface, bool isTransparent);
 
   /**
    * @brief Destructor
@@ -52,7 +50,6 @@ public:
   virtual ~WindowBaseWin();
 
 public:
-
   /**
    * Called when the window receives a delete request
    */
@@ -61,312 +58,413 @@ public:
   /**
    * @brief Called when the window gains focus.
    */
-  void OnFocusIn( int type, TWinEventInfo *event );
+  void OnFocusIn(int type, TWinEventInfo* event);
 
   /**
    * @brief Called when the window loses focus.
    */
-  void OnFocusOut( int type, TWinEventInfo *event );
+  void OnFocusOut(int type, TWinEventInfo* event);
 
   /**
    * @brief Called when the window is damaged.
    */
-  void OnWindowDamaged( int type, TWinEventInfo *event );
+  void OnWindowDamaged(int type, TWinEventInfo* event);
 
   /**
    * @brief Called when a touch down is received.
    */
-  void OnMouseButtonDown( int type, TWinEventInfo *event );
+  void OnMouseButtonDown(int type, TWinEventInfo* event);
 
   /**
    * @brief Called when a touch up is received.
    */
-  void OnMouseButtonUp( int type, TWinEventInfo *event );
+  void OnMouseButtonUp(int type, TWinEventInfo* event);
 
   /**
    * @brief Called when a touch motion is received.
    */
-  void OnMouseButtonMove( int type, TWinEventInfo *event );
+  void OnMouseButtonMove(int type, TWinEventInfo* event);
 
   /**
    * @brief Called when a mouse wheel is received.
    */
-  void OnMouseWheel( int type, TWinEventInfo *event );
+  void OnMouseWheel(int type, TWinEventInfo* event);
 
   /**
    * @brief Called when a key down is received.
    */
-  void OnKeyDown( int type, TWinEventInfo *event );
+  void OnKeyDown(int type, TWinEventInfo* event);
 
   /**
    * @brief Called when a key up is received.
    */
-  void OnKeyUp( int type, TWinEventInfo *event );
-
+  void OnKeyUp(int type, TWinEventInfo* event);
 
 public:
-
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindow()
    */
-  virtual Any GetNativeWindow() override;
+  Any GetNativeWindow() override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowId()
    */
-  virtual int GetNativeWindowId() override;
+  int GetNativeWindowId() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetNativeWindowResourceId()
+   */
+  std::string GetNativeWindowResourceId() override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::CreateEglWindow()
    */
-  virtual EGLNativeWindowType CreateEglWindow( int width, int height ) override;
+  EGLNativeWindowType CreateEglWindow(int width, int height) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::DestroyEglWindow()
    */
-  virtual void DestroyEglWindow() override;
+  void DestroyEglWindow() override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowRotation()
    */
-  virtual void SetEglWindowRotation( int angle ) override;
+  void SetEglWindowRotation(int angle) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowBufferTransform()
    */
-  virtual void SetEglWindowBufferTransform( int angle ) override;
+  void SetEglWindowBufferTransform(int angle) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetEglWindowTransform()
    */
-  virtual void SetEglWindowTransform( int angle ) override;
+  void SetEglWindowTransform(int angle) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::ResizeEglWindow()
    */
-  virtual void ResizeEglWindow( PositionSize positionSize ) override;
+  void ResizeEglWindow(PositionSize positionSize) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::IsEglWindowRotationSupported()
    */
-  virtual bool IsEglWindowRotationSupported() override;
+  bool IsEglWindowRotationSupported() override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::Move()
    */
-  virtual void Move( PositionSize positionSize ) override;
+  void Move(PositionSize positionSize) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::Resize()
    */
-  virtual void Resize( PositionSize positionSize ) override;
+  void Resize(PositionSize positionSize) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::MoveResize()
    */
-  virtual void MoveResize( PositionSize positionSize ) override;
+  void MoveResize(PositionSize positionSize) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetLayout()
+   */
+  void SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetClass()
    */
-  virtual void SetClass( const std::string& name, const std::string& className ) override;
+  void SetClass(const std::string& name, const std::string& className) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::Raise()
    */
-  virtual void Raise() override;
+  void Raise() override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::Lower()
    */
-  virtual void Lower() override;
+  void Lower() override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::Activate()
    */
-  virtual void Activate() override;
+  void Activate() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Maximize()
+   */
+  void Maximize(bool maximize) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IsMaximized()
+   */
+  bool IsMaximized() const override;
 
   /**
-   * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableOrientations()
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetMaximumSize()
    */
-  virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) override;
+  void SetMaximumSize(Dali::Window::WindowSize size) override;
 
   /**
-   * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredOrientation()
+   * @copydoc Dali::Internal::Adaptor::WindowBase::Minimize()
    */
-  virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) override;
+  void Minimize(bool minimize) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IsMinimized()
+   */
+  bool IsMinimized() const override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetMimimumSize()
+   */
+  void SetMimimumSize(Dali::Window::WindowSize size) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
+   */
+  void SetAvailableAnlges(const std::vector<int>& angles) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
+   */
+  void SetPreferredAngle(int angle) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
    */
-  virtual void SetAcceptFocus( bool accept ) override;
+  void SetAcceptFocus(bool accept) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::Show()
    */
-  virtual void Show() override;
+  void Show() override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::Hide()
    */
-  virtual void Hide() override;
+  void Hide() override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHintCount()
    */
-  virtual unsigned int GetSupportedAuxiliaryHintCount() const override;
+  unsigned int GetSupportedAuxiliaryHintCount() const override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GetSupportedAuxiliaryHint()
    */
-  virtual std::string GetSupportedAuxiliaryHint( unsigned int index ) const override;
+  std::string GetSupportedAuxiliaryHint(unsigned int index) const override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::AddAuxiliaryHint()
    */
-  virtual unsigned int AddAuxiliaryHint( const std::string& hint, const std::string& value ) override;
+  unsigned int AddAuxiliaryHint(const std::string& hint, const std::string& value) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::RemoveAuxiliaryHint()
    */
-  virtual bool RemoveAuxiliaryHint( unsigned int id ) override;
+  bool RemoveAuxiliaryHint(unsigned int id) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetAuxiliaryHintValue()
    */
-  virtual bool SetAuxiliaryHintValue( unsigned int id, const std::string& value ) override;
+  bool SetAuxiliaryHintValue(unsigned int id, const std::string& value) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintValue()
    */
-  virtual std::string GetAuxiliaryHintValue( unsigned int id ) const override;
+  std::string GetAuxiliaryHintValue(unsigned int id) const override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GetAuxiliaryHintId()
    */
-  virtual unsigned int GetAuxiliaryHintId( const std::string& hint ) const override;
+  unsigned int GetAuxiliaryHintId(const std::string& hint) const override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetInputRegion()
    */
-  virtual void SetInputRegion( const Rect< int >& inputRegion ) override;
+  void SetInputRegion(const Rect<int>& inputRegion) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetType()
    */
-  virtual void SetType( Dali::Window::Type type ) override;
+  void SetType(Dali::WindowType type) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetType()
+   */
+  Dali::WindowType GetType() const override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetNotificationLevel()
    */
-  virtual bool SetNotificationLevel( Dali::Window::NotificationLevel::Type level ) override;
+  Dali::WindowOperationResult SetNotificationLevel(Dali::WindowNotificationLevel level) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GetNotificationLevel()
    */
-  virtual Dali::Window::NotificationLevel::Type GetNotificationLevel() const override;
+  Dali::WindowNotificationLevel GetNotificationLevel() const override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetOpaqueState()
    */
-  virtual void SetOpaqueState( bool opaque ) override;
+  void SetOpaqueState(bool opaque) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetScreenOffMode()
    */
-  virtual bool SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode) override;
+  Dali::WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenOffMode()
    */
-  virtual Dali::Window::ScreenOffMode::Type GetScreenOffMode() const override;
+  WindowScreenOffMode GetScreenOffMode() const override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetBrightness()
    */
-  virtual bool SetBrightness( int brightness ) override;
+  Dali::WindowOperationResult SetBrightness(int brightness) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GetBrightness()
    */
-  virtual int GetBrightness() const override;
+  int GetBrightness() const override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKey()
    */
-  virtual bool GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode ) override;
+  bool GrabKey(Dali::KEY key, KeyGrab::KeyGrabMode grabMode) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKey()
    */
-  virtual bool UngrabKey( Dali::KEY key ) override;
+  bool UngrabKey(Dali::KEY key) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GrabKeyList()
    */
-  virtual bool GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result ) override;
+  bool GrabKeyList(const Dali::Vector<Dali::KEY>& key, const Dali::Vector<KeyGrab::KeyGrabMode>& grabMode, Dali::Vector<bool>& result) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::UngrabKeyList()
    */
-  virtual bool UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result ) override;
+  bool UngrabKeyList(const Dali::Vector<Dali::KEY>& key, Dali::Vector<bool>& result) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GetDpi()
    */
-  virtual void GetDpi( unsigned int& dpiHorizontal, unsigned int& dpiVertical ) override;
+  void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::GetScreenRotationAngle()
    */
-  virtual int GetScreenRotationAngle() override;
+  int GetScreenRotationAngle() override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetWindowRotationAngle()
    */
-  virtual void SetWindowRotationAngle( int degree ) override;
+  void SetWindowRotationAngle(int degree) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::WindowRotationCompleted()
    */
-  virtual void WindowRotationCompleted( int degree, int width, int height ) override;
+  void WindowRotationCompleted(int degree, int width, int height) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetTransparency()
    */
-  virtual void SetTransparency( bool transparent ) override;
+  void SetTransparency(bool transparent) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::GetWindowRotationAngle()
+   */
+  int GetWindowRotationAngle() const override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::WindowBase::SetParent()
    */
-  virtual void SetParent( Any parent ) override;
+  void SetParent(WindowBase* parentWinBase, bool belowParent) override;
 
   /**
-   * @copydoc Dali::Internal::Adaptor::WindowBase::IsMatchedWindow()
+   * @copydoc  Dali::Internal::Adaptor::WindowBase::CreateFrameRenderedSyncFence()
    */
-  virtual bool IsMatchedWindow( Any window ) override;
+  int CreateFrameRenderedSyncFence() override;
 
-private:
+  /**
+   * @copydoc  Dali::Internal::Adaptor::WindowBase::CreateFramePresentedSyncFence()
+   */
+  int CreateFramePresentedSyncFence() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::SetPositionSizeWithAngle()
+   */
+  void SetPositionSizeWithAngle(PositionSize positionSize, int angle) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::InitializeIme()
+   */
+  void InitializeIme() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::ImeWindowReadyToRender()
+   */
+  void ImeWindowReadyToRender() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::RequestMoveToServer()
+   */
+  void RequestMoveToServer() override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::RequestResizeToServer()
+   */
+  void RequestResizeToServer(WindowResizeDirection direction) override;
 
   /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::EnableFloatingMode()
+   */
+  void EnableFloatingMode(bool enable) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IsFloatingModeEnabled()
+   */
+  bool IsFloatingModeEnabled() const override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::IncludeInputRegion()
+   */
+  void IncludeInputRegion(const Rect<int>& inputRegion) override;
+
+  /**
+   * @copydoc Dali::Internal::Adaptor::WindowBase::ExcludeInputRegion()
+   */
+  void ExcludeInputRegion(const Rect<int>& inputRegion) override;
+
+private:
+  /**
    * Second stage initialization
    */
-  void Initialize( PositionSize positionSize, Any surface, bool isTransparent );
+  void Initialize(PositionSize positionSize, Any surface, bool isTransparent);
 
   /**
    * @brief Get the surface id if the surface parameter is not empty
    * @param surface Any containing a surface id, or can be empty
    * @return surface id, or zero if surface is empty
    */
-  unsigned int GetSurfaceId( Any surface ) const;
+  uintptr_t GetSurfaceId(Any surface) const;
 
   /**
    * @brief Create window
    */
-  void CreateWinWindow( PositionSize positionSize, bool isTransparent );
+  void CreateWinWindow(PositionSize positionSize, bool isTransparent);
 
-private:
+  /**
+   * @brief Sets up an already created window.
+   */
+  void SetWinWindow(uintptr_t surfaceId);
 
+private:
   // Undefined
   WindowBaseWin(const WindowBaseWin&) = delete;
 
@@ -374,18 +472,20 @@ private:
   WindowBaseWin& operator=(const WindowBaseWin& rhs) = delete;
 
 private:
-  void EventEntry( TWinEventInfo *event );
+  void EventEntry(TWinEventInfo* event);
 
 private:
-  WinWindowHandle                      mWin32Window;        ///< Native window handle
-  bool                                 mOwnSurface:1;       ///< Whether we own the surface (responsible for deleting it)
-  bool                                 mIsTransparent:1;    ///< Whether the window is transparent (32 bit or 24 bit)
-  bool                                 mRotationAppSet:1;
+  WinWindowHandle mWin32Window;       ///< Native window handle
+  bool            mOwnSurface : 1;    ///< Whether we own the surface (responsible for deleting it)
+  bool            mIsTransparent : 1; ///< Whether the window is transparent (32 bit or 24 bit)
+  bool            mRotationAppSet : 1;
+
+  WindowsPlatform::WindowImpl mWindowImpl;
 };
 
 } // namespace Adaptor
 
-} // namespace internal
+} // namespace Internal
 
 } // namespace Dali