[Tizen] Add to get the status whether window is rotating or not
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-impl.h
index 7b20b58..12d1c7f 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_WINDOWSYSTEM_COMMON_WINDOW_IMPL_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.
@@ -64,6 +64,8 @@ public:
   typedef Dali::DevelWindow::VisibilityChangedSignalType             VisibilityChangedSignalType;
   typedef Dali::DevelWindow::TransitionEffectEventSignalType         TransitionEffectEventSignalType;
   typedef Dali::DevelWindow::KeyboardRepeatSettingsChangedSignalType KeyboardRepeatSettingsChangedSignalType;
+  typedef Dali::DevelWindow::AuxiliaryMessageSignalType              AuxiliaryMessageSignalType;
+  typedef Dali::DevelWindow::AccessibilityHighlightSignalType        AccessibilityHighlightSignalType;
   typedef Signal<void()>                                             SignalType;
 
   /**
@@ -71,10 +73,11 @@ public:
    * @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] type Window type.
    * @param[in] isTransparent Whether window is transparent
    * @return A newly allocated Window
    */
-  static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent = false);
+  static Window* New(const PositionSize& positionSize, const std::string& name, const std::string& className, Dali::WindowType type, bool isTransparent = false);
 
   /**
    * @brief Create a new Window. This should only be called once by the Application class
@@ -82,10 +85,11 @@ public:
    * @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] type Window type.
    * @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);
+  static Window* New(Any surface, const PositionSize& positionSize, const std::string& name, const std::string& className,  Dali::WindowType type, bool isTransparent = false);
 
   /**
    * @copydoc Dali::Window::SetClass()
@@ -114,6 +118,26 @@ public:
   void Activate();
 
   /**
+   * @copydoc Dali::DevelWindow::Maximize()
+   */
+  void Maximize(bool maximize);
+
+  /**
+   * @copydoc Dali::DevelWindow::IsMaximized()
+   */
+  bool IsMaximized() const;
+
+  /**
+   * @copydoc Dali::DevelWindow::Minimize()
+   */
+  void Minimize(bool minimize);
+
+  /**
+   * @copydoc Dali::DevelWindow::IsMinimized()
+   */
+  bool IsMinimized() const;
+
+  /**
    * @copydoc Dali::Window::GetLayerCount()
    */
   uint32_t GetLayerCount() const;
@@ -129,6 +153,12 @@ public:
   Dali::RenderTaskList GetRenderTaskList() const;
 
   /**
+   * @brief Get window resource ID assigned by window manager
+   * @return The resource ID of the window
+   */
+  std::string GetNativeResourceId() const;
+
+  /**
    * @copydoc Dali::Window::AddAvailableOrientation()
    */
   void AddAvailableOrientation(WindowOrientation orientation);
@@ -221,7 +251,7 @@ public:
   /**
    * @copydoc Dali::Window::SetNotificationLevel()
    */
-  bool SetNotificationLevel(WindowNotificationLevel level);
+  WindowOperationResult SetNotificationLevel(WindowNotificationLevel level);
 
   /**
    * @copydoc Dali::Window::GetNotificationLevel()
@@ -241,7 +271,7 @@ public:
   /**
    * @copydoc Dali::Window::SetScreenOffMode()
    */
-  bool SetScreenOffMode(WindowScreenOffMode screenOffMode);
+  WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode);
 
   /**
    * @copydoc Dali::Window::GetScreenOffMode()
@@ -251,7 +281,7 @@ public:
   /**
    * @copydoc Dali::Window::SetBrightness()
    */
-  bool SetBrightness(int brightness);
+  WindowOperationResult SetBrightness(int brightness);
 
   /**
    * @copydoc Dali::Window::GetBrightness()
@@ -324,11 +354,16 @@ public:
   static Dali::Window Get(Dali::Actor actor);
 
   /**
-   * @copydoc Dali::DevelWindow::SetParent()
+   * @copydoc Dali::DevelWindow::SetParent(Window window, Window parent)
    */
   void SetParent(Dali::Window& parent);
 
   /**
+   * @copydoc Dali::DevelWindow::SetParent(Window window, Window parent, bool belowParent)
+   */
+  void SetParent(Dali::Window& parent, bool belowParent);
+
+  /**
    * @copydoc Dali::DevelWindow::Unparent()
    */
   void Unparent();
@@ -353,6 +388,21 @@ public:
    */
   void SetAvailableOrientations(const Dali::Vector<WindowOrientation>& orientations);
 
+  /**
+   * @copydoc Dali::DevelWindow::SetPositionSizeWithOrientation()
+   */
+  void SetPositionSizeWithOrientation(PositionSize positionSize, WindowOrientation orientation);
+
+  /**
+   * @brief Emit the accessibility highlight signal.
+   * The highlight indicates that it is an object to interact with the user regardless of focus.
+   * After setting the highlight on the object, you can do things that the object can do, such as
+   * giving or losing focus.
+   *
+   * @param[in] highlight If window needs to grab or clear highlight.
+   */
+  void EmitAccessibilityHighlightSignal(bool highlight);
+
 public: // Dali::Internal::Adaptor::SceneHolder
   /**
    * @copydoc Dali::Internal::Adaptor::SceneHolder::GetNativeHandle
@@ -369,6 +419,46 @@ public: // Dali::Internal::Adaptor::SceneHolder
    */
   int32_t GetNativeId() const;
 
+  /**
+   * @copydoc Dali::DevelWindow::RequestMoveToServer()
+   */
+  void RequestMoveToServer();
+
+  /**
+   * @copydoc Dali::DevelWindow::RequestResizeToServer()
+   */
+  void RequestResizeToServer(WindowResizeDirection direction);
+
+  /**
+   * @copydoc Dali::DevelWindow::EnableFloatingMode()
+   */
+  void EnableFloatingMode(bool enable);
+
+  /**
+   * @copydoc Dali::DevelWindow::IncludeInputRegion()
+   */
+  void IncludeInputRegion(const Rect<int>& inputRegion);
+
+  /**
+   * @copydoc Dali::DevelWindow::ExcludeInputRegion()
+   */
+  void ExcludeInputRegion(const Rect<int>& inputRegion);
+
+  /**
+   * @copydoc Dali::DevelWindow::SetNeedsRotationCompletedAcknowledgement()
+   */
+  void SetNeedsRotationCompletedAcknowledgement(bool needAcknowledgement);
+
+  /**
+   * @copydoc Dali::DevelWindow::SendRotationCompletedAcknowledgement()
+   */
+  void SendRotationCompletedAcknowledgement();
+
+  /**
+   * @copydoc Dali::DevelWindow::IsWindowRotating()
+   */
+  bool IsWindowRotating() const;
+
 private:
   /**
    * @brief Enumeration for orietation mode.
@@ -396,7 +486,7 @@ private:
   /**
    * Second stage initialization
    */
-  void Initialize(Any surface, 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, WindowType type);
 
   /**
    * Called when the window becomes iconified or deiconified.
@@ -436,11 +526,34 @@ private:
   /**
    * @brief Called when the window is resized or moved by display server.
    *
-   * @param positionSize the updated window's position and size.
+   * @param[in] positionSize the updated window's position and size.
    */
   void OnUpdatePositionSize(Dali::PositionSize& positionSize);
 
   /**
+   * @brief Called when display server sent the auxiliary message.
+   *
+   * @param[in] key the auxiliary message's key.
+   * @param[in] value the auxiliary message's value.
+   * @param[in] options the auxiliary message's options. This is the list of string.
+   */
+  void OnAuxiliaryMessage(const std::string& key, const std::string& value, const Property::Array& options);
+
+  /**
+   * @brief Called when Accessibility is enabled.
+   *
+   * This method is to register the window to accessibility bridge.
+   */
+  void OnAccessibilityEnabled();
+
+  /**
+   * @brief Called when Accessibility is disabled.
+   *
+   * This method is to remove the window from accessibility bridge.
+   */
+  void OnAccessibilityDisabled();
+
+  /**
    * @brief Set available orientation to window base.
    */
   void SetAvailableAnlges(const std::vector<int>& angles);
@@ -460,6 +573,20 @@ private:
    */
   bool IsOrientationAvailable(WindowOrientation orientation) const;
 
+  /**
+   * @brief Return the rect value to recalulate with the default system coordinates.
+   *
+   * Some native window APIs work the geometry value based on the default system coordinates.
+   * IncludeInputRegion() and ExcludeInputRegion() are one of them.
+   * When the window is rotated, current window's geometry already were set with the rotated angle.
+   * If IncludeInputRegion() or ExcludeInputRegion() are called with rotated angle by application,
+   * the rect's area should be re-calcuated on the default system coordinates.
+   *
+   * @param[in] rect the window's current position and size with current window rotation angle.
+   * @return the re-calculated rect on the default system coordinates.
+   */
+  Rect<int> RecalculateRect(const Rect<int>& rect);
+
 private: // Dali::Internal::Adaptor::SceneHolder
   /**
    * @copydoc Dali::Internal::Adaptor::SceneHolder::OnAdaptorSet
@@ -564,6 +691,22 @@ public: // Signals
     return mKeyboardRepeatSettingsChangedSignal;
   }
 
+  /**
+   * @copydoc Dali::DevelWindow::AuxiliaryMessageSignal()
+   */
+  AuxiliaryMessageSignalType& AuxiliaryMessageSignal()
+  {
+    return mAuxiliaryMessageSignal;
+  }
+
+  /**
+   * @copydoc Dali::DevelWindow::AccessibilityHighlightSignal()
+   */
+  AccessibilityHighlightSignalType& AccessibilityHighlightSignal()
+  {
+    return mAccessibilityHighlightSignal;
+  }
+
 private:
   WindowRenderSurface* mWindowSurface; ///< The window rendering surface
   WindowBase*          mWindowBase;
@@ -573,22 +716,23 @@ private:
   bool                 mIsFocusAcceptable : 1;
   bool                 mIconified : 1;
   bool                 mOpaqueState : 1;
-  WindowType           mType;
+  bool                 mWindowRotationAcknowledgement : 1;
+  bool                 mFocused : 1;
   Dali::Window         mParentWindow;
 
   OrientationPtr   mOrientation;
   std::vector<int> mAvailableAngles;
   int              mPreferredAngle;
 
-  int mRotationAngle; ///< The angle of the rotation
-  int mWindowWidth;   ///< The width of the window
-  int mWindowHeight;  ///< The height of the window
+  int mRotationAngle;                    ///< The angle of the rotation
+  int mWindowWidth;                      ///< The width of the window
+  int mWindowHeight;                     ///< The height of the window
 
-  EventHandlerPtr mEventHandler; ///< The window events handler
+  EventHandlerPtr mEventHandler;         ///< The window events handler
 
-  OrientationMode mOrientationMode;
+  OrientationMode mOrientationMode;      ///< The physical screen mode is portrait or landscape
 
-  int mNativeWindowId; ///< The Native Window Id
+  int mNativeWindowId;                   ///< The Native Window Id
 
   // Signals
   SignalType                              mDeleteRequestSignal;
@@ -597,6 +741,8 @@ private:
   VisibilityChangedSignalType             mVisibilityChangedSignal;
   TransitionEffectEventSignalType         mTransitionEffectEventSignal;
   KeyboardRepeatSettingsChangedSignalType mKeyboardRepeatSettingsChangedSignal;
+  AuxiliaryMessageSignalType              mAuxiliaryMessageSignal;
+  AccessibilityHighlightSignalType        mAccessibilityHighlightSignal;
 };
 
 } // namespace Adaptor