From: Soohye Shin Date: Wed, 24 Jun 2015 08:08:29 +0000 (+0900) Subject: add utils_add_button and utils_add_entry X-Git-Tag: accepted/tizen/tv/20150728.070602~45 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0cfb1036ea8af04e334df5d0ad9a0d169a44bb00;p=profile%2Ftv%2Fapps%2Fnative%2Fair_home.git add utils_add_button and utils_add_entry Change-Id: I4411e25db62a3b9c8d39f641812fd5cb041b9af8 Signed-off-by: Soohye Shin --- diff --git a/include/defs.h b/include/defs.h index d946e8b..51f959d 100644 --- a/include/defs.h +++ b/include/defs.h @@ -90,6 +90,7 @@ #define STYLE_LABEL_TITLE "slide_home_title" #define STYLE_LABEL_TITLE_FOCUS "slide_home_title_focus" +#define STYLE_INPUT "input.field" #define COLOR_DEFAULT_R 0 #define COLOR_DEFAULT_G 119 diff --git a/include/utils.h b/include/utils.h index 4d34d14..433b466 100644 --- a/include/utils.h +++ b/include/utils.h @@ -20,15 +20,19 @@ #include #include -Evas_Object *utils_add_layout(Evas_Object *base, const char *group, bool focus_allow, +Evas_Object *utils_add_layout(Evas_Object *base, const char *group, + bool focus_allow, const char *part); +Evas_Object *utils_add_icon(Evas_Object *base, const char *file, const char *part); -Evas_Object *utils_add_icon(Evas_Object *base, const char *file, const char *part); Evas_Object *utils_add_label(Evas_Object *base, char *text, const char *style, const char *part); Evas_Object *utils_add_bg(Evas_Object *base, int r, int g, int b, int a, const char *part); Evas_Object *utils_add_scroller(Evas_Object *base); Evas_Object *utils_add_box(Evas_Object *base, bool horizon); +Evas_Object *utils_add_button(Evas_Object *base, char *text, const char *part); +Evas_Object *utils_add_entry(Evas_Object *base, char *text, bool password, + const char *part); bool utils_launch_app(const char *pkg); #endif /* __AIR_HOME_UTILS_H__ */ diff --git a/src/utils.c b/src/utils.c index 97423fe..1f78641 100644 --- a/src/utils.c +++ b/src/utils.c @@ -169,6 +169,58 @@ Evas_Object *utils_add_box(Evas_Object *base, bool horizon) return box; } +Evas_Object *utils_add_button(Evas_Object *base, char *text, const char *part) +{ + Evas_Object *btn; + + btn = elm_button_add(base); + if (!btn) { + _ERR("failed to add btn"); + return NULL; + } + + if (part) + elm_object_part_content_set(base, part, btn); + if (text) + elm_object_text_set(btn, text); + evas_object_show(btn); + + return btn; +} + +Evas_Object *utils_add_entry(Evas_Object *base, char *text, bool password, + const char *part) +{ + Evas_Object *entry; + + entry = elm_entry_add(base); + if (!entry) { + _ERR("failed to add entry"); + return NULL; + } + + if (password) { + elm_entry_password_set(entry, EINA_TRUE); + elm_config_password_show_last_set(EINA_FALSE); + } + + elm_object_style_set(entry, STYLE_INPUT); + elm_entry_single_line_set(entry, EINA_TRUE); + elm_entry_input_panel_language_set(entry, + ELM_INPUT_PANEL_LANG_ALPHABET); + elm_entry_cursor_end_set(entry); + elm_scroller_policy_set(entry, ELM_SCROLLER_POLICY_OFF, + ELM_SCROLLER_POLICY_OFF); + if (text) + elm_entry_entry_set(entry, text); + if (part) + elm_object_part_content_set(base, part, entry); + + evas_object_show(entry); + + return entry; +} + bool utils_launch_app(const char *pkg) { app_control_h app_control;