summaryrefslogtreecommitdiff
path: root/src
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 /src
parentbf0b3e0b75f5c6ebc5cb96211b3b21235422e358 (diff)
downloadefl-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')
-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
}
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);
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
return elm_object_item_part_content_get(ctxpopup_it->list_item, "start");
}
+EOLIAN static Evas_Object *
+_elm_ctxpopup_item_elm_widget_item_part_content_unset(Eo *eo_ctxpopup_it EINA_UNUSED,
+ Elm_Ctxpopup_Item_Data *ctxpopup_it,
+ const char *part)
+{
+ Evas_Object *content = NULL;
+
+ if ((part) && (strcmp(part, "icon"))
+ && (strcmp(part, "start"))
+ && (strcmp(part, "end"))) return NULL;
+
+ ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
+
+ if ((part) && (!strcmp(part, "end")))
+ content = elm_object_item_part_content_unset(ctxpopup_it->list_item, "end");
+ else
+ content = elm_object_item_part_content_unset(ctxpopup_it->list_item, "start");
+
+ sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+
+ if (sd->visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it));
+
+ return content;
+}
+
EOLIAN static void
_elm_ctxpopup_item_elm_widget_item_disable(Eo *eo_ctxpopup_it,
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)
Elm.Widget.Item.del_pre;
Elm.Widget.Item.part_text { get; set; }
Elm.Widget.Item.part_content { get; set; }
+ Elm.Widget.Item.part_content_unset;
Elm.Widget.Item.focus { get; set; }
Efl.Ui.Item.selected { get; set; }
Efl.Ui.Item.prev { get; }