efl_ui_win: add layout set API. 91/290491/2 accepted/tizen/unified/20230407.140019
authorHosang Kim <hosang12.kim@samsung.com>
Mon, 27 Mar 2023 11:28:55 +0000 (20:28 +0900)
committerHosang Kim <hosang12.kim@samsung.com>
Mon, 27 Mar 2023 12:05:11 +0000 (21:05 +0900)
The window layout method provides a convenient way for users to quickly arrange and resize windows to specific positions on their screen.

Usage example:
elm_win_layout_set(win, ELM_WIN_LAYOUT_TYPE_LEFT_HALF);
or
elm_win_layout_set(win, 2, 1, 0, 0, 1, 1);

Change-Id: I09d38ff0e6f00a6b822630cedc00fc04623bbd90

src/lib/elementary/efl_ui_win.c
src/lib/elementary/elm_macros.h
src/lib/elementary/elm_win_legacy.h

index 3bb5f97..2e44b73 100644 (file)
@@ -11723,3 +11723,10 @@ elm_win_maximum_size_set(Elm_Win *obj, int w, int h)
    if (sd->wl.win) ecore_wl2_window_maximum_size_set(sd->wl.win, w, h);
 }
 //
+// TIZEN_ONLY(20230327): add layout set API.
+EAPI void elm_win_layout_set(Elm_Win *obj, unsigned int num_cols, unsigned int num_rows, unsigned int column, unsigned int row, unsigned int col_span, unsigned int row_span)
+{
+   ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
+   if (sd->wl.win) ecore_wl2_window_layout_set(sd->wl.win, num_cols, num_rows, column, row, col_span, row_span);
+}
+//
index 4c81567..7f01da0 100644 (file)
 
 // check if the rect (x,y,w,h) is either top of or stays out of body of rect(xx,yy,ww,hh)
 #define ELM_RECTS_Y_AXIS_OUT(x, y, w, h, xx, yy, ww, hh) (((y) < (yy)) || (((x) + (w)) > ((xx) + (ww))) || (((y) + (h)) > ((yy) + (hh))))
+
+//TIZEN_ONLY(20230327): add layout set API.
+// Window is placed on the left half of the screen
+#define ELM_WIN_LAYOUT_TYPE_LEFT_HALF 2, 1, 0, 0, 1, 1
+// Window is placed on the right half of the screen
+#define ELM_WIN_LAYOUT_TYPE_RIGHT_HALF 2, 1, 1, 0, 1, 1
+// Window is placed on the top half of the screen
+#define ELM_WIN_LAYOUT_TYPE_TOP_HALF 1, 2, 0, 0, 1, 1
+// Window is placed on the bottom half of the screen
+#define ELM_WIN_LAYOUT_TYPE_BOTTOM_HALF 1, 2, 0, 1, 1, 1
+// Window is placed on the upper-left quarter of the screen
+#define ELM_WIN_LAYOUT_TYPE_UPPER_LEFT_QUARTER 2, 2, 0, 0, 1, 1
+// Window is placed on the upper-right quarter of the screen
+#define ELM_WIN_LAYOUT_TYPE_UPPER_RIGHT_QUATER 2, 2, 1, 0, 1, 1
+// Window is placed on the lower-left quarter of the screen
+#define ELM_WIN_LAYOUT_TYPE_LOWER_LEFT_QUATER 2, 2, 0, 1, 1, 1
+// Window is placed on the lower-right quarter of the screen
+#define ELM_WIN_LAYOUT_TYPE_LOWER_RIGHT_QUATER 2, 2, 1, 1, 1, 1
+// Window is placed on the left third of the screen horizontally
+#define ELM_WIN_LAYOUT_TYPE_LEFT_THIRD 3, 1, 0, 0, 1, 1
+// Window is placed on the center third of the screen horizontally
+#define ELM_WIN_LAYOUT_TYPE_CENTER_THIRD 3, 1, 1, 0, 1, 1
+// Window is placed on the right third of the screen horizontally
+#define ELM_WIN_LAYOUT_TYPE_RIGHT_THIRD 3, 1, 2, 0, 1, 1
+// Window is placed on the top third of the screen vertically
+#define ELM_WIN_LAYOUT_TYPE_TOP_THIRD 1, 3, 0, 0, 1, 1
+// Window is placed on the middle third of the screen vertically
+#define ELM_WIN_LAYOUT_TYPE_MIDDLE_THIRD 1, 3, 0, 1, 1, 1
+// Window is placed on the bottom third of the screen vertically
+#define ELM_WIN_LAYOUT_TYPE_BOTTOM_THIRD 1, 3, 0, 2, 1, 1
+//
+
index 0d27ca8..2ff6e96 100644 (file)
@@ -2380,3 +2380,23 @@ EAPI void elm_win_minimum_size_set(Elm_Win *obj, int w, int h);
 
 EAPI void elm_win_maximum_size_set(Elm_Win *obj, int w, int h);
 //
+
+// TIZEN_ONLY(20230327): add layout set API.
+/**
+ * @brief Sets the layout for the window.
+ * This function sets the layout for the window by specifying the number of columns and rows, the starting column and row, and the number of columns and rows to span.
+ *
+ * @param[in] obj The window object
+ * @param[in] num_cols The number of columns in the layout
+ * @param[in] num_rows The number of rows in the layout
+ * @param[in] column The starting column for the window
+ * @param[in] row The starting row for the window
+ * @param[in] col_span The number of columns to span for the window
+ * @param[in] row_span The number of rows to span for the window
+ *
+ * @ingroup Elm_Win_Group
+ */
+EAPI void elm_win_layout_set(Elm_Win *obj, unsigned int num_cols, unsigned int num_rows, unsigned int column, unsigned int row, unsigned int col_span, unsigned int row_span);
+//
+
+