From ef278b826ab3d2a1a4c3c28bd81a2d16e16d4ab6 Mon Sep 17 00:00:00 2001 From: raster Date: Tue, 25 Oct 2011 08:45:56 +0000 Subject: [PATCH] add util call to save always adding win, setting title, adding bg, showing it etc. etc. -> standard kind of window. git-svn-id: https://svn.enlightenment.org/svn/e/trunk/elementary@64376 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/lib/Elementary.h.in | 14 ++++++++++++++ src/lib/elm_win.c | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/lib/Elementary.h.in b/src/lib/Elementary.h.in index c42ece7..bd48c2c 100644 --- a/src/lib/Elementary.h.in +++ b/src/lib/Elementary.h.in @@ -3762,6 +3762,20 @@ extern "C" { */ 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/src/lib/elm_win.c b/src/lib/elm_win.c index cb8a6cf..7f97552 100644 --- a/src/lib/elm_win.c +++ b/src/lib/elm_win.c @@ -1586,6 +1586,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) { -- 2.7.4