summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJEONGHYUN YUN <jh0506.yun@samsung.com>2017-08-10 14:13:51 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-08-10 14:42:08 +0900
commit8546ff727f9ee60ac0a662611d606e0d608e8c3d (patch)
tree2f6bbb41a7d48fd4d2588c92fc1d4a5bfd627b72
parentbf0b3e0b75f5c6ebc5cb96211b3b21235422e358 (diff)
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
-rw-r--r--src/bin/elementary/test_ctxpopup.c65
-rw-r--r--src/lib/elementary/elc_ctxpopup.c25
-rw-r--r--src/lib/elementary/elm_ctxpopup_item.eo1
3 files changed, 91 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
374} 374}
375 375
376static void 376static void
377_ctxpopup_item_select_cb(void *data, Evas_Object *obj, void *event_info)
378{
379 const char *text = NULL;
380 Evas_Object *icon = NULL;
381 Elm_Object_Item *it = (Elm_Object_Item *)data;
382
383 text = elm_object_item_part_text_get((Elm_Object_Item *)event_info, "default");
384
385 if (!strcmp(text, "Text NULL"))
386 {
387 elm_object_item_part_text_set(it, "default", NULL);
388 }
389 else if (!strcmp(text, "Text Set"))
390 {
391 elm_object_item_part_text_set(it, "default", "Save file");
392 }
393 else if (!strcmp(text, "Icon NULL"))
394 {
395 elm_object_item_part_content_set(it, "icon", NULL);
396 }
397 else if (!strcmp(text, "Icon Set"))
398 {
399 icon = elm_icon_add(obj);
400 elm_icon_standard_set(icon, "file");
401 elm_image_resizable_set(icon, EINA_FALSE, EINA_FALSE);
402
403 elm_object_item_part_content_set(it, "icon", icon);
404 }
405 else
406 {
407 icon = elm_object_item_part_content_unset(it, "icon");
408 if (icon) evas_object_del(icon);
409 }
410}
411
412static void
413_list_item_cb9(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
414{
415 Evas_Object *ctxpopup;
416 Elm_Object_Item *it = NULL;
417 Evas_Coord x,y;
418
419 if (list_mouse_down > 0) return;
420
421 ctxpopup = elm_ctxpopup_add(obj);
422 evas_object_smart_callback_add(ctxpopup, "dismissed", _dismissed, NULL);
423 evas_object_smart_callback_add(ctxpopup, "geometry,update", _geometry_update, NULL);
424
425 it = elm_ctxpopup_item_append(ctxpopup, NULL, NULL, _ctxpopup_item_cb, NULL);
426 elm_ctxpopup_item_append(ctxpopup, "Text NULL", NULL, _ctxpopup_item_select_cb, it);
427 elm_ctxpopup_item_append(ctxpopup, "Text Set", NULL, _ctxpopup_item_select_cb, it);
428 elm_ctxpopup_item_append(ctxpopup, "Icon NULL", NULL, _ctxpopup_item_select_cb, it);
429 elm_ctxpopup_item_append(ctxpopup, "Icon Set", NULL, _ctxpopup_item_select_cb, it);
430 elm_ctxpopup_item_append(ctxpopup, "Icon Unset", NULL, _ctxpopup_item_select_cb, it);
431
432 evas_pointer_canvas_xy_get(evas_object_evas_get(obj), &x, &y);
433 evas_object_size_hint_max_set(ctxpopup, 240, 240);
434 evas_object_move(ctxpopup, x, y);
435 evas_object_show(ctxpopup);
436 _print_current_dir(ctxpopup);
437}
438
439static void
377_list_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) 440_list_clicked(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
378{ 441{
379 elm_list_item_selected_set(event_info, EINA_FALSE); 442 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_
432 _list_item_cb7, NULL); 495 _list_item_cb7, NULL);
433 elm_list_item_append(list, "Ctxpopup with auto hide disabled mode", NULL, NULL, 496 elm_list_item_append(list, "Ctxpopup with auto hide disabled mode", NULL, NULL,
434 _list_item_cb8, NULL); 497 _list_item_cb8, NULL);
498 elm_list_item_append(list, "Ctxpopup with part text & content function", NULL, NULL,
499 _list_item_cb9, NULL);
435 evas_object_show(list); 500 evas_object_show(list);
436 elm_list_go(list); 501 elm_list_go(list);
437 502
diff --git a/src/lib/elementary/elc_ctxpopup.c b/src/lib/elementary/elc_ctxpopup.c
index ecf418fdb2..f2010b515f 100644
--- a/src/lib/elementary/elc_ctxpopup.c
+++ b/src/lib/elementary/elc_ctxpopup.c
@@ -899,6 +899,31 @@ _elm_ctxpopup_item_elm_widget_item_part_content_get(Eo *eo_ctxpopup_it EINA_UNUS
899 return elm_object_item_part_content_get(ctxpopup_it->list_item, "start"); 899 return elm_object_item_part_content_get(ctxpopup_it->list_item, "start");
900} 900}
901 901
902EOLIAN static Evas_Object *
903_elm_ctxpopup_item_elm_widget_item_part_content_unset(Eo *eo_ctxpopup_it EINA_UNUSED,
904 Elm_Ctxpopup_Item_Data *ctxpopup_it,
905 const char *part)
906{
907 Evas_Object *content = NULL;
908
909 if ((part) && (strcmp(part, "icon"))
910 && (strcmp(part, "start"))
911 && (strcmp(part, "end"))) return NULL;
912
913 ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
914
915 if ((part) && (!strcmp(part, "end")))
916 content = elm_object_item_part_content_unset(ctxpopup_it->list_item, "end");
917 else
918 content = elm_object_item_part_content_unset(ctxpopup_it->list_item, "start");
919
920 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
921
922 if (sd->visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it));
923
924 return content;
925}
926
902EOLIAN static void 927EOLIAN static void
903_elm_ctxpopup_item_elm_widget_item_disable(Eo *eo_ctxpopup_it, 928_elm_ctxpopup_item_elm_widget_item_disable(Eo *eo_ctxpopup_it,
904 Elm_Ctxpopup_Item_Data *ctxpopup_it) 929 Elm_Ctxpopup_Item_Data *ctxpopup_it)
diff --git a/src/lib/elementary/elm_ctxpopup_item.eo b/src/lib/elementary/elm_ctxpopup_item.eo
index 47dd0ff866..31c87ebff7 100644
--- a/src/lib/elementary/elm_ctxpopup_item.eo
+++ b/src/lib/elementary/elm_ctxpopup_item.eo
@@ -20,6 +20,7 @@ class Elm.Ctxpopup.Item(Elm.Widget.Item, Efl.Ui.Item)
20 Elm.Widget.Item.del_pre; 20 Elm.Widget.Item.del_pre;
21 Elm.Widget.Item.part_text { get; set; } 21 Elm.Widget.Item.part_text { get; set; }
22 Elm.Widget.Item.part_content { get; set; } 22 Elm.Widget.Item.part_content { get; set; }
23 Elm.Widget.Item.part_content_unset;
23 Elm.Widget.Item.focus { get; set; } 24 Elm.Widget.Item.focus { get; set; }
24 Efl.Ui.Item.selected { get; set; } 25 Efl.Ui.Item.selected { get; set; }
25 Efl.Ui.Item.prev { get; } 26 Efl.Ui.Item.prev { get; }