aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/elementary/test_popup.c
diff options
context:
space:
mode:
authorTaehyub Kim <taehyub.kim@samsung.com>2017-08-23 15:50:18 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-11-28 17:15:42 +0900
commitd3a14d08b09a2200b9a85c7ad4d93914a14f6de2 (patch)
tree4c6930d77f269495fb1104188c38239a577fe555 /src/bin/elementary/test_popup.c
parentefl_ui_popup: make popup size expandable (diff)
downloadefl-d3a14d08b09a2200b9a85c7ad4d93914a14f6de2.tar.gz
efl_ui_popup_alert: add Efl.Ui.Popup.Alert class
Summary: Add initial code for Efl.Ui.Popup.Alert class. It supports setting title and buttons. Test Plan: 1. run elementary_test -to efluipopupalert Reviewers: Jaehyun_Cho, jpeg, cedric, thiepha, Blackmole, woohyun Differential Revision: https://phab.enlightenment.org/D5108
Diffstat (limited to 'src/bin/elementary/test_popup.c')
-rw-r--r--src/bin/elementary/test_popup.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/bin/elementary/test_popup.c b/src/bin/elementary/test_popup.c
index e42b7dc4a9..4074862175 100644
--- a/src/bin/elementary/test_popup.c
+++ b/src/bin/elementary/test_popup.c
@@ -1092,3 +1092,47 @@ test_efl_ui_popup(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *ev
efl_content_set(efl_ui_popup, btn);
}
+
+static void
+efl_ui_popup_alert_clicked_cb(void *data EINA_UNUSED, const Efl_Event *ev)
+{
+ Efl_Ui_Popup_Alert_Button type = (Efl_Ui_Popup_Alert_Button)ev->info;
+ if (type == EFL_UI_POPUP_ALERT_BUTTON_POSITIVE)
+ printf("Positive Button is clicked\n");
+ else if(type == EFL_UI_POPUP_ALERT_BUTTON_NEGATIVE)
+ printf("Negative Button is clicked\n");
+ else if(type == EFL_UI_POPUP_ALERT_BUTTON_USER)
+ printf("User Button is clicked\n");
+}
+
+void
+test_efl_ui_popup_alert(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Evas_Object *win;
+ char buf[PATH_MAX];
+
+ win = elm_win_util_standard_add("Efl UI Popup Alert", "Efl UI Popup Alert");
+ elm_win_autodel_set(win, EINA_TRUE);
+
+ evas_object_resize(win, 320, 320);
+ evas_object_show(win);
+
+ Evas_Object *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_CLASS, win);
+
+ efl_ui_popup_alert_title_set(efl_ui_popup, "title");
+
+ evas_object_resize(efl_ui_popup, 160, 160);
+ evas_object_show(efl_ui_popup);
+
+ Evas_Object *layout = elm_layout_add(efl_ui_popup);
+ snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
+ elm_layout_file_set(layout, buf, "efl_ui_popup_scroll_content");
+ evas_object_show(layout);
+
+ efl_content_set(efl_ui_popup, layout);
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_POSITIVE, "Yes");
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_NEGATIVE, "No");
+ efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_USER, "Cancel");
+
+ efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
+}