From bad9bd9c939363172e2f1cf61ae1834868da5b81 Mon Sep 17 00:00:00 2001 From: Hyojung Jo Date: Tue, 25 Aug 2015 14:52:01 +0900 Subject: Add notify util function and edc code for notify style Change-Id: I5c5eebe38e8045eb238130aa1dda80efafb42bee Signed-off-by: Hyojung Jo --- src/common/utils.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'src/common/utils.c') diff --git a/src/common/utils.c b/src/common/utils.c index f3e7223..ed0958c 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -184,6 +184,51 @@ Evas_Object *utils_add_table(Evas_Object *parent, const char *part, return table; } +Evas_Object *utils_add_notify(Evas_Object *parent, const char *text, + const char *noti_style, const char *label_style, int timeout) +{ + Evas_Object *notify, *lbl; + + if (!parent) { + _ERR("Invalid argument."); + return NULL; + } + + notify = elm_notify_add(parent); + if (!notify) { + _ERR("elm_notify_add failed."); + return NULL; + } + + evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, + EVAS_HINT_EXPAND); + elm_notify_align_set(notify, 0.0, 1.0); + elm_notify_timeout_set(notify, timeout); + + if (noti_style) + elm_object_style_set(notify, noti_style); + + lbl = elm_label_add(notify); + if (!lbl) { + _ERR("elm_label_add failed."); + evas_object_del(notify); + return NULL; + } + + elm_object_content_set(notify, lbl); + evas_object_show(lbl); + + if (label_style) + elm_object_style_set(lbl, label_style); + + if (text) + elm_object_text_set(lbl, text); + + evas_object_show(notify); + + return notify; +} + bool utils_launch_app(const char *appid, const char *key, const char *value) { app_control_h app_ctrl; -- cgit v1.2.3