summaryrefslogtreecommitdiff
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
parentb38ad0971cb3bf8d84fcfcce51fdc1cca73c460f (diff)
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 '')
-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
1092 1092
1093 efl_content_set(efl_ui_popup, btn); 1093 efl_content_set(efl_ui_popup, btn);
1094} 1094}
1095
1096static void
1097efl_ui_popup_alert_clicked_cb(void *data EINA_UNUSED, const Efl_Event *ev)
1098{
1099 Efl_Ui_Popup_Alert_Button type = (Efl_Ui_Popup_Alert_Button)ev->info;
1100 if (type == EFL_UI_POPUP_ALERT_BUTTON_POSITIVE)
1101 printf("Positive Button is clicked\n");
1102 else if(type == EFL_UI_POPUP_ALERT_BUTTON_NEGATIVE)
1103 printf("Negative Button is clicked\n");
1104 else if(type == EFL_UI_POPUP_ALERT_BUTTON_USER)
1105 printf("User Button is clicked\n");
1106}
1107
1108void
1109test_efl_ui_popup_alert(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1110{
1111 Evas_Object *win;
1112 char buf[PATH_MAX];
1113
1114 win = elm_win_util_standard_add("Efl UI Popup Alert", "Efl UI Popup Alert");
1115 elm_win_autodel_set(win, EINA_TRUE);
1116
1117 evas_object_resize(win, 320, 320);
1118 evas_object_show(win);
1119
1120 Evas_Object *efl_ui_popup= efl_add(EFL_UI_POPUP_ALERT_CLASS, win);
1121
1122 efl_ui_popup_alert_title_set(efl_ui_popup, "title");
1123
1124 evas_object_resize(efl_ui_popup, 160, 160);
1125 evas_object_show(efl_ui_popup);
1126
1127 Evas_Object *layout = elm_layout_add(efl_ui_popup);
1128 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
1129 elm_layout_file_set(layout, buf, "efl_ui_popup_scroll_content");
1130 evas_object_show(layout);
1131
1132 efl_content_set(efl_ui_popup, layout);
1133 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_POSITIVE, "Yes");
1134 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_NEGATIVE, "No");
1135 efl_ui_popup_alert_button_set(efl_ui_popup, EFL_UI_POPUP_ALERT_BUTTON_USER, "Cancel");
1136
1137 efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
1138}