From 611a9839d59445dd2c1a7b4f4548a90742e136a9 Mon Sep 17 00:00:00 2001 From: Hosang Kim Date: Mon, 27 Mar 2023 20:28:55 +0900 Subject: [PATCH] efl_ui_win: add layout set API. 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 | 7 +++++++ src/lib/elementary/elm_macros.h | 32 ++++++++++++++++++++++++++++++++ src/lib/elementary/elm_win_legacy.h | 20 ++++++++++++++++++++ 3 files changed, 59 insertions(+) diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 3bb5f97..2e44b73 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -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); +} +// diff --git a/src/lib/elementary/elm_macros.h b/src/lib/elementary/elm_macros.h index 4c81567..7f01da0 100644 --- a/src/lib/elementary/elm_macros.h +++ b/src/lib/elementary/elm_macros.h @@ -14,3 +14,35 @@ // 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 +// + diff --git a/src/lib/elementary/elm_win_legacy.h b/src/lib/elementary/elm_win_legacy.h index 0d27ca8..2ff6e96 100644 --- a/src/lib/elementary/elm_win_legacy.h +++ b/src/lib/elementary/elm_win_legacy.h @@ -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); +// + + -- 2.7.4