diff --git a/legacy/elementary/src/lib/Elementary.h.in b/legacy/elementary/src/lib/Elementary.h.in index e6c1614a8c..cc7ae66af1 100644 --- a/legacy/elementary/src/lib/Elementary.h.in +++ b/legacy/elementary/src/lib/Elementary.h.in @@ -3799,6 +3799,20 @@ extern "C" { * @return The created object, or NULL on failure */ EAPI Evas_Object *elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type); + /** + * Adds a window object with standard setup + * + * @param name The name of the window + * @param title The title for the window + * + * This creates a window like elm_win_add() but also puts in a standard + * background with elm_bg_add(), as well as setting the window title to + * @p title. The window type created is of type ELM_WIN_BASIC, with NULL + * as the parent widget. + * + * @return The created object, or NULL on failure + */ + EAPI Evas_Object *elm_win_util_standard_add(const char *name, const char *title); /** * Add @p subobj as a resize object of window @p obj. * diff --git a/legacy/elementary/src/lib/elm_win.c b/legacy/elementary/src/lib/elm_win.c index d79bdc2f01..00c5470c18 100644 --- a/legacy/elementary/src/lib/elm_win.c +++ b/legacy/elementary/src/lib/elm_win.c @@ -1613,6 +1613,26 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type) return win->win_obj; } +EAPI Evas_Object * +elm_win_util_standard_add(const char *name, const char *title) +{ + Evas_Object *win, *bg; + + win = elm_win_add(NULL, name, ELM_WIN_BASIC); + if (!win) return; + elm_win_title_set(win, title); + bg = elm_bg_add(win); + if (!bg) + { + evas_object_del(win); + return NULL; + } + evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + elm_win_resize_object_add(win, bg); + evas_object_show(bg); + return win; +} + EAPI void elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj) {