[Tizen] Add Window::SetLayout method
[platform/core/uifw/dali-adaptor.git] / dali / public-api / adaptor-framework / window.h
index ba38eda..f0513ac 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_WINDOW_H
 
 /*
- * Copyright (c) 2020 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.
@@ -19,6 +19,8 @@
  */
 
 // EXTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/window-enumerations.h>
+#include <dali/public-api/math/int-pair.h>
 #include <dali/public-api/math/rect.h>
 #include <dali/public-api/math/uint-16-pair.h>
 #include <dali/public-api/math/vector2.h>
@@ -70,7 +72,7 @@ class DALI_ADAPTOR_API Window : public BaseHandle
 {
 public:
   using WindowSize     = Uint16Pair; ///< Window size type @SINCE_1_2.60
-  using WindowPosition = Uint16Pair; ///< Window position type @SINCE_1_2.60
+  using WindowPosition = Int32Pair;  ///< Window position type @SINCE_2_1.45
 
   using FocusChangeSignalType = Signal<void(Window, bool)>;       ///< Window focus signal type @SINCE_1_4.35
   using ResizeSignalType      = Signal<void(Window, WindowSize)>; ///< Window resized signal type @SINCE_1_4.35
@@ -78,75 +80,6 @@ public:
   using TouchEventSignalType  = Signal<void(const TouchEvent&)>;  ///< Touch signal type @SINCE_1_9.28
 
 public:
-  // Enumerations
-
-  /**
-   * @brief Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
-   *
-   * This Enumeration is used the available orientation APIs and the preferred orientation.
-   *
-   * @SINCE_1_0.0
-   */
-  enum WindowOrientation
-  {
-    PORTRAIT                  = 0,   ///< Portrait orientation. The height of the display area is greater than the width. @SINCE_1_0.0
-    LANDSCAPE                 = 90,  ///< Landscape orientation. A wide view area is needed. @SINCE_1_0.0
-    PORTRAIT_INVERSE          = 180, ///< Portrait inverse orientation @SINCE_1_0.0
-    LANDSCAPE_INVERSE         = 270, ///< Landscape inverse orientation @SINCE_1_0.0
-    NO_ORIENTATION_PREFERENCE = -1   ///< No orientation. It is used to initialize or unset the preferred orientation.  @SINCE_1_4.51
-  };
-
-  /**
-   * @brief An enum of Window types.
-   * @SINCE_1_2.60
-   */
-  enum Type
-  {
-    NORMAL,       ///< A default window type. Indicates a normal, top-level window. Almost every window will be created with this type. @SINCE_1_2.60
-    NOTIFICATION, ///< A notification window, like a warning about battery life or a new E-Mail received. @SINCE_1_2.60
-    UTILITY,      ///< A persistent utility window, like a toolbox or palette. @SINCE_1_2.60
-    DIALOG        ///< Used for simple dialog windows. @SINCE_1_2.60
-  };
-
-  /**
-   * @brief An enum of screen mode.
-   * @SINCE_1_2.60
-   */
-  struct NotificationLevel
-  {
-    /**
-     * @brief An enum of screen mode.
-     * @SINCE_1_2.60
-     */
-    enum Type
-    {
-      NONE   = -1, ///< No notification level. Default level. This value makes the notification window place in the layer of the normal window. @SINCE_1_2.60
-      BASE   = 10, ///< Base notification level. @SINCE_1_2.60
-      MEDIUM = 20, ///< Higher notification level than base. @SINCE_1_2.60
-      HIGH   = 30, ///< Higher notification level than medium. @SINCE_1_2.60
-      TOP    = 40  ///< The highest notification level. @SINCE_1_2.60
-    };
-  };
-
-  /**
-   * @brief An enum of screen mode.
-   * @SINCE_1_2.60
-   */
-  struct ScreenOffMode
-  {
-    /**
-     * @brief An enum of screen mode.
-     * @SINCE_1_2.60
-     */
-    enum Type
-    {
-      TIMEOUT, ///< The mode which turns the screen off after a timeout. @SINCE_1_2.60
-      NEVER,   ///< The mode which keeps the screen turned on. @SINCE_1_2.60
-    };
-
-    static constexpr Type DEFAULT{TIMEOUT}; ///< The default mode. @SINCE_1_2.60
-  };
-
   // Methods
 
   /**
@@ -224,6 +157,15 @@ public:
   Window& operator=(Window&& rhs);
 
   /**
+   * @brief Downcast sceneHolder to window
+   *
+   * @SINCE_2_1.46
+   * @param[in] handle The handle need to downcast
+   * @return Whether it's a valid window or not
+   */
+  static Window DownCast(BaseHandle handle);
+
+  /**
    * @brief Adds a child Actor to the Window.
    *
    * The child will be referenced.
@@ -271,6 +213,16 @@ public:
   Layer GetRootLayer() const;
 
   /**
+   * @brief Returns the overlay Layer of the Window.
+   * If there isn't overlay layer yet, this method create overlay layer and
+   * exclusive render task internally.
+   *
+   * @SINCE_2_2.10
+   * @return The root layer
+   */
+  Layer GetOverlayLayer();
+
+  /**
    * @brief Queries the number of on-scene layers in the Window.
    *
    * Note that a default layer is always provided (count >= 1).
@@ -471,37 +423,37 @@ public:
 
   /**
    * @brief Sets a window type.
-   * @SINCE_1_2.60
+   * @@SINCE_2_0.0
    * @param[in] type The window type.
    * @remarks The default window type is NORMAL.
    */
-  void SetType(Type type);
+  void SetType(WindowType type);
 
   /**
    * @brief Gets a window type.
-   * @SINCE_1_2.60
+   * @@SINCE_2_0.0
    * @return A window type.
    */
-  Type GetType() const;
+  WindowType GetType() const;
 
   /**
    * @brief Sets a priority level for the specified notification window.
-   * @SINCE_1_2.60
+   * @@SINCE_2_0.0
    * @param[in] level The notification window level.
-   * @return True if no error occurred, false otherwise.
+   * @return The result of the window operation.
    * @PRIVLEVEL_PUBLIC
    * @PRIVILEGE_WINDOW_PRIORITY
    * @remarks This can be used for a notification type window only. The default level is NotificationLevel::NONE.
    */
-  bool SetNotificationLevel(NotificationLevel::Type level);
+  WindowOperationResult SetNotificationLevel(WindowNotificationLevel level);
 
   /**
    * @brief Gets a priority level for the specified notification window.
-   * @SINCE_1_2.60
+   * @@SINCE_2_0.0
    * @return The notification window level.
    * @remarks This can be used for a notification type window only.
    */
-  NotificationLevel::Type GetNotificationLevel() const;
+  WindowNotificationLevel GetNotificationLevel() const;
 
   /**
    * @brief Sets a transparent window's visual state to opaque.
@@ -525,23 +477,23 @@ public:
   /**
    * @brief Sets a window's screen off mode.
    * @details This API is useful when the application needs to keep the display turned on.
-   * If the application sets the screen mode to #::Dali::Window::ScreenOffMode::NEVER to its window and the window is shown,
+   * If the application sets the screen mode to #::Dali::WindowScreenOffMode::NEVER to its window and the window is shown,
    * the window manager requests the display system to keep the display on as long as the window is shown.
    * If the window is no longer shown, then the window manager requests the display system to go back to normal operation.
-   * @SINCE_1_2.60
+   * @@SINCE_2_0.0
    * @param[in] screenOffMode The screen mode.
-   * @return True if no error occurred, false otherwise.
+   * @return The result of the window operation.
    * @PRIVLEVEL_PUBLIC
    * @PRIVILEGE_DISPLAY
    */
-  bool SetScreenOffMode(ScreenOffMode::Type screenOffMode);
+  WindowOperationResult SetScreenOffMode(WindowScreenOffMode screenOffMode);
 
   /**
    * @brief Gets a screen off mode of the window.
-   * @SINCE_1_2.60
+   * @@SINCE_2_0.0
    * @return The screen off mode.
    */
-  ScreenOffMode::Type GetScreenOffMode() const;
+  WindowScreenOffMode GetScreenOffMode() const;
 
   /**
    * @brief Sets preferred brightness of the window.
@@ -551,11 +503,11 @@ public:
    * A value less than 0 results in default brightness and a value greater than 100 results in maximum brightness.
    * @SINCE_1_2.60
    * @param[in] brightness The preferred brightness (0 to 100).
-   * @return True if no error occurred, false otherwise.
+   * @return The result of the window operation.
    * @PRIVLEVEL_PUBLIC
    * @PRIVILEGE_DISPLAY
    */
-  bool SetBrightness(int brightness);
+  WindowOperationResult SetBrightness(int brightness);
 
   /**
    * @brief Gets preferred brightness of the window.
@@ -597,6 +549,22 @@ public:
   WindowPosition GetPosition() const;
 
   /**
+   * @brief Sets the layout of the window.
+   *
+   * This method sets the layout of the window based on the specified number of columns and rows,
+   * as well as the position and size of the window within that layout.
+   *
+   * @param numCols The number of columns in the layout.
+   * @param numRows The number of rows in the layout.
+   * @param column The column number of the window within the layout.
+   * @param row The row number of the window within the layout.
+   * @param colSpan The number of columns the window should span within the layout.
+   * @param rowSpan The number of rows the window should span within the layout.
+   * @SINCE_2_2.20
+   */
+  void SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan);
+
+  /**
    * @brief Sets whether the window is transparent or not.
    *
    * @SINCE_1_2.60