diff options
author | JEONGHYUN YUN <jh0506.yun@samsung.com> | 2017-08-10 14:13:51 +0900 |
---|---|---|
committer | Jean-Philippe Andre <jp.andre@samsung.com> | 2017-08-10 14:42:08 +0900 |
commit | 8546ff727f9ee60ac0a662611d606e0d608e8c3d (patch) | |
tree | 2f6bbb41a7d48fd4d2588c92fc1d4a5bfd627b72 /src/bin | |
parent | bf0b3e0b75f5c6ebc5cb96211b3b21235422e358 (diff) | |
download | efl-8546ff727f9ee60ac0a662611d606e0d608e8c3d.tar.gz |
elm_ctxpopup: Implemented elm_widget_item_part_content_unset for elm_ctxpopup_item
Summary:
ctxpopup item have elm_list item internally.
item_part_content_unset need to pass on content part to elm_list item.
Test Plan:
1. launch elementary_test - ctxpopup
2. click Ctxpopup with part text & content function
3. press "Icon Set" and press "Icon Unset"
Reviewers: jpeg, woohyun, herb, Blackmole
Subscribers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D5018
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/elementary/test_ctxpopup.c | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/src/bin/elementary/test_ctxpopup.c b/src/bin/elementary/test_ctxpopup.c index 9fc3de3d39..8fc85f8f5d 100644 --- a/src/bin/elementary/test_ctxpopup.c +++ b/src/bin/elementary/test_ctxpopup.c @@ -374,6 +374,69 @@ _list_item_cb8(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_U } static void +_ctxpopup_item_select_cb(void *data, Evas_Object *obj, void *event_info) +{ + const char *text = NULL; + Evas_Object *icon = NULL; + Elm_Object_Item *it = (Elm_Object_Item *)data; + + text = elm_object_item_part_text_get((Elm_Object_Item *)event_info, "default"); + + if (!strcmp(text, "Text NULL")) + { + elm_object_item_part_text_set(it, "default", NULL); + } + else if (!strcmp(text, "Text Set")) + { + elm_object_item_part_text_set(it, "default", "Save file"); + } + else if (!strcmp(text, "Icon NULL")) + { + elm_object_item_part_content_set(it, "icon", NULL); + } + else if (!strcmp(text, "Icon Set")) + { + icon = elm_icon_add(obj); + elm_icon_standard_set(icon, "file"); + elm_image_resizable_set(icon, EINA_FALSE, EINA_FALSE); + + elm_object_item_part_content_set(it, "icon", icon); + } + else + { + icon = elm_object_item_part_content_unset(it, "icon"); + if (icon) evas_object_del(icon); + } +} + +static void +_list_item_cb9(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + Evas_Object *ctxpopup; + Elm_Object_Item *it = NULL; + Evas_Coord x,y; + + if (list_mouse_down > 0) return; + + ctxpopup = elm_ctxpopup_add(obj); + evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL); + evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL); + + it = elm_ctxpopup_item_append(ctxpopup, NULL, NULL, _ctxpopup_item_cb, NULL); + elm_ctxpopup_item_append(ctxpopup, "Text NULL", NULL, _ctxpopup_item_select_cb, it); + elm_ctxpopup_item_append(ctxpopup, "Text Set", NULL, _ctxpopup_item_select_cb, it); + elm_ctxpopup_item_append(ctxpopup, "Icon NULL", NULL, _ctxpopup_item_select_cb, it); + elm_ctxpopup_item_append(ctxpopup, "Icon Set", NULL, _ctxpopup_item_select_cb, it); + elm_ctxpopup_item_append(ctxpopup, "Icon Unset", NULL, _ctxpopup_item_select_cb, it); + + evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y); + evas_object_size_hint_max_set(ctxpopup, 240, 240); + evas_object_move(ctxpopup, x, y); + evas_object_show(ctxpopup); + _print_current_dir(ctxpopup); +} + +static void _list_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) { elm_list_item_selected_set(event_info, EINA_FALSE); @@ -432,6 +495,8 @@ test_ctxpopup(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_ _list_item_cb7, NULL); elm_list_item_append(list, "Ctxpopup with auto hide disabled mode", NULL, NULL, _list_item_cb8, NULL); + elm_list_item_append(list, "Ctxpopup with part text & content function", NULL, NULL, + _list_item_cb9, NULL); evas_object_show(list); elm_list_go(list); |