summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaehyub Kim <taehyub.kim@samsung.com>2017-10-27 18:11:58 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-11-28 17:15:42 +0900
commit4a020223d89735dbfe99ef3c69a89c9aeb9717e6 (patch)
tree682e8449a66c26417245b2519f79c6be9da133f4
parente65731b755709eba6ca869ce36e27a26564d337b (diff)
test_popup: modify Efl.Ui.Popup Sample Code
Summary: make Efl.Ui.Popup sample codes simpler Test Plan: 1. run elementary_test -to efluipopup 2. test various options of efluipopup by clicking each button Reviewers: Jaehyun_Cho, Blackmole, jpeg, cedric, woohyun Reviewed By: Jaehyun_Cho Differential Revision: https://phab.enlightenment.org/D5366
-rw-r--r--src/bin/elementary/test_popup.c361
1 files changed, 274 insertions, 87 deletions
diff --git a/src/bin/elementary/test_popup.c b/src/bin/elementary/test_popup.c
index c5c8904da7..3a16718571 100644
--- a/src/bin/elementary/test_popup.c
+++ b/src/bin/elementary/test_popup.c
@@ -941,6 +941,14 @@ test_popup(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
941 evas_object_show(win); 941 evas_object_show(win);
942} 942}
943 943
944typedef struct
945{
946 Evas_Object *win;
947 Evas_Object *panel_win;
948 Evas_Object *efl_ui_popup;
949 Evas_Object *button;
950} efl_ui_popup_data;
951
944static void 952static void
945_bg_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, 953_bg_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
946 void *event_info EINA_UNUSED) 954 void *event_info EINA_UNUSED)
@@ -949,165 +957,338 @@ _bg_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
949} 957}
950 958
951static void 959static void
952_image_change_btn_cb(void *data, Evas_Object *obj EINA_UNUSED, 960_timeout_cb(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
953 void *event_info EINA_UNUSED)
954{ 961{
955 static int k = 0; 962 efl_ui_popup_data *p_data = data;
963 p_data->efl_ui_popup = NULL;
964 printf("Popup times out and it is deleted.\n");
965}
966
967static void
968_delete_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
969 void *event_info EINA_UNUSED)
970{
971 efl_ui_popup_data *p_data = data;
972 if (p_data->efl_ui_popup)
973 {
974 evas_object_del(p_data->efl_ui_popup);
975 p_data->efl_ui_popup = NULL;
976 return;
977 }
978 printf("Efl.Ui.Popup is not exist.\n");
979}
980
981static Evas_Object*
982_create_popup(efl_ui_popup_data *p_data)
983{
984 if (!p_data->win) return NULL;
985 if (p_data->efl_ui_popup)
986 {
987 printf("Efl.Ui.Popup is already created.\n");
988 evas_object_show(p_data->efl_ui_popup);
989 return p_data->efl_ui_popup;
990 }
991
992 Evas_Object *efl_ui_popup = efl_add(EFL_UI_POPUP_CLASS, p_data->win);
993
994 evas_object_smart_callback_add(efl_ui_popup, "bg,clicked", _bg_clicked, NULL);
995 efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_EVENT_TIMEOUT, _timeout_cb, p_data);
996 evas_object_resize(efl_ui_popup, 160, 160);
997 evas_object_show(efl_ui_popup);
998
999 Evas_Object *btn = elm_button_add(efl_ui_popup);
1000 elm_object_text_set(btn, "Efl.Ui.Popup");
1001 evas_object_show(btn);
956 1002
1003 efl_content_set(efl_ui_popup, btn);
1004
1005 return efl_ui_popup;
1006}
1007
1008static void
1009_create_cb(void *data, Evas_Object *obj EINA_UNUSED,
1010 void *event_info EINA_UNUSED)
1011{
1012 efl_ui_popup_data *p_data = data;
1013 p_data->efl_ui_popup = _create_popup(p_data);
1014}
1015
1016static void
1017_bg_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
1018 void *event_info EINA_UNUSED)
1019{
1020 static int k = 0;
1021 efl_ui_popup_data *p_data = data;
1022 if (!p_data->efl_ui_popup) return;
957 if (k == 0) 1023 if (k == 0)
958 { 1024 {
959 char buf[PATH_MAX]; 1025 char buf[PATH_MAX];
960 snprintf(buf, sizeof(buf), "%s/images/logo.png", elm_app_data_dir_get()); 1026 snprintf(buf, sizeof(buf), "%s/images/sky_01.jpg", elm_app_data_dir_get());
961 efl_ui_popup_bg_set(data, buf, NULL); 1027 efl_ui_popup_bg_set(p_data->efl_ui_popup, buf, NULL);
962 efl_ui_popup_bg_repeat_events_set(data, EINA_TRUE); 1028 elm_object_text_set(obj, "Bg UnSet");
963 } 1029 }
964 else 1030 else
965 { 1031 {
966 efl_ui_popup_bg_set(data, NULL, NULL); 1032 efl_ui_popup_bg_set(p_data->efl_ui_popup, NULL, NULL);
967 efl_ui_popup_bg_repeat_events_set(data, EINA_FALSE); 1033 elm_object_text_set(obj, "Bg Set");
968 } 1034 }
969 k = !k; 1035 k = !k;
970} 1036}
971 1037
972static void 1038static void
973_center_align_cb(void *data, Evas_Object *obj EINA_UNUSED, 1039_repeat_event_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
1040 void *event_info EINA_UNUSED)
1041{
1042 efl_ui_popup_data *p_data = data;
1043 if (!p_data->efl_ui_popup) return;
1044 if (!efl_ui_popup_bg_repeat_events_get(p_data->efl_ui_popup))
1045 {
1046 efl_ui_popup_bg_repeat_events_set(p_data->efl_ui_popup, EINA_TRUE);
1047 elm_object_text_set(obj, "Repeat Event UnSet");
1048 }
1049 else
1050 {
1051 efl_ui_popup_bg_repeat_events_set(p_data->efl_ui_popup, EINA_FALSE);
1052 elm_object_text_set(obj, "Repeat Event Set");
1053 }
1054}
1055
1056static void
1057_repeat_test_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
1058 void *event_info EINA_UNUSED)
1059{
1060 printf("Repeat Test Button is Clicked.\n");
1061}
1062
1063static void
1064_dummy_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
1065 void *event_info EINA_UNUSED)
1066{
1067 efl_ui_popup_data *p_data = data;
1068 if (!p_data->efl_ui_popup) return;
1069 if (!evas_object_visible_get(p_data->button))
1070 {
1071 evas_object_show(p_data->button);
1072 elm_object_text_set(obj, "Hide Dummy Button");
1073 }
1074 else
1075 {
1076 evas_object_hide(p_data->button);
1077 elm_object_text_set(obj, "Show Dummy Button");
1078 }
1079}
1080
1081static void
1082_center_align_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
974 void *event_info EINA_UNUSED) 1083 void *event_info EINA_UNUSED)
975{ 1084{
976 efl_ui_popup_align_set(data, EFL_UI_POPUP_ALIGN_CENTER); 1085 efl_ui_popup_data *p_data = data;
1086 if (!p_data->efl_ui_popup) return;
1087 efl_ui_popup_align_set(p_data->efl_ui_popup, EFL_UI_POPUP_ALIGN_CENTER);
977} 1088}
978 1089
979static void 1090static void
980_left_align_cb(void *data, Evas_Object *obj EINA_UNUSED, 1091_left_align_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
981 void *event_info EINA_UNUSED) 1092 void *event_info EINA_UNUSED)
982{ 1093{
983 efl_ui_popup_align_set(data, EFL_UI_POPUP_ALIGN_LEFT); 1094 efl_ui_popup_data *p_data = data;
1095 if (!p_data->efl_ui_popup) return;
1096 efl_ui_popup_align_set(p_data->efl_ui_popup, EFL_UI_POPUP_ALIGN_LEFT);
984} 1097}
985 1098
986static void 1099static void
987_right_align_cb(void *data, Evas_Object *obj EINA_UNUSED, 1100_right_align_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
988 void *event_info EINA_UNUSED) 1101 void *event_info EINA_UNUSED)
989{ 1102{
990 efl_ui_popup_align_set(data, EFL_UI_POPUP_ALIGN_RIGHT); 1103 efl_ui_popup_data *p_data = data;
1104 if (!p_data->efl_ui_popup) return;
1105 efl_ui_popup_align_set(p_data->efl_ui_popup, EFL_UI_POPUP_ALIGN_RIGHT);
991} 1106}
992 1107
993static void 1108static void
994_top_align_cb(void *data, Evas_Object *obj EINA_UNUSED, 1109_top_align_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
995 void *event_info EINA_UNUSED) 1110 void *event_info EINA_UNUSED)
996{ 1111{
997 efl_ui_popup_align_set(data, EFL_UI_POPUP_ALIGN_TOP); 1112 efl_ui_popup_data *p_data = data;
1113 if (!p_data->efl_ui_popup) return;
1114 efl_ui_popup_align_set(p_data->efl_ui_popup, EFL_UI_POPUP_ALIGN_TOP);
998} 1115}
999 1116
1000static void 1117static void
1001_bottom_align_cb(void *data, Evas_Object *obj EINA_UNUSED, 1118_bottom_align_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
1002 void *event_info EINA_UNUSED) 1119 void *event_info EINA_UNUSED)
1003{ 1120{
1004 efl_ui_popup_align_set(data, EFL_UI_POPUP_ALIGN_BOTTOM); 1121 efl_ui_popup_data *p_data = data;
1122 if (!p_data->efl_ui_popup) return;
1123 efl_ui_popup_align_set(p_data->efl_ui_popup, EFL_UI_POPUP_ALIGN_BOTTOM);
1005} 1124}
1006 1125
1007static void 1126static void
1008_position_set_cb(void *data, Evas_Object *obj EINA_UNUSED, 1127_position_set_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
1009 void *event_info EINA_UNUSED) 1128 void *event_info EINA_UNUSED)
1010{ 1129{
1011 evas_object_move(data, 0, 0); 1130 efl_ui_popup_data *p_data = data;
1131 if (!p_data->efl_ui_popup) return;
1132 evas_object_move(p_data->efl_ui_popup, 0, 0);
1012} 1133}
1013 1134
1014static void 1135static void
1015_timeout_set_cb(void *data, Evas_Object *obj EINA_UNUSED, 1136_timeout_set_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
1016 void *event_info EINA_UNUSED) 1137 void *event_info EINA_UNUSED)
1017{ 1138{
1018 efl_ui_popup_timeout_set(data, 3); 1139 efl_ui_popup_data *p_data = data;
1140 if (!p_data->efl_ui_popup) return;
1141 efl_ui_popup_timeout_set(p_data->efl_ui_popup, 3);
1019 printf("timemout is set to 3 seconds\n"); 1142 printf("timemout is set to 3 seconds\n");
1020} 1143}
1021 1144
1145static void
1146_win_del(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1147{
1148 efl_ui_popup_data *p_data = data;
1149 evas_object_del(p_data->panel_win);
1150 free(p_data);
1151 printf("window is deleted\n");
1152}
1153
1154static void
1155_panel_win_del(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1156{
1157 efl_ui_popup_data *p_data = data;
1158 evas_object_del(p_data->win);
1159 free(p_data);
1160 printf("window is deleted\n");
1161}
1162
1022void 1163void
1023test_efl_ui_popup(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 1164test_efl_ui_popup(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1024{ 1165{
1025 Evas_Object *win, *btn; 1166 efl_ui_popup_data *p_data = (efl_ui_popup_data*)calloc(1, sizeof(efl_ui_popup_data));
1167
1168 Evas_Object *win, *panel_win;
1026 1169
1027 win = elm_win_util_standard_add("Efl UI Popup", "Efl UI Popup"); 1170 win = elm_win_util_standard_add("Efl UI Popup", "Efl UI Popup");
1028 elm_win_autodel_set(win, EINA_TRUE); 1171 elm_win_autodel_set(win, EINA_TRUE);
1172 evas_object_smart_callback_add(win, "delete,request", _win_del, p_data);
1029 1173
1030 evas_object_resize(win, 500, 500); 1174 evas_object_resize(win, 500, 500);
1031 evas_object_show(win); 1175 evas_object_show(win);
1032 1176
1033 btn = elm_button_add(win); 1177 panel_win = elm_win_util_standard_add("Efl UI Popup Panel", "Efl UI Popup Panel");
1034 elm_object_text_set(btn, "bg repeat events test"); 1178 elm_win_autodel_set(panel_win, EINA_TRUE);
1035 evas_object_move(btn, 0, 0); 1179 evas_object_smart_callback_add(panel_win, "delete,request", _panel_win_del, p_data);
1036 evas_object_resize(btn, 150, 150); 1180
1037 evas_object_show(btn); 1181 evas_object_resize(panel_win, 300, 500);
1038 1182 evas_object_show(panel_win);
1039 Evas_Object *efl_ui_popup= efl_add(EFL_UI_POPUP_CLASS, win); 1183
1184 Evas_Object *repeat_test_btn;
1185 repeat_test_btn = elm_button_add(win);
1186 evas_object_move(repeat_test_btn, 0, 0);
1187 evas_object_resize(repeat_test_btn, 100, 100);
1188 elm_object_text_set(repeat_test_btn, "Repeat Event Test");
1189 evas_object_smart_callback_add(repeat_test_btn, "clicked", _repeat_test_cb, NULL);
1190 evas_object_hide(repeat_test_btn);
1191
1192 p_data->win = win;
1193 p_data->panel_win = panel_win;
1194 p_data->button = repeat_test_btn;
1195 p_data->efl_ui_popup = _create_popup(p_data);
1196
1197 Evas_Object *create_btn;
1198 create_btn = elm_button_add(panel_win);
1199 elm_object_text_set(create_btn, "Create Popup");
1200 evas_object_move(create_btn, 0, 0);
1201 evas_object_resize(create_btn, 150, 50);
1202 evas_object_show(create_btn);
1203 evas_object_smart_callback_add(create_btn, "clicked", _create_cb, p_data);
1204
1205 Evas_Object *delete_btn;
1206 delete_btn = elm_button_add(panel_win);
1207 elm_object_text_set(delete_btn, "Delete Popup");
1208 evas_object_move(delete_btn, 150, 0);
1209 evas_object_resize(delete_btn, 150, 50);
1210 evas_object_show(delete_btn);
1211 evas_object_smart_callback_add(delete_btn, "clicked", _delete_cb, p_data);
1212
1213 Evas_Object *repeat_event_btn;
1214 repeat_event_btn = elm_button_add(panel_win);
1215 elm_object_text_set(repeat_event_btn, "Repeat Event Set");
1216 evas_object_move(repeat_event_btn, 0, 50);
1217 evas_object_resize(repeat_event_btn, 150, 50);
1218 evas_object_show(repeat_event_btn);
1219 evas_object_smart_callback_add(repeat_event_btn, "clicked", _repeat_event_cb, p_data);
1220
1221 Evas_Object *dummy_btn;
1222 dummy_btn = elm_button_add(panel_win);
1223 elm_object_text_set(dummy_btn, "Show Dummy Button");
1224 evas_object_move(dummy_btn, 150, 50);
1225 evas_object_resize(dummy_btn, 150, 50);
1226 evas_object_show(dummy_btn);
1227 evas_object_smart_callback_add(dummy_btn, "clicked", _dummy_cb, p_data);
1228
1229 Evas_Object *bg_btn;
1230 bg_btn = elm_button_add(panel_win);
1231 evas_object_move(bg_btn, 0, 100);
1232 evas_object_resize(bg_btn, 150, 50);
1233 elm_object_text_set(bg_btn, "Bg Set");
1234 evas_object_show(bg_btn);
1235 evas_object_smart_callback_add(bg_btn, "clicked", _bg_cb, p_data);
1040 1236
1041 evas_object_smart_callback_add(efl_ui_popup, "bg,clicked", _bg_clicked, NULL); 1237 Evas_Object *timeout_btn;
1042 evas_object_resize(efl_ui_popup, 160, 160); 1238 timeout_btn = elm_button_add(panel_win);
1043 evas_object_show(efl_ui_popup); 1239 elm_object_text_set(timeout_btn, "Timeout Set");
1044 1240 evas_object_move(timeout_btn, 150, 100);
1045 int x, y, w, h; 1241 evas_object_resize(timeout_btn, 150, 50);
1046 evas_object_geometry_get(efl_ui_popup, &x, &y, &w, &h); 1242 evas_object_show(timeout_btn);
1047 printf("efl_ui_popup: %d %d %d %d\n", x, y, w, h); 1243 evas_object_smart_callback_add(timeout_btn, "clicked", _timeout_set_cb, p_data);
1048
1049 btn = elm_button_add(efl_ui_popup);
1050 elm_object_text_set(btn, "Efl.Ui.Popup content");
1051 evas_object_smart_callback_add(btn, "clicked", _image_change_btn_cb, efl_ui_popup);
1052 evas_object_show(btn);
1053 1244
1054 Evas_Object *center_btn; 1245 Evas_Object *center_btn;
1055 center_btn = elm_button_add(win); 1246 center_btn = elm_button_add(panel_win);
1056 elm_object_text_set(center_btn, "Center Align"); 1247 elm_object_text_set(center_btn, "Center Align");
1057 evas_object_move(center_btn, 0, 300); 1248 evas_object_move(center_btn, 0, 150);
1058 evas_object_resize(center_btn, 100, 50); 1249 evas_object_resize(center_btn, 150, 50);
1059 evas_object_show(center_btn); 1250 evas_object_show(center_btn);
1060 evas_object_smart_callback_add(center_btn, "clicked", _center_align_cb, efl_ui_popup); 1251 evas_object_smart_callback_add(center_btn, "clicked", _center_align_cb, p_data);
1252
1253 Evas_Object *top_btn;
1254 top_btn = elm_button_add(panel_win);
1255 elm_object_text_set(top_btn, "Top Align");
1256 evas_object_move(top_btn, 150, 150);
1257 evas_object_resize(top_btn, 150, 50);
1258 evas_object_show(top_btn);
1259 evas_object_smart_callback_add(top_btn, "clicked", _top_align_cb, p_data);
1061 1260
1062 Evas_Object *left_btn; 1261 Evas_Object *left_btn;
1063 left_btn = elm_button_add(win); 1262 left_btn = elm_button_add(panel_win);
1064 elm_object_text_set(left_btn, "Left Align"); 1263 elm_object_text_set(left_btn, "Left Align");
1065 evas_object_move(left_btn, 100, 300); 1264 evas_object_move(left_btn, 0, 200);
1066 evas_object_resize(left_btn, 100, 50); 1265 evas_object_resize(left_btn, 150, 50);
1067 evas_object_show(left_btn); 1266 evas_object_show(left_btn);
1068 evas_object_smart_callback_add(left_btn, "clicked", _left_align_cb, efl_ui_popup); 1267 evas_object_smart_callback_add(left_btn, "clicked", _left_align_cb, p_data);
1069 1268
1070 Evas_Object *right_btn; 1269 Evas_Object *right_btn;
1071 right_btn = elm_button_add(win); 1270 right_btn = elm_button_add(panel_win);
1072 elm_object_text_set(right_btn, "Right Align"); 1271 elm_object_text_set(right_btn, "Right Align");
1073 evas_object_move(right_btn, 200, 300); 1272 evas_object_move(right_btn, 150, 200);
1074 evas_object_resize(right_btn, 100, 50); 1273 evas_object_resize(right_btn, 150, 50);
1075 evas_object_show(right_btn); 1274 evas_object_show(right_btn);
1076 evas_object_smart_callback_add(right_btn, "clicked", _right_align_cb, efl_ui_popup); 1275 evas_object_smart_callback_add(right_btn, "clicked", _right_align_cb, p_data);
1077
1078 Evas_Object *top_btn;
1079 top_btn = elm_button_add(win);
1080 elm_object_text_set(top_btn, "Top Align");
1081 evas_object_move(top_btn, 0, 350);
1082 evas_object_resize(top_btn, 100, 50);
1083 evas_object_show(top_btn);
1084 evas_object_smart_callback_add(top_btn, "clicked", _top_align_cb, efl_ui_popup);
1085 1276
1086 Evas_Object *bottom_btn; 1277 Evas_Object *bottom_btn;
1087 bottom_btn = elm_button_add(win); 1278 bottom_btn = elm_button_add(panel_win);
1088 elm_object_text_set(bottom_btn, "Bottom Align"); 1279 elm_object_text_set(bottom_btn, "Bottom Align");
1089 evas_object_move(bottom_btn, 100, 350); 1280 evas_object_move(bottom_btn, 0, 250);
1090 evas_object_resize(bottom_btn, 100, 50); 1281 evas_object_resize(bottom_btn, 150, 50);
1091 evas_object_show(bottom_btn); 1282 evas_object_show(bottom_btn);
1092 evas_object_smart_callback_add(bottom_btn, "clicked", _bottom_align_cb, efl_ui_popup); 1283 evas_object_smart_callback_add(bottom_btn, "clicked", _bottom_align_cb, p_data);
1093 1284
1094 Evas_Object *position_btn; 1285 Evas_Object *position_btn;
1095 position_btn = elm_button_add(win); 1286 position_btn = elm_button_add(panel_win);
1096 elm_object_text_set(position_btn, "Position Set"); 1287 elm_object_text_set(position_btn, "Position Set (x:0, y:0)");
1097 evas_object_move(position_btn, 200, 350); 1288 evas_object_move(position_btn, 150, 250);
1098 evas_object_resize(position_btn, 100, 50); 1289 evas_object_resize(position_btn, 150, 50);
1099 evas_object_show(position_btn); 1290 evas_object_show(position_btn);
1100 evas_object_smart_callback_add(position_btn, "clicked", _position_set_cb, efl_ui_popup); 1291 evas_object_smart_callback_add(position_btn, "clicked", _position_set_cb, p_data);
1101
1102 Evas_Object *timeout_btn;
1103 timeout_btn = elm_button_add(win);
1104 elm_object_text_set(timeout_btn, "Timeout Set");
1105 evas_object_move(timeout_btn, 0, 400);
1106 evas_object_resize(timeout_btn, 100, 50);
1107 evas_object_show(timeout_btn);
1108 evas_object_smart_callback_add(timeout_btn, "clicked", _timeout_set_cb, efl_ui_popup);
1109
1110 efl_content_set(efl_ui_popup, btn);
1111} 1292}
1112 1293
1113static void 1294static void
@@ -1241,11 +1422,14 @@ _anchor_unset_cb(void *data, Evas_Object *obj EINA_UNUSED,
1241void 1422void
1242test_efl_ui_popup_anchor(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 1423test_efl_ui_popup_anchor(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1243{ 1424{
1425 efl_ui_popup_data *p_data = (efl_ui_popup_data*)calloc(1, sizeof(efl_ui_popup_data));
1426
1244 Evas_Object *win, *layout, *tbl, *btn; 1427 Evas_Object *win, *layout, *tbl, *btn;
1245 char buf[PATH_MAX]; 1428 char buf[PATH_MAX];
1246 1429
1247 win = elm_win_util_standard_add("Efl UI Popup Anchor", "Efl UI Popup Anchor"); 1430 win = elm_win_util_standard_add("Efl UI Popup Anchor", "Efl UI Popup Anchor");
1248 elm_win_autodel_set(win, EINA_TRUE); 1431 elm_win_autodel_set(win, EINA_TRUE);
1432 evas_object_smart_callback_add(win, "delete,request", _win_del, p_data);
1249 1433
1250 evas_object_resize(win, 500, 500); 1434 evas_object_resize(win, 500, 500);
1251 evas_object_show(win); 1435 evas_object_show(win);
@@ -1272,6 +1456,9 @@ test_efl_ui_popup_anchor(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, v
1272 evas_object_resize(efl_ui_popup, 160, 120); 1456 evas_object_resize(efl_ui_popup, 160, 120);
1273 evas_object_show(efl_ui_popup); 1457 evas_object_show(efl_ui_popup);
1274 1458
1459 p_data->win = win;
1460 p_data->efl_ui_popup = efl_ui_popup;
1461
1275 for (int i = 0; i < 6; i++) 1462 for (int i = 0; i < 6; i++)
1276 { 1463 {
1277 btn = elm_button_add(win); 1464 btn = elm_button_add(win);
@@ -1296,42 +1483,42 @@ test_efl_ui_popup_anchor(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, v
1296 btn = elm_button_add(efl_ui_popup); 1483 btn = elm_button_add(efl_ui_popup);
1297 elm_object_text_set(btn, "Center Align"); 1484 elm_object_text_set(btn, "Center Align");
1298 evas_object_size_hint_min_set(btn, 70, 35); 1485 evas_object_size_hint_min_set(btn, 70, 35);
1299 evas_object_smart_callback_add(btn, "clicked", _center_align_cb, efl_ui_popup); 1486 evas_object_smart_callback_add(btn, "clicked", _center_align_cb, p_data);
1300 elm_table_pack(tbl, btn, 0, 0, 1, 1); 1487 elm_table_pack(tbl, btn, 0, 0, 1, 1);
1301 evas_object_show(btn); 1488 evas_object_show(btn);
1302 1489
1303 btn = elm_button_add(efl_ui_popup); 1490 btn = elm_button_add(efl_ui_popup);
1304 elm_object_text_set(btn, "Left Align"); 1491 elm_object_text_set(btn, "Left Align");
1305 evas_object_size_hint_min_set(btn, 70, 35); 1492 evas_object_size_hint_min_set(btn, 70, 35);
1306 evas_object_smart_callback_add(btn, "clicked", _left_align_cb, efl_ui_popup); 1493 evas_object_smart_callback_add(btn, "clicked", _left_align_cb, p_data);
1307 elm_table_pack(tbl, btn, 1, 0, 1, 1); 1494 elm_table_pack(tbl, btn, 1, 0, 1, 1);
1308 evas_object_show(btn); 1495 evas_object_show(btn);
1309 1496
1310 btn = elm_button_add(efl_ui_popup); 1497 btn = elm_button_add(efl_ui_popup);
1311 elm_object_text_set(btn, "Right Align"); 1498 elm_object_text_set(btn, "Right Align");
1312 evas_object_size_hint_min_set(btn, 70, 35); 1499 evas_object_size_hint_min_set(btn, 70, 35);
1313 evas_object_smart_callback_add(btn, "clicked", _right_align_cb, efl_ui_popup); 1500 evas_object_smart_callback_add(btn, "clicked", _right_align_cb, p_data);
1314 elm_table_pack(tbl, btn, 2, 0, 1, 1); 1501 elm_table_pack(tbl, btn, 2, 0, 1, 1);
1315 evas_object_show(btn); 1502 evas_object_show(btn);
1316 1503
1317 btn = elm_button_add(efl_ui_popup); 1504 btn = elm_button_add(efl_ui_popup);
1318 elm_object_text_set(btn, "Top Align"); 1505 elm_object_text_set(btn, "Top Align");
1319 evas_object_size_hint_min_set(btn, 70, 35); 1506 evas_object_size_hint_min_set(btn, 70, 35);
1320 evas_object_smart_callback_add(btn, "clicked", _top_align_cb, efl_ui_popup); 1507 evas_object_smart_callback_add(btn, "clicked", _top_align_cb, p_data);
1321 elm_table_pack(tbl, btn, 0, 1, 1, 1); 1508 elm_table_pack(tbl, btn, 0, 1, 1, 1);
1322 evas_object_show(btn); 1509 evas_object_show(btn);
1323 1510
1324 btn = elm_button_add(efl_ui_popup); 1511 btn = elm_button_add(efl_ui_popup);
1325 elm_object_text_set(btn, "Bottom Align"); 1512 elm_object_text_set(btn, "Bottom Align");
1326 evas_object_size_hint_min_set(btn, 70, 35); 1513 evas_object_size_hint_min_set(btn, 70, 35);
1327 evas_object_smart_callback_add(btn, "clicked", _bottom_align_cb, efl_ui_popup); 1514 evas_object_smart_callback_add(btn, "clicked", _bottom_align_cb, p_data);
1328 elm_table_pack(tbl, btn, 1, 1, 1, 1); 1515 elm_table_pack(tbl, btn, 1, 1, 1, 1);
1329 evas_object_show(btn); 1516 evas_object_show(btn);
1330 1517
1331 btn = elm_button_add(efl_ui_popup); 1518 btn = elm_button_add(efl_ui_popup);
1332 elm_object_text_set(btn, "Position Set"); 1519 elm_object_text_set(btn, "Position Set");
1333 evas_object_size_hint_min_set(btn, 70, 35); 1520 evas_object_size_hint_min_set(btn, 70, 35);
1334 evas_object_smart_callback_add(btn, "clicked", _position_set_cb, efl_ui_popup); 1521 evas_object_smart_callback_add(btn, "clicked", _position_set_cb, p_data);
1335 elm_table_pack(tbl, btn, 2, 1, 1, 1); 1522 elm_table_pack(tbl, btn, 2, 1, 1, 1);
1336 evas_object_show(btn); 1523 evas_object_show(btn);
1337 1524