[Tizen] Add Window::SetLayout method 06/290706/1 accepted/tizen/7.0/unified/20230403.235557 accepted/tizen/7.0/unified/20230404.033730
authorDaekwang Ryu <dkdk.ryu@samsung.com>
Thu, 30 Mar 2023 04:14:03 +0000 (13:14 +0900)
committerDaekwang Ryu <dkdk.ryu@samsung.com>
Fri, 31 Mar 2023 05:54:15 +0000 (14:54 +0900)
The new `SetLayout` method allows users to easily snap windows to specific positions and sizes.
This feature is similar to the snap window feature found in many operating systems,
allowing users to quickly arrange their windows in a convenient and efficient manner.

Change-Id: I59b7ef154494cbbc8af39a85747d5b0cde57feb4

20 files changed:
automated-tests/src/dali-adaptor/utc-Dali-Window.cpp
dali/internal/window-system/android/window-base-android.cpp
dali/internal/window-system/android/window-base-android.h
dali/internal/window-system/common/window-base.h
dali/internal/window-system/common/window-impl.cpp
dali/internal/window-system/common/window-impl.h
dali/internal/window-system/macos/window-base-mac.h
dali/internal/window-system/macos/window-base-mac.mm
dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.cpp
dali/internal/window-system/tizen-wayland/ecore-wl/window-base-ecore-wl.h
dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.cpp
dali/internal/window-system/tizen-wayland/ecore-wl2/window-base-ecore-wl2.h
dali/internal/window-system/ubuntu-x11/window-base-ecore-x.cpp
dali/internal/window-system/ubuntu-x11/window-base-ecore-x.h
dali/internal/window-system/windows/window-base-win.cpp
dali/internal/window-system/windows/window-base-win.h
dali/internal/window-system/x11/window-base-x.cpp
dali/internal/window-system/x11/window-base-x.h
dali/public-api/adaptor-framework/window.cpp
dali/public-api/adaptor-framework/window.h

index 2cab8de..19100ce 100644 (file)
@@ -943,6 +943,22 @@ int UtcDaliWindowGetPositionNegative(void)
   END_TEST;
 }
 
+int UtcDaliWindowSetLayoutNegative(void)
+{
+  Dali::Window instance;
+  try
+  {
+    unsigned int arg1(0);
+    instance.SetLayout(arg1, arg1, arg1, arg1, arg1, arg1);
+    DALI_TEST_CHECK(false); // Should not get here
+  }
+  catch(...)
+  {
+    DALI_TEST_CHECK(true); // We expect an assert
+  }
+  END_TEST;
+}
+
 int UtcDaliWindowGetRootLayerNegative(void)
 {
   Dali::Window instance;
index abab78f..8a83136 100644 (file)
@@ -176,6 +176,10 @@ void WindowBaseAndroid::MoveResize(PositionSize positionSize)
 {
 }
 
+void WindowBaseAndroid::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
+{
+}
+
 void WindowBaseAndroid::SetClass(const std::string& name, const std::string& className)
 {
 }
index 6be667e..1f6463d 100644 (file)
@@ -178,6 +178,11 @@ public:
    */
   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()
    */
index d0115ed..18b14e8 100644 (file)
@@ -166,6 +166,11 @@ public:
   virtual void MoveResize(Dali::PositionSize positionSize) = 0;
 
   /**
+   * @copydoc Dali::Window::SetLayout()
+   */
+  virtual void SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan) = 0;
+
+  /**
    * @copydoc Dali::Window::SetClass()
    */
   virtual void SetClass(const std::string& name, const std::string& className) = 0;
index 51c11d0..a49d43c 100644 (file)
@@ -800,6 +800,11 @@ void Window::SetPositionSize(PositionSize positionSize)
   Dali::Accessibility::Accessible::Get(mScene.GetRootLayer())->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
 }
 
+void Window::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
+{
+    mWindowBase->SetLayout(numCols, numRows, column, row, colSpan, rowSpan);
+}
+
 Dali::Layer Window::GetRootLayer() const
 {
   return mScene.GetRootLayer();
index e252919..ae248b9 100644 (file)
@@ -332,6 +332,11 @@ public:
   PositionSize GetPositionSize() const;
 
   /**
+   * @copydoc Dali::Window::SetLayout()
+   */
+  void SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan);
+
+  /**
    * @copydoc Dali::Window::GetRootLayer()
    */
   Dali::Layer GetRootLayer() const;
index 174c6bc..4d3f047 100644 (file)
@@ -107,6 +107,11 @@ public:
    */
   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()
    */
index 988ea87..16d2f75 100644 (file)
@@ -456,6 +456,10 @@ void WindowBaseCocoa::MoveResize( PositionSize positionSize )
   [mImpl->mWindow.contentView setFrameSize:size];
 }
 
+void WindowBaseCocoa::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
+{
+}
+
 void WindowBaseCocoa::SetClass( const std::string& name, const std::string& className )
 {
 }
index ddf4ad5..ae415cb 100644 (file)
@@ -1317,6 +1317,10 @@ void WindowBaseEcoreWl::MoveResize(PositionSize positionSize)
   ecore_wl_window_update_size(mEcoreWindow, positionSize.width, positionSize.height);
 }
 
+void WindowBaseEcoreWl::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
+{
+}
+
 void WindowBaseEcoreWl::SetClass(const std::string& name, const std::string& className)
 {
   ecore_wl_window_title_set(mEcoreWindow, name.c_str());
index 463359c..94ad113 100644 (file)
@@ -234,6 +234,11 @@ public:
    */
   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()
    */
index f5d53e4..5d179ff 100644 (file)
@@ -1844,6 +1844,12 @@ void WindowBaseEcoreWl2::MoveResize(PositionSize positionSize)
   ecore_wl2_window_sync_geometry_set(mEcoreWindow, ++mMoveResizeSerial, newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
 }
 
+void WindowBaseEcoreWl2::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
+{
+  DALI_LOG_RELEASE_INFO("ecore_wl2_window_layout_set, numCols[%d], numRows[%d], column[%d], row[%d], colSpan[%d], rowSpan[%d]\n", numCols, numRows, column, row, colSpan, rowSpan);
+  ecore_wl2_window_layout_set(mEcoreWindow, numCols, numRows, column, row, colSpan, rowSpan);
+}
+
 void WindowBaseEcoreWl2::SetClass(const std::string& name, const std::string& className)
 {
   ecore_wl2_window_title_set(mEcoreWindow, name.c_str());
index d5789ed..00ca5bd 100644 (file)
@@ -273,6 +273,11 @@ public:
    */
   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()
    */
index 0104a36..614e672 100644 (file)
@@ -686,6 +686,10 @@ void WindowBaseEcoreX::MoveResize(PositionSize positionSize)
   ecore_x_window_move_resize(mEcoreWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
 }
 
+void WindowBaseEcoreX::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
+{
+}
+
 void WindowBaseEcoreX::SetClass(const std::string& name, const std::string& className)
 {
   ecore_x_icccm_title_set(mEcoreWindow, name.c_str());
index d0b069d..60d7143 100644 (file)
@@ -180,6 +180,11 @@ public:
   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()
    */
   void SetClass(const std::string& name, const std::string& className) override;
index 22aa274..c8792be 100644 (file)
@@ -298,6 +298,10 @@ void WindowBaseWin::MoveResize(PositionSize positionSize)
 {
 }
 
+void WindowBaseWin::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
+{
+}
+
 void WindowBaseWin::SetClass(const std::string& name, const std::string& className)
 {
 }
index 748157a..90c8d21 100644 (file)
@@ -167,6 +167,11 @@ public:
   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()
    */
   void SetClass(const std::string& name, const std::string& className) override;
index c07f0e8..79347b1 100644 (file)
@@ -636,6 +636,10 @@ void WindowBaseX::MoveResize(PositionSize positionSize)
   WindowSystem::GetImplementation().MoveResize(mWindow, positionSize.x, positionSize.y, positionSize.width, positionSize.height);
 }
 
+void WindowBaseX::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
+{
+}
+
 void WindowBaseX::SetClass(const std::string& name, const std::string& className)
 {
   WindowSystem::GetImplementation().SetClass(mWindow, name, className);
index bcd46be..eedfba3 100644 (file)
@@ -183,6 +183,11 @@ public:
    */
   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()
    */
index cbeddac..eb03a52 100644 (file)
@@ -323,6 +323,11 @@ Dali::Window::WindowPosition Window::GetPosition() const
   return GetImplementation(*this).GetPosition();
 }
 
+void Window::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan)
+{
+  return GetImplementation(*this).SetLayout(numCols, numRows, column, row, colSpan, rowSpan);
+}
+
 void Window::SetTransparency(bool transparent)
 {
   GetImplementation(*this).SetTransparency(transparent);
index e432d6f..f0513ac 100644 (file)
@@ -549,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