add utils_add_button and utils_add_entry 85/42185/1
authorSoohye Shin <soohye.shin@samsung.com>
Wed, 24 Jun 2015 08:08:29 +0000 (17:08 +0900)
committerSoohye Shin <soohye.shin@samsung.com>
Wed, 24 Jun 2015 08:08:29 +0000 (17:08 +0900)
Change-Id: I4411e25db62a3b9c8d39f641812fd5cb041b9af8
Signed-off-by: Soohye Shin <soohye.shin@samsung.com>
include/defs.h
include/utils.h
src/utils.c

index d946e8b..51f959d 100644 (file)
@@ -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
index 4d34d14..433b466 100644 (file)
 #include <stdbool.h>
 #include <Evas.h>
 
-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__ */
index 97423fe..1f78641 100644 (file)
@@ -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;