summaryrefslogtreecommitdiff
path: root/src/bin/elementary
diff options
context:
space:
mode:
authorJinYong Park <j4939.park@samsung.com>2017-09-20 19:36:39 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-11-28 17:15:42 +0900
commitc8c7ac8aae0574ad0c6ad56f284c119dfd2709df (patch)
tree01f79ccba9a0e1974308360cb326e7af2faba06c /src/bin/elementary
parenta7082df12b9d72880e308be4c81152de596ee028 (diff)
efl_ui_popup_anchor: add Efl.Ui.Popup.Anchor class
Summary: Add initial code for Efl.Ui.Popup.Anchor class. It supports adding anchor object to popup. Test Plan: 1. run elementary_test -to efluipopupanchor Reviewers: Jaehyun_Cho, thiepha, herb, jpeg, cedric, woohyun Reviewed By: Jaehyun_Cho Differential Revision: https://phab.enlightenment.org/D5126
Diffstat (limited to 'src/bin/elementary')
-rw-r--r--src/bin/elementary/test.c2
-rw-r--r--src/bin/elementary/test_popup.c116
2 files changed, 118 insertions, 0 deletions
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index f5666e52ff..ae576feec8 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -278,6 +278,7 @@ void test_efl_ui_popup(void *data, Evas_Object *obj, void *event_info);
278void test_efl_ui_popup_alert(void *data, Evas_Object *obj, void *event_info); 278void test_efl_ui_popup_alert(void *data, Evas_Object *obj, void *event_info);
279void test_efl_ui_popup_alert_scroll(void *data, Evas_Object *obj, void *event_info); 279void test_efl_ui_popup_alert_scroll(void *data, Evas_Object *obj, void *event_info);
280void test_efl_ui_popup_alert_text(void *data, Evas_Object *obj, void *event_info); 280void test_efl_ui_popup_alert_text(void *data, Evas_Object *obj, void *event_info);
281void test_efl_ui_popup_anchor(void *data, Evas_Object *obj, void *event_info);
281void test_dayselector(void *data, Evas_Object *obj, void *event_info); 282void test_dayselector(void *data, Evas_Object *obj, void *event_info);
282void test_image(void *data, Evas_Object *obj, void *event_info); 283void test_image(void *data, Evas_Object *obj, void *event_info);
283void test_image_scale_type(void *data, Evas_Object *obj, void *event_info); 284void test_image_scale_type(void *data, Evas_Object *obj, void *event_info);
@@ -1050,6 +1051,7 @@ add_tests:
1050 ADD_TEST(NULL, "Popups", "Efl UI Popup Alert", test_efl_ui_popup_alert); 1051 ADD_TEST(NULL, "Popups", "Efl UI Popup Alert", test_efl_ui_popup_alert);
1051 ADD_TEST(NULL, "Popups", "Efl UI Popup Alert Scroll", test_efl_ui_popup_alert_scroll); 1052 ADD_TEST(NULL, "Popups", "Efl UI Popup Alert Scroll", test_efl_ui_popup_alert_scroll);
1052 ADD_TEST(NULL, "Popups", "Efl UI Popup Alert Text", test_efl_ui_popup_alert_text); 1053 ADD_TEST(NULL, "Popups", "Efl UI Popup Alert Text", test_efl_ui_popup_alert_text);
1054 ADD_TEST(NULL, "Popups", "Efl UI Popup Anchor", test_efl_ui_popup_anchor);
1053 1055
1054 //------------------------------// 1056 //------------------------------//
1055 ADD_TEST(NULL, "Times & Dates", "Calendar", test_calendar); 1057 ADD_TEST(NULL, "Times & Dates", "Calendar", test_calendar);
diff --git a/src/bin/elementary/test_popup.c b/src/bin/elementary/test_popup.c
index 2bb6edea45..701cd178b5 100644
--- a/src/bin/elementary/test_popup.c
+++ b/src/bin/elementary/test_popup.c
@@ -1,6 +1,8 @@
1#ifdef HAVE_CONFIG_H 1#ifdef HAVE_CONFIG_H
2# include "elementary_config.h" 2# include "elementary_config.h"
3#endif 3#endif
4
5#define EFL_UI_POPUP_ANCHOR_BETA
4#include <Elementary.h> 6#include <Elementary.h>
5 7
6#define POPUP_POINT_MAX 8 8#define POPUP_POINT_MAX 8
@@ -1205,3 +1207,117 @@ test_efl_ui_popup_alert_text(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
1205 1207
1206 efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL); 1208 efl_event_callback_add(efl_ui_popup, EFL_UI_POPUP_ALERT_EVENT_CLICKED, efl_ui_popup_alert_clicked_cb, NULL);
1207} 1209}
1210
1211static void
1212_anchor_set_cb(void *data, Evas_Object *obj EINA_UNUSED,
1213 void *event_info EINA_UNUSED)
1214{
1215 efl_ui_popup_anchor_set(data, obj);
1216}
1217
1218static void
1219_anchor_unset_cb(void *data, Evas_Object *obj EINA_UNUSED,
1220 void *event_info EINA_UNUSED)
1221{
1222 efl_ui_popup_anchor_set(data, NULL);
1223}
1224
1225void
1226test_efl_ui_popup_anchor(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
1227{
1228 Evas_Object *win, *layout, *tbl, *btn;
1229 char buf[PATH_MAX];
1230
1231 win = elm_win_util_standard_add("Efl UI AnchorPopup", "Efl UI AnchorPopup");
1232 elm_win_autodel_set(win, EINA_TRUE);
1233
1234 evas_object_resize(win, 500, 500);
1235 evas_object_show(win);
1236
1237 layout = elm_layout_add(win);
1238 snprintf(buf, sizeof(buf), "%s/objects/test.edj", elm_app_data_dir_get());
1239 elm_layout_file_set(layout, buf, "efl_ui_popup_anchor_layout");
1240 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1241 elm_win_resize_object_add(win, layout);
1242 evas_object_show(layout);
1243
1244 Evas_Object *efl_ui_popup= efl_add(EFL_UI_POPUP_ANCHOR_CLASS, win);
1245
1246 efl_ui_popup_bg_repeat_events_set(efl_ui_popup, EINA_TRUE);
1247
1248 //Default align priority order is top, left, right, bottom, center.
1249 efl_ui_popup_anchor_align_priority_set(efl_ui_popup, EFL_UI_POPUP_ALIGN_TOP,
1250 EFL_UI_POPUP_ALIGN_BOTTOM,
1251 EFL_UI_POPUP_ALIGN_LEFT,
1252 EFL_UI_POPUP_ALIGN_RIGHT,
1253 EFL_UI_POPUP_ALIGN_CENTER);
1254
1255 evas_object_move(efl_ui_popup, 80, 80);
1256 evas_object_resize(efl_ui_popup, 160, 120);
1257 evas_object_show(efl_ui_popup);
1258
1259 for (int i = 0; i < 6; i++)
1260 {
1261 btn = elm_button_add(win);
1262 elm_object_text_set(btn, "anchor");
1263 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1264 evas_object_smart_callback_add(btn, "clicked", _anchor_set_cb, efl_ui_popup);
1265
1266 snprintf(buf, sizeof(buf), "anchor%d", i+1);
1267 elm_object_part_content_set(layout, buf, btn);
1268 }
1269
1270 btn = elm_button_add(win);
1271 elm_object_text_set(btn, "anchor none");
1272 evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1273 evas_object_smart_callback_add(btn, "clicked", _anchor_unset_cb, efl_ui_popup);
1274 elm_object_part_content_set(layout, "anchor_none", btn);
1275
1276 tbl = elm_table_add(efl_ui_popup);
1277 evas_object_size_hint_weight_set(tbl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1278 evas_object_size_hint_align_set(tbl, EVAS_HINT_FILL, EVAS_HINT_FILL);
1279
1280 btn = elm_button_add(efl_ui_popup);
1281 elm_object_text_set(btn, "Center Align");
1282 evas_object_size_hint_min_set(btn, 70, 35);
1283 evas_object_smart_callback_add(btn, "clicked", _center_align_cb, efl_ui_popup);
1284 elm_table_pack(tbl, btn, 0, 0, 1, 1);
1285 evas_object_show(btn);
1286
1287 btn = elm_button_add(efl_ui_popup);
1288 elm_object_text_set(btn, "Left Align");
1289 evas_object_size_hint_min_set(btn, 70, 35);
1290 evas_object_smart_callback_add(btn, "clicked", _left_align_cb, efl_ui_popup);
1291 elm_table_pack(tbl, btn, 1, 0, 1, 1);
1292 evas_object_show(btn);
1293
1294 btn = elm_button_add(efl_ui_popup);
1295 elm_object_text_set(btn, "Right Align");
1296 evas_object_size_hint_min_set(btn, 70, 35);
1297 evas_object_smart_callback_add(btn, "clicked", _right_align_cb, efl_ui_popup);
1298 elm_table_pack(tbl, btn, 2, 0, 1, 1);
1299 evas_object_show(btn);
1300
1301 btn = elm_button_add(efl_ui_popup);
1302 elm_object_text_set(btn, "Top Align");
1303 evas_object_size_hint_min_set(btn, 70, 35);
1304 evas_object_smart_callback_add(btn, "clicked", _top_align_cb, efl_ui_popup);
1305 elm_table_pack(tbl, btn, 0, 1, 1, 1);
1306 evas_object_show(btn);
1307
1308 btn = elm_button_add(efl_ui_popup);
1309 elm_object_text_set(btn, "Bottom Align");
1310 evas_object_size_hint_min_set(btn, 70, 35);
1311 evas_object_smart_callback_add(btn, "clicked", _bottom_align_cb, efl_ui_popup);
1312 elm_table_pack(tbl, btn, 1, 1, 1, 1);
1313 evas_object_show(btn);
1314
1315 btn = elm_button_add(efl_ui_popup);
1316 elm_object_text_set(btn, "Position Set");
1317 evas_object_size_hint_min_set(btn, 70, 35);
1318 evas_object_smart_callback_add(btn, "clicked", _position_set_cb, efl_ui_popup);
1319 elm_table_pack(tbl, btn, 2, 1, 1, 1);
1320 evas_object_show(btn);
1321
1322 efl_content_set(efl_ui_popup, tbl);
1323}