diff options
author | Minkyu Kang <mk7.kang@samsung.com> | 2015-08-28 01:43:42 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.vlan103.tizen.org> | 2015-08-28 01:43:42 -0700 |
commit | 0fd204b12b59e27e485864f76b00bae2799f6b7c (patch) | |
tree | 5b2adb3a01d83f9c7606f0a494b9aec18a6ad09d | |
parent | dbbbd1d6b5df4b169ad7476b9511fefce74703b7 (diff) | |
parent | 3f5c7f557caa9dddd5ed9bef4125fcc6aab0aee2 (diff) | |
download | air_home-0fd204b12b59e27e485864f76b00bae2799f6b7c.tar.gz air_home-0fd204b12b59e27e485864f76b00bae2799f6b7c.tar.bz2 air_home-0fd204b12b59e27e485864f76b00bae2799f6b7c.zip |
Merge "add toast in utils" into tizen
-rw-r--r-- | edje/home-theme.edc | 1 | ||||
-rw-r--r-- | edje/widget/notify.edc | 174 | ||||
-rw-r--r-- | include/defs.h | 1 | ||||
-rw-r--r-- | include/utils.h | 1 | ||||
-rw-r--r-- | src/utils.c | 35 |
5 files changed, 212 insertions, 0 deletions
diff --git a/edje/home-theme.edc b/edje/home-theme.edc index da6ee29..2845082 100644 --- a/edje/home-theme.edc +++ b/edje/home-theme.edc @@ -20,4 +20,5 @@ collections { #include "widget/label.edc" #include "widget/gengrid.edc" #include "widget/entry.edc" + #include "widget/notify.edc" } diff --git a/edje/widget/notify.edc b/edje/widget/notify.edc new file mode 100644 index 0000000..58a869f --- /dev/null +++ b/edje/widget/notify.edc @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +styles { + style { + name: "toast_style"; + base: "font=TizenSans:style=Light font_size=28 align=center color=#515151"; + tag: "br" "\n"; + tag: "tab" "\t"; + } +} + +group { + name: "elm/notify/bottom_left/toast"; + parts { + part { + name: "padding"; + type: SPACER; + description { + state: "default" 0.0; + rel1.relative: 0.0 1.0; + rel2.relative: 0.0 1.0; + min: 40 40; + align: 0.0 1.0; + fixed: 1 1; + } + } + part { + name: "area"; + type: SPACER; + scale: 1; + description { + state: "default" 0.0; + rel1 { + to: "padding"; + relative: 1.0 0.0; + } + rel2 { + to: "padding"; + relative: 1.0 0.0; + } + min: 536 70; + max: 536 108; + align: 0.0 1.0; + fixed: 1 1; + } + } + part { + name: "base"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + rel1.to: "area"; + rel2.to: "area"; + align: 1.0 1.0; + color: 255 255 255 255; + fixed: 1 1; + } + } + part { + name: "border.top"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + color: 194 194 194 255; + rel1.to: "base"; + rel2.to: "base"; + rel2.relative: 1.0 0.0; + min: 0 1; + align: 0.0 0.0; + fixed: 0 1; + } + } + part { + name: "border.left"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + color: 194 194 194 255; + rel1.to: "base"; + rel2.to: "base"; + rel2.relative, 0.0 1.0; + min, 1 0; + align, 0.0 0.0; + fixed, 1 0; + } + } + part { + name: "border.right"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + color: 194 194 194 255; + rel1.to: "base"; + rel2.to: "base"; + rel1.relative, 1.0 0.0; + min, 1 0; + align, 1.0 0.0; + fixed, 1 0; + } + } + part { + name: "border.bottom"; + type: RECT; + scale: 1; + description { + state: "default" 0.0; + color: 194 194 194 255; + rel1.to: "base"; + rel2.to: "base"; + rel1.relative, 0.0 1.0; + min, 0 1; + align, 0.0 1.0; + fixed, 0 1; + } + } + part { + name: "elm.swallow.content"; + type: SWALLOW; + description { + state: "default" 0.0; + rel1 { + to: "base"; + relative: 0.5 0.5; + } + rel2 { + to: "base"; + relative: 0.5 0.5; + } + align: 0.5 0.5; + min: 476 28; + fixed: 1 1; + } + } + } +} + +group { + name: "elm/label/base/toast"; + parts { + part { + name: "elm.text"; + type: TEXTBLOCK; + mouse_events: 0; + scale: 1; + description { + state: "default" 0.0; + text { + style: "toast_style"; + min: 0 1; + max: 0 1; + } + } + } + } +} + diff --git a/include/defs.h b/include/defs.h index 33693b0..958c165 100644 --- a/include/defs.h +++ b/include/defs.h @@ -153,6 +153,7 @@ #define STYLE_LABEL_ACTION_MENU_TITLE "slide_action_menu_title" #define STYLE_LABEL_ACTION_MENU_TITLE_FOCUS "slide_action_menu_title_focus" #define STYLE_LABEL_ACTION_MENU_TITLE_DIS "slide_action_menu_title_dis" +#define STYLE_TOAST "toast" #define COLOR_DEFAULT_R 0 #define COLOR_DEFAULT_G 119 diff --git a/include/utils.h b/include/utils.h index 6c42fe5..de543db 100644 --- a/include/utils.h +++ b/include/utils.h @@ -49,6 +49,7 @@ Evas_Object *utils_add_entry(Evas_Object *base, bool password, bool scroll, const char *part, const char *style); Evas_Object *utils_add_popup(Evas_Object *base, char *title, char *message); Evas_Object *utils_add_rectangle(Evas_Object *base, int r, int g, int b, int a); +Evas_Object *utils_add_toast(Evas_Object *base, char *message); bool utils_launch_app(const char *pkg, const char *key, const char *value); #endif /* __AIR_HOME_UTILS_H__ */ diff --git a/src/utils.c b/src/utils.c index 28655dc..25ba2c8 100644 --- a/src/utils.c +++ b/src/utils.c @@ -409,6 +409,41 @@ Evas_Object *utils_add_rectangle(Evas_Object *base, int r, int g, int b, int a) return rect; } +Evas_Object *utils_add_toast(Evas_Object *base, char *message) +{ + Evas_Object *notify, *label; + + if (!base || !message) { + _ERR("Invalid argument"); + return NULL; + + } + + notify = elm_notify_add(base); + if (!notify) { + _ERR("failed to add notify"); + return NULL; + } + + elm_object_style_set(notify, STYLE_TOAST); + elm_notify_align_set(notify, 0.0, 1.0); + elm_notify_timeout_set(notify, 3.0); + + label = elm_label_add(notify); + if (!label) { + _ERR("failed to add label"); + evas_object_del(notify); + return NULL; + } + elm_object_style_set(label, STYLE_TOAST); + elm_object_text_set(label, message); + + elm_object_content_set(notify, label); + evas_object_show(notify); + + return notify; +} + bool utils_launch_app(const char *pkg, const char *key, const char *value) { app_control_h app_control; |