1 #include <Elementary.h>
3 #include "elm_widget_ctxpopup.h"
7 EAPI Eo_Op ELM_OBJ_CTXPOPUP_BASE_ID = EO_NOOP;
9 #define MY_CLASS ELM_OBJ_CTXPOPUP_CLASS
11 #define MY_CLASS_NAME "elm_ctxpopup"
13 EAPI const char ELM_CTXPOPUP_SMART_NAME[] = "elm_ctxpopup";
15 static const char SIG_DISMISSED[] = "dismissed";
16 static const Evas_Smart_Cb_Description _smart_callbacks[] = {
23 _elm_ctxpopup_smart_focus_next_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
25 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
30 _elm_ctxpopup_smart_focus_direction_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
32 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
37 _elm_ctxpopup_smart_focus_next(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
39 Elm_Ctxpopup_Smart_Data *sd = _pd;
41 Elm_Focus_Direction dir = va_arg(*list, Elm_Focus_Direction);
42 Evas_Object **next = va_arg(*list, Evas_Object **);
43 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
44 if (ret) *ret = EINA_FALSE;
49 if (!elm_widget_focus_next_get(sd->box, dir, next))
51 elm_widget_focused_object_clear(sd->box);
52 elm_widget_focus_next_get(sd->box, dir, next);
55 if (ret) *ret = EINA_TRUE;
59 _elm_ctxpopup_smart_event(Eo *obj, void *_pd, va_list *list)
61 Evas_Object *src = va_arg(*list, Evas_Object *);
63 Evas_Callback_Type type = va_arg(*list, Evas_Callback_Type);
64 void *event_info = va_arg(*list, void *);
65 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
66 if (ret) *ret = EINA_FALSE;
68 Evas_Event_Key_Down *ev = event_info;
70 Elm_Ctxpopup_Smart_Data *sd = _pd;
72 if (elm_widget_disabled_get(obj)) return;
73 if (type != EVAS_CALLBACK_KEY_DOWN) return;
74 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
76 if (!strcmp(ev->keyname, "Tab"))
78 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
79 elm_widget_focus_cycle(sd->box, ELM_FOCUS_PREVIOUS);
81 elm_widget_focus_cycle(sd->box, ELM_FOCUS_NEXT);
82 if (ret) *ret = EINA_TRUE;
86 if (strcmp(ev->keyname, "Escape")) return;
88 evas_object_hide(obj);
89 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
90 if (ret) *ret = EINA_TRUE;
94 _x_pos_adjust(Evas_Coord_Point *pos,
95 Evas_Coord_Point *base_size,
96 Evas_Coord_Rectangle *hover_area)
98 pos->x -= (base_size->x / 2);
100 if (pos->x < hover_area->x)
101 pos->x = hover_area->x;
102 else if ((pos->x + base_size->x) > (hover_area->x + hover_area->w))
103 pos->x = (hover_area->x + hover_area->w) - base_size->x;
105 if (base_size->x > hover_area->w)
106 base_size->x -= (base_size->x - hover_area->w);
108 if (pos->x < hover_area->x)
109 pos->x = hover_area->x;
113 _y_pos_adjust(Evas_Coord_Point *pos,
114 Evas_Coord_Point *base_size,
115 Evas_Coord_Rectangle *hover_area)
117 pos->y -= (base_size->y / 2);
119 if (pos->y < hover_area->y)
120 pos->y = hover_area->y;
121 else if ((pos->y + base_size->y) > (hover_area->y + hover_area->h))
122 pos->y = hover_area->y + hover_area->h - base_size->y;
124 if (base_size->y > hover_area->h)
125 base_size->y -= (base_size->y - hover_area->h);
127 if (pos->y < hover_area->y)
128 pos->y = hover_area->y;
131 static Elm_Ctxpopup_Direction
132 _base_geometry_calc(Evas_Object *obj,
133 Evas_Coord_Rectangle *rect)
135 Elm_Ctxpopup_Direction dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
136 Evas_Coord_Rectangle hover_area;
137 Evas_Coord_Point pos = {0, 0};
138 Evas_Coord_Point arrow_size;
139 Evas_Coord_Point base_size;
140 Evas_Coord_Point max_size;
141 Evas_Coord_Point min_size;
142 Evas_Coord_Point temp;
145 ELM_CTXPOPUP_DATA_GET(obj, sd);
146 Elm_Widget_Smart_Data *wd = eo_data_get(obj, ELM_OBJ_WIDGET_CLASS);
148 if (!rect) return ELM_CTXPOPUP_DIRECTION_DOWN;
150 edje_object_part_geometry_get
151 (sd->arrow, "ctxpopup_arrow", NULL, NULL, &arrow_size.x, &arrow_size.y);
152 evas_object_resize(sd->arrow, arrow_size.x, arrow_size.y);
154 //Initialize Area Rectangle.
155 evas_object_geometry_get
156 (sd->parent, &hover_area.x, &hover_area.y, &hover_area.w,
159 evas_object_geometry_get(obj, &pos.x, &pos.y, NULL, NULL);
162 edje_object_size_min_calc
163 (wd->resize_obj, &base_size.x, &base_size.y);
164 evas_object_smart_calculate(wd->resize_obj);
167 evas_object_size_hint_max_get(obj, &max_size.x, &max_size.y);
169 if ((max_size.y > 0) && (base_size.y > max_size.y))
170 base_size.y = max_size.y;
172 if ((max_size.x > 0) && (base_size.x > max_size.x))
173 base_size.x = max_size.x;
176 evas_object_size_hint_min_get(obj, &min_size.x, &min_size.y);
178 if ((min_size.y > 0) && (base_size.y < min_size.y))
179 base_size.y = min_size.y;
181 if ((min_size.x > 0) && (base_size.x < min_size.x))
182 base_size.x = min_size.x;
184 //Check the Which direction is available.
185 //If find a avaialble direction, it adjusts position and size.
186 for (idx = 0; idx < 4; idx++)
188 switch (sd->dir_priority[idx])
190 case ELM_CTXPOPUP_DIRECTION_UP:
191 temp.y = (pos.y - base_size.y);
192 if ((temp.y - arrow_size.y) < hover_area.y)
195 _x_pos_adjust(&pos, &base_size, &hover_area);
196 pos.y -= base_size.y;
197 dir = ELM_CTXPOPUP_DIRECTION_UP;
200 case ELM_CTXPOPUP_DIRECTION_LEFT:
201 temp.x = (pos.x - base_size.x);
202 if ((temp.x - arrow_size.x) < hover_area.x)
205 _y_pos_adjust(&pos, &base_size, &hover_area);
206 pos.x -= base_size.x;
207 dir = ELM_CTXPOPUP_DIRECTION_LEFT;
210 case ELM_CTXPOPUP_DIRECTION_RIGHT:
211 temp.x = (pos.x + base_size.x);
212 if ((temp.x + arrow_size.x) >
213 (hover_area.x + hover_area.w))
216 _y_pos_adjust(&pos, &base_size, &hover_area);
217 dir = ELM_CTXPOPUP_DIRECTION_RIGHT;
220 case ELM_CTXPOPUP_DIRECTION_DOWN:
221 temp.y = (pos.y + base_size.y);
222 if ((temp.y + arrow_size.y) >
223 (hover_area.y + hover_area.h))
226 _x_pos_adjust(&pos, &base_size, &hover_area);
227 dir = ELM_CTXPOPUP_DIRECTION_DOWN;
236 //In this case, all directions are invalid because of lack of space.
239 Evas_Coord length[2];
243 length[0] = pos.y - hover_area.y;
244 length[1] = (hover_area.y + hover_area.h) - pos.y;
246 // ELM_CTXPOPUP_DIRECTION_UP
247 if (length[0] > length[1])
249 _x_pos_adjust(&pos, &base_size, &hover_area);
250 pos.y -= base_size.y;
251 dir = ELM_CTXPOPUP_DIRECTION_UP;
252 if (pos.y < (hover_area.y + arrow_size.y))
254 base_size.y -= ((hover_area.y + arrow_size.y) - pos.y);
255 pos.y = hover_area.y + arrow_size.y;
258 //ELM_CTXPOPUP_DIRECTION_DOWN
261 _x_pos_adjust(&pos, &base_size, &hover_area);
262 dir = ELM_CTXPOPUP_DIRECTION_DOWN;
263 if ((pos.y + arrow_size.y + base_size.y) >
264 (hover_area.y + hover_area.h))
266 ((pos.y + arrow_size.y + base_size.y) -
267 (hover_area.y + hover_area.h));
272 length[0] = pos.x - hover_area.x;
273 length[1] = (hover_area.x + hover_area.w) - pos.x;
275 //ELM_CTXPOPUP_DIRECTION_LEFT
276 if (length[0] > length[1])
278 _y_pos_adjust(&pos, &base_size, &hover_area);
279 pos.x -= base_size.x;
280 dir = ELM_CTXPOPUP_DIRECTION_LEFT;
281 if (pos.x < (hover_area.x + arrow_size.x))
283 base_size.x -= ((hover_area.x + arrow_size.x) - pos.x);
284 pos.x = hover_area.x + arrow_size.x;
287 //ELM_CTXPOPUP_DIRECTION_RIGHT
290 _y_pos_adjust(&pos, &base_size, &hover_area);
291 dir = ELM_CTXPOPUP_DIRECTION_RIGHT;
292 if (pos.x + (arrow_size.x + base_size.x) >
293 hover_area.x + hover_area.w)
295 ((pos.x + arrow_size.x + base_size.x) -
296 (hover_area.x + hover_area.w));
301 //Final position and size.
304 rect->w = base_size.x;
305 rect->h = base_size.y;
311 _arrow_update(Evas_Object *obj,
312 Elm_Ctxpopup_Direction dir,
313 Evas_Coord_Rectangle base_size)
315 Evas_Coord_Rectangle arrow_size;
319 ELM_CTXPOPUP_DATA_GET(obj, sd);
320 Elm_Widget_Smart_Data *wd = eo_data_get(obj, ELM_OBJ_WIDGET_CLASS);
322 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
323 evas_object_geometry_get
324 (sd->arrow, NULL, NULL, &arrow_size.w, &arrow_size.h);
326 /* arrow is not being kept as sub-object on purpose, here. the
327 * design of the widget does not help with the contrary */
331 case ELM_CTXPOPUP_DIRECTION_RIGHT:
332 edje_object_signal_emit(sd->arrow, "elm,state,left", "elm");
333 edje_object_part_swallow
335 (elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_right" :
336 "elm.swallow.arrow_left"), sd->arrow);
340 if (y < ((arrow_size.h * 0.5) + base_size.y))
342 else if (y > base_size.y + base_size.h - (arrow_size.h * 0.5))
343 y = base_size.h - arrow_size.h;
345 y = y - base_size.y - (arrow_size.h * 0.5);
346 drag = (double)(y) / (double)(base_size.h - arrow_size.h);
347 edje_object_part_drag_value_set
349 (elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_right" :
350 "elm.swallow.arrow_left"), 1, drag);
354 case ELM_CTXPOPUP_DIRECTION_LEFT:
355 edje_object_signal_emit(sd->arrow, "elm,state,right", "elm");
356 edje_object_part_swallow
358 (elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_left" :
359 "elm.swallow.arrow_right"), sd->arrow);
363 if (y < ((arrow_size.h * 0.5) + base_size.y))
365 else if (y > (base_size.y + base_size.h - (arrow_size.h * 0.5)))
366 y = base_size.h - arrow_size.h;
368 y = y - base_size.y - (arrow_size.h * 0.5);
369 drag = (double)(y) / (double)(base_size.h - arrow_size.h);
370 edje_object_part_drag_value_set
372 (elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_left" :
373 "elm.swallow.arrow_right"), 0, drag);
377 case ELM_CTXPOPUP_DIRECTION_DOWN:
378 edje_object_signal_emit(sd->arrow, "elm,state,top", "elm");
379 edje_object_part_swallow
380 (wd->resize_obj, "elm.swallow.arrow_up",
385 if (x < ((arrow_size.w * 0.5) + base_size.x))
387 else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5)))
388 x = base_size.w - arrow_size.w;
390 x = x - base_size.x - (arrow_size.w * 0.5);
391 drag = (double)(x) / (double)(base_size.w - arrow_size.w);
392 edje_object_part_drag_value_set
393 (wd->resize_obj, "elm.swallow.arrow_up", drag,
398 case ELM_CTXPOPUP_DIRECTION_UP:
399 edje_object_signal_emit(sd->arrow, "elm,state,bottom", "elm");
400 edje_object_part_swallow
401 (wd->resize_obj, "elm.swallow.arrow_down",
406 if (x < ((arrow_size.w * 0.5) + base_size.x))
408 else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5)))
409 x = base_size.w - arrow_size.w;
410 else x = x - base_size.x - (arrow_size.w * 0.5);
411 drag = (double)(x) / (double)(base_size.w - arrow_size.w);
412 edje_object_part_drag_value_set
413 (wd->resize_obj, "elm.swallow.arrow_down",
422 //should be here for getting accurate geometry value
423 evas_object_smart_calculate(wd->resize_obj);
427 _show_signals_emit(Evas_Object *obj,
428 Elm_Ctxpopup_Direction dir)
430 ELM_CTXPOPUP_DATA_GET(obj, sd);
432 if (!sd->visible) return;
433 if ((sd->list) && (!sd->list_visible)) return;
437 case ELM_CTXPOPUP_DIRECTION_UP:
438 elm_layout_signal_emit(obj, "elm,state,show,up", "elm");
441 case ELM_CTXPOPUP_DIRECTION_LEFT:
442 elm_layout_signal_emit(obj,
443 (elm_widget_mirrored_get(obj) ? "elm,state,show,right" :
444 "elm,state,show,left"), "elm");
447 case ELM_CTXPOPUP_DIRECTION_RIGHT:
448 elm_layout_signal_emit(obj,
449 (elm_widget_mirrored_get(obj) ? "elm,state,show,left" :
450 "elm,state,show,right"), "elm");
453 case ELM_CTXPOPUP_DIRECTION_DOWN:
454 elm_layout_signal_emit(obj, "elm,state,show,down", "elm");
461 edje_object_signal_emit(sd->bg, "elm,state,show", "elm");
462 elm_layout_signal_emit(obj, "elm,state,show", "elm");
466 _hide_signals_emit(Evas_Object *obj,
467 Elm_Ctxpopup_Direction dir)
469 ELM_CTXPOPUP_DATA_GET(obj, sd);
471 if (!sd->visible) return;
475 case ELM_CTXPOPUP_DIRECTION_UP:
476 elm_layout_signal_emit(obj, "elm,state,hide,up", "elm");
479 case ELM_CTXPOPUP_DIRECTION_LEFT:
480 elm_layout_signal_emit(obj,
481 (elm_widget_mirrored_get(obj) ? "elm,state,hide,right" :
482 "elm,state,hide,left"), "elm");
485 case ELM_CTXPOPUP_DIRECTION_RIGHT:
486 elm_layout_signal_emit(obj,
487 (elm_widget_mirrored_get(obj) ? "elm,state,hide,left" :
488 "elm,state,hide,right"), "elm");
491 case ELM_CTXPOPUP_DIRECTION_DOWN:
492 elm_layout_signal_emit(obj, "elm,state,hide,down", "elm");
499 edje_object_signal_emit(sd->bg, "elm,state,hide", "elm");
503 _base_shift_by_arrow(Evas_Object *arrow,
504 Elm_Ctxpopup_Direction dir,
505 Evas_Coord_Rectangle *rect)
507 Evas_Coord arrow_w, arrow_h;
509 evas_object_geometry_get(arrow, NULL, NULL, &arrow_w, &arrow_h);
512 case ELM_CTXPOPUP_DIRECTION_RIGHT:
516 case ELM_CTXPOPUP_DIRECTION_LEFT:
520 case ELM_CTXPOPUP_DIRECTION_DOWN:
524 case ELM_CTXPOPUP_DIRECTION_UP:
534 _elm_ctxpopup_smart_layout_sub_object_add_enable(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
536 Eina_Bool *enable = va_arg(*list, Eina_Bool *);
537 *enable = EINA_FALSE;
541 _elm_ctxpopup_smart_sub_object_add(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
543 Evas_Object *sobj = va_arg(*list, Evas_Object *);
544 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
547 eo_do_super(obj, elm_wdg_sub_object_add(sobj, &int_ret));
549 if (ret) *ret = int_ret;
553 _elm_ctxpopup_smart_sizing_eval(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
555 Evas_Coord_Rectangle rect = { 0, 0, 1, 1 };
556 Evas_Coord_Point list_size = { 0, 0 };
558 Elm_Ctxpopup_Smart_Data *sd = _pd;
559 Elm_Widget_Smart_Data *wd = eo_data_get(obj, ELM_OBJ_WIDGET_CLASS);
561 if (!sd->arrow) return; /* simple way to flag "under deletion" */
564 sd->dir = _base_geometry_calc(obj, &rect);
566 _arrow_update(obj, sd->dir, rect);
568 _base_shift_by_arrow(sd->arrow, sd->dir, &rect);
570 if ((sd->list) && (sd->list_visible))
572 evas_object_geometry_get(sd->list, 0, 0, &list_size.x, &list_size.y);
573 if ((list_size.x >= rect.w) || (list_size.y >= rect.h))
575 elm_list_mode_set(sd->list, ELM_LIST_COMPRESS);
576 evas_object_size_hint_min_set(sd->box, rect.w, rect.h);
577 evas_object_size_hint_min_set(obj, rect.w, rect.h);
581 evas_object_move(wd->resize_obj, rect.x, rect.y);
582 evas_object_resize(wd->resize_obj, rect.w, rect.h);
584 _show_signals_emit(obj, sd->dir);
588 _on_parent_del(void *data,
590 Evas_Object *obj __UNUSED__,
591 void *event_info __UNUSED__)
593 evas_object_del(data);
597 _on_parent_move(void *data,
599 Evas_Object *obj __UNUSED__,
600 void *event_info __UNUSED__)
602 ELM_CTXPOPUP_DATA_GET(data, sd);
604 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
606 if (sd->visible) elm_layout_sizing_eval(data);
610 _on_parent_resize(void *data,
612 Evas_Object *obj __UNUSED__,
613 void *event_info __UNUSED__)
615 ELM_CTXPOPUP_DATA_GET(data, sd);
617 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
619 evas_object_hide(data);
623 _parent_detach(Evas_Object *obj)
625 ELM_CTXPOPUP_DATA_GET(obj, sd);
627 if (!sd->parent) return;
629 evas_object_event_callback_del_full
630 (sd->parent, EVAS_CALLBACK_DEL, _on_parent_del, obj);
631 evas_object_event_callback_del_full
632 (sd->parent, EVAS_CALLBACK_MOVE, _on_parent_move, obj);
633 evas_object_event_callback_del_full
634 (sd->parent, EVAS_CALLBACK_RESIZE, _on_parent_resize, obj);
638 _on_content_resized(void *data,
640 Evas_Object *obj __UNUSED__,
641 void *event_info __UNUSED__)
643 ELM_CTXPOPUP_DATA_GET(data, sd);
645 elm_box_recalculate(sd->box);
646 elm_layout_sizing_eval(data);
649 //FIXME: lost the content size when theme hook is called.
651 _elm_ctxpopup_smart_theme(Eo *obj, void *_pd, va_list *list)
653 Elm_Ctxpopup_Smart_Data *sd = _pd;
656 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
657 if (ret) *ret = EINA_FALSE;
659 eo_do_super(obj, elm_wdg_theme(&int_ret));
660 if (!int_ret) return;
662 elm_widget_theme_object_set
663 (obj, sd->bg, "ctxpopup", "bg", elm_widget_style_get(obj));
664 elm_widget_theme_object_set
665 (obj, sd->arrow, "ctxpopup", "arrow", elm_widget_style_get(obj));
669 if (!strncmp(elm_object_style_get(obj), "default", strlen("default")))
670 elm_object_style_set(sd->list, "ctxpopup");
672 elm_object_style_set(sd->list, elm_object_style_get(obj));
675 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
677 if (sd->visible) elm_layout_sizing_eval(obj);
679 if (ret) *ret = EINA_TRUE;
682 /* kind of a big and tricky override here: an internal box will hold
683 * the actual content. content aliases won't be of much help here */
685 _elm_ctxpopup_smart_content_set(Eo *obj, void *_pd, va_list *list)
687 Evas_Coord min_w = -1, min_h = -1;
689 Elm_Ctxpopup_Smart_Data *sd = _pd;
690 const char *part = va_arg(*list, const char *);
691 Evas_Object *content = va_arg(*list, Evas_Object *);
692 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
693 Eina_Bool int_ret = EINA_TRUE;
695 if ((part) && (strcmp(part, "default")))
697 eo_do_super(obj, elm_obj_container_content_set(part, content, &int_ret));
703 int_ret = EINA_FALSE;
707 if (content == sd->content) goto end;
709 if (sd->content) evas_object_del(sd->content);
710 if (sd->content == sd->list) sd->list = NULL;
712 evas_object_size_hint_weight_set
713 (content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
714 evas_object_size_hint_fill_set
715 (content, EVAS_HINT_FILL, EVAS_HINT_FILL);
717 /* since it's going to be a box content, not a layout's... */
718 evas_object_show(content);
720 evas_object_size_hint_min_get(content, &min_w, &min_h);
721 evas_object_size_hint_min_set(sd->box, min_w, min_h);
722 elm_box_pack_end(sd->box, content);
724 sd->content = content;
725 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
727 if (sd->visible) elm_layout_sizing_eval(obj);
730 if (ret) *ret = int_ret;
734 _elm_ctxpopup_smart_content_get(Eo *obj, void *_pd, va_list *list)
736 const char *part = va_arg(*list, const char *);
737 Evas_Object **ret = va_arg(*list, Evas_Object **);
740 if ((part) && (strcmp(part, "default")))
742 eo_do_super(obj, elm_obj_container_content_get(part, ret));
746 Elm_Ctxpopup_Smart_Data *sd = _pd;
752 _elm_ctxpopup_smart_content_unset(Eo *obj, void *_pd, va_list *list)
754 Evas_Object *content;
756 const char *part = va_arg(*list, const char *);
757 Evas_Object **ret = va_arg(*list, Evas_Object **);
759 if ((part) && (strcmp(part, "default")))
761 eo_do_super(obj, elm_obj_container_content_unset(part, &content));
765 Elm_Ctxpopup_Smart_Data *sd = _pd;
766 content = sd->content;
767 if (!content) goto end;
770 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
772 if (sd->visible) elm_layout_sizing_eval(obj);
775 if (ret) *ret = content;
779 _item_text_set_hook(Elm_Object_Item *it,
783 Elm_Ctxpopup_Item *ctxpopup_it;
785 if ((part) && (strcmp(part, "default"))) return;
787 ctxpopup_it = (Elm_Ctxpopup_Item *)it;
789 ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
791 elm_object_item_part_text_set(ctxpopup_it->list_item, "default", label);
792 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
794 if (sd->visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it));
798 _item_text_get_hook(const Elm_Object_Item *it,
801 Elm_Ctxpopup_Item *ctxpopup_it;
803 if (part && strcmp(part, "default")) return NULL;
805 ctxpopup_it = (Elm_Ctxpopup_Item *)it;
806 return elm_object_item_part_text_get(ctxpopup_it->list_item, "default");
810 _item_content_set_hook(Elm_Object_Item *it,
812 Evas_Object *content)
814 Elm_Ctxpopup_Item *ctxpopup_it;
816 if ((part) && (strcmp(part, "icon"))
817 && (strcmp(part, "start"))
818 && (strcmp(part, "end"))) return;
820 ctxpopup_it = (Elm_Ctxpopup_Item *)it;
822 ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
824 if ((part) && (!strcmp(part, "end")))
825 elm_object_item_part_content_set(ctxpopup_it->list_item, "end", content);
827 elm_object_item_part_content_set
828 (ctxpopup_it->list_item, "start", content);
830 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
832 if (sd->visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it));
836 _item_content_get_hook(const Elm_Object_Item *it,
839 Elm_Ctxpopup_Item *ctxpopup_it;
841 if (part && strcmp(part, "icon") && strcmp(part, "start")
842 && strcmp(part, "end")) return NULL;
844 ctxpopup_it = (Elm_Ctxpopup_Item *)it;
846 if (part && !strcmp(part, "end"))
847 return elm_object_item_part_content_get(ctxpopup_it->list_item, "end");
849 return elm_object_item_part_content_get(ctxpopup_it->list_item, "start");
853 _item_disable_hook(Elm_Object_Item *it)
855 Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it;
857 elm_object_item_disabled_set
858 (ctxpopup_it->list_item, elm_widget_item_disabled_get(ctxpopup_it));
862 _item_signal_emit_hook(Elm_Object_Item *it,
863 const char *emission,
866 Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it;
868 elm_object_item_signal_emit(ctxpopup_it->list_item, emission, source);
872 _bg_clicked_cb(void *data,
873 Evas_Object *obj __UNUSED__,
874 const char *emission __UNUSED__,
875 const char *source __UNUSED__)
877 ELM_CTXPOPUP_DATA_GET(data, sd);
879 _hide_signals_emit(data, sd->dir);
883 _on_show(void *data __UNUSED__,
886 void *event_info __UNUSED__)
888 ELM_CTXPOPUP_DATA_GET(obj, sd);
892 elm_list_go(sd->list);
893 sd->visible = EINA_TRUE;
894 elm_object_focus_set(obj, EINA_TRUE);
898 if (!sd->content) return;
900 sd->visible = EINA_TRUE;
902 evas_object_show(sd->bg);
903 evas_object_show(sd->arrow);
905 edje_object_signal_emit(sd->bg, "elm,state,show", "elm");
906 elm_layout_signal_emit(obj, "elm,state,show", "elm");
908 elm_layout_sizing_eval(obj);
910 elm_object_focus_set(obj, EINA_TRUE);
914 _on_hide(void *data __UNUSED__,
917 void *event_info __UNUSED__)
919 ELM_CTXPOPUP_DATA_GET(obj, sd);
921 if (!sd->visible) return;
923 evas_object_hide(sd->bg);
924 evas_object_hide(sd->arrow);
926 sd->visible = EINA_FALSE;
927 sd->list_visible = EINA_FALSE;
931 _on_move(void *data __UNUSED__,
934 void *event_info __UNUSED__)
936 ELM_CTXPOPUP_DATA_GET(obj, sd);
938 if (sd->visible) evas_object_show(sd->arrow);
940 elm_layout_sizing_eval(obj);
944 _hide_finished_cb(void *data,
945 Evas_Object *obj __UNUSED__,
946 const char *emission __UNUSED__,
947 const char *source __UNUSED__)
949 evas_object_hide(data);
950 evas_object_smart_callback_call(data, SIG_DISMISSED, NULL);
954 _list_resize_cb(void *data,
956 Evas_Object *obj __UNUSED__,
957 void *event_info __UNUSED__)
959 ELM_CTXPOPUP_DATA_GET(data, sd);
961 if (!sd->visible) return;
962 if (sd->list_visible) return;
964 sd->list_visible = EINA_TRUE;
966 evas_object_show(sd->bg);
967 evas_object_show(sd->arrow);
969 elm_layout_sizing_eval(data);
973 _ctxpopup_restack_cb(void *data __UNUSED__,
976 void *event_info __UNUSED__)
978 ELM_CTXPOPUP_DATA_GET(obj, sd);
980 evas_object_layer_set(sd->bg, evas_object_layer_get(obj));
984 _list_del(Elm_Ctxpopup_Smart_Data *sd)
986 if (!sd->list) return;
988 evas_object_del(sd->list);
993 _item_del_pre_hook(Elm_Object_Item *it)
996 Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it;
998 ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
1000 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1002 list = elm_object_item_widget_get(ctxpopup_it->list_item);
1004 if (eina_list_count(elm_list_items_get(list)) < 2)
1006 elm_object_item_del(ctxpopup_it->list_item);
1007 evas_object_hide(WIDGET(ctxpopup_it));
1012 elm_object_item_del(ctxpopup_it->list_item);
1013 if (sd->list_visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it));
1019 _elm_ctxpopup_smart_disable(Eo *obj, void *_pd, va_list *list)
1021 Elm_Ctxpopup_Smart_Data *sd = _pd;
1023 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
1024 if (ret) *ret = EINA_FALSE;
1027 eo_do_super(obj, elm_wdg_disable(&int_ret));
1028 if (!int_ret) return;
1030 elm_object_disabled_set(sd->list, elm_widget_disabled_get(obj));
1032 if (ret) *ret = EINA_TRUE;
1036 _elm_ctxpopup_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
1038 Elm_Ctxpopup_Smart_Data *priv = _pd;
1040 eo_do_super(obj, evas_obj_smart_add());
1042 elm_layout_theme_set(obj, "ctxpopup", "base", elm_widget_style_get(obj));
1043 elm_layout_signal_callback_add
1044 (obj, "elm,action,hide,finished", "", _hide_finished_cb, obj);
1047 priv->bg = edje_object_add(evas_object_evas_get(obj));
1048 elm_widget_theme_object_set(obj, priv->bg, "ctxpopup", "bg", "default");
1049 edje_object_signal_callback_add
1050 (priv->bg, "elm,action,click", "", _bg_clicked_cb, obj);
1052 evas_object_stack_below(priv->bg, obj);
1055 priv->arrow = edje_object_add(evas_object_evas_get(obj));
1056 elm_widget_theme_object_set
1057 (obj, priv->arrow, "ctxpopup", "arrow", "default");
1059 priv->dir_priority[0] = ELM_CTXPOPUP_DIRECTION_UP;
1060 priv->dir_priority[1] = ELM_CTXPOPUP_DIRECTION_LEFT;
1061 priv->dir_priority[2] = ELM_CTXPOPUP_DIRECTION_RIGHT;
1062 priv->dir_priority[3] = ELM_CTXPOPUP_DIRECTION_DOWN;
1063 priv->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1065 evas_object_event_callback_add
1066 (obj, EVAS_CALLBACK_RESTACK, _ctxpopup_restack_cb, obj);
1068 priv->box = elm_box_add(obj);
1069 evas_object_size_hint_weight_set
1070 (priv->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1072 evas_object_event_callback_add
1073 (priv->box, EVAS_CALLBACK_RESIZE, _on_content_resized, obj);
1075 /* box will be our content placeholder, thus the parent's version call */
1077 eo_do_super(obj, elm_obj_container_content_set("elm.swallow.content", priv->box, &ret));
1079 evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _on_show, NULL);
1080 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _on_hide, NULL);
1081 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _on_move, NULL);
1083 elm_widget_can_focus_set(obj, EINA_TRUE);
1087 _elm_ctxpopup_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
1089 Elm_Ctxpopup_Smart_Data *sd = _pd;
1091 evas_object_event_callback_del_full
1092 (sd->box, EVAS_CALLBACK_RESIZE, _on_content_resized, obj);
1093 _parent_detach(obj);
1095 elm_ctxpopup_clear(obj);
1096 evas_object_del(sd->arrow);
1097 sd->arrow = NULL; /* stops _sizing_eval() from going on on deletion */
1099 evas_object_del(sd->bg);
1102 eo_do_super(obj, evas_obj_smart_del());
1106 _elm_ctxpopup_smart_parent_set(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
1108 Evas_Object *parent = va_arg(*list, Evas_Object *);
1109 //default parent is to be hover parent
1110 elm_ctxpopup_hover_parent_set(obj, parent);
1114 elm_ctxpopup_add(Evas_Object *parent)
1116 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
1117 Evas_Object *obj = eo_add(MY_CLASS, parent);
1123 _constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
1125 eo_do_super(obj, eo_constructor());
1127 evas_obj_type_set(MY_CLASS_NAME),
1128 evas_obj_smart_callbacks_descriptions_set(_smart_callbacks, NULL));
1130 if (!elm_widget_sub_object_add(eo_parent_get(obj), obj))
1131 ERR("could not add %p as sub object of %p", obj, eo_parent_get(obj));
1135 elm_ctxpopup_hover_parent_set(Evas_Object *obj,
1136 Evas_Object *parent)
1138 ELM_CTXPOPUP_CHECK(obj);
1139 eo_do(obj, elm_obj_ctxpopup_hover_parent_set(parent));
1143 _hover_parent_set(Eo *obj, void *_pd, va_list *list)
1145 Evas_Coord x, y, w, h;
1146 Evas_Object *parent = va_arg(*list, Evas_Object *);
1148 Elm_Ctxpopup_Smart_Data *sd = _pd;
1150 if (!parent) return;
1152 _parent_detach(obj);
1154 evas_object_event_callback_add
1155 (parent, EVAS_CALLBACK_DEL, _on_parent_del, obj);
1156 evas_object_event_callback_add
1157 (parent, EVAS_CALLBACK_MOVE, _on_parent_move, obj);
1158 evas_object_event_callback_add
1159 (parent, EVAS_CALLBACK_RESIZE, _on_parent_resize, obj);
1161 sd->parent = parent;
1164 evas_object_geometry_get(parent, &x, &y, &w, &h);
1165 evas_object_move(sd->bg, x, y);
1166 evas_object_resize(sd->bg, w, h);
1168 if (sd->visible) elm_layout_sizing_eval(obj);
1172 elm_ctxpopup_hover_parent_get(const Evas_Object *obj)
1174 ELM_CTXPOPUP_CHECK(obj) NULL;
1175 Evas_Object *ret = NULL;
1176 eo_do((Eo *) obj, elm_obj_ctxpopup_hover_parent_get(&ret));
1181 _hover_parent_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
1183 Evas_Object **ret = va_arg(*list, Evas_Object **);
1184 Elm_Ctxpopup_Smart_Data *sd = _pd;
1189 elm_ctxpopup_clear(Evas_Object *obj)
1191 ELM_CTXPOPUP_CHECK(obj);
1192 eo_do(obj, elm_obj_ctxpopup_clear());
1196 _clear(Eo *obj EINA_UNUSED, void *_pd, va_list *list EINA_UNUSED)
1198 Elm_Ctxpopup_Smart_Data *sd = _pd;
1201 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1205 elm_ctxpopup_horizontal_set(Evas_Object *obj,
1206 Eina_Bool horizontal)
1208 ELM_CTXPOPUP_CHECK(obj);
1209 eo_do(obj, elm_obj_ctxpopup_horizontal_set(horizontal));
1213 _horizontal_set(Eo *obj, void *_pd, va_list *list)
1215 Eina_Bool horizontal = va_arg(*list, int);
1216 Elm_Ctxpopup_Smart_Data *sd = _pd;
1218 sd->horizontal = !!horizontal;
1220 if (!sd->list) return;
1222 elm_list_horizontal_set(sd->list, sd->horizontal);
1224 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1226 if (sd->visible) elm_layout_sizing_eval(obj);
1230 elm_ctxpopup_horizontal_get(const Evas_Object *obj)
1232 ELM_CTXPOPUP_CHECK(obj) EINA_FALSE;
1233 Eina_Bool ret = EINA_FALSE;
1234 eo_do((Eo *) obj, elm_obj_ctxpopup_horizontal_get(&ret));
1239 _horizontal_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
1241 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
1242 Elm_Ctxpopup_Smart_Data *sd = _pd;
1244 *ret = sd->horizontal;
1247 EAPI Elm_Object_Item *
1248 elm_ctxpopup_item_append(Evas_Object *obj,
1255 ELM_CTXPOPUP_CHECK(obj) NULL;
1256 Elm_Object_Item *ret = NULL;
1257 eo_do(obj, elm_obj_ctxpopup_item_append(label, icon, func, data, &ret));
1262 _item_append(Eo *obj, void *_pd, va_list *list)
1264 const char *label = va_arg(*list, const char *);
1265 Evas_Object *icon = va_arg(*list, Evas_Object *);
1266 Evas_Smart_Cb func = va_arg(*list, Evas_Smart_Cb);
1267 const void *data = va_arg(*list, const void *);
1268 Elm_Object_Item **ret = va_arg(*list, Elm_Object_Item **);
1271 Elm_Ctxpopup_Item *item;
1273 Elm_Ctxpopup_Smart_Data *sd = _pd;
1275 item = elm_widget_item_new(obj, Elm_Ctxpopup_Item);
1278 elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook);
1279 elm_widget_item_disable_hook_set(item, _item_disable_hook);
1280 elm_widget_item_text_set_hook_set(item, _item_text_set_hook);
1281 elm_widget_item_text_get_hook_set(item, _item_text_get_hook);
1282 elm_widget_item_content_set_hook_set(item, _item_content_set_hook);
1283 elm_widget_item_content_get_hook_set(item, _item_content_get_hook);
1284 elm_widget_item_signal_emit_hook_set(item, _item_signal_emit_hook);
1288 //The first item is appended.
1289 sd->list = elm_list_add(obj);
1290 elm_list_mode_set(sd->list, ELM_LIST_EXPAND);
1291 elm_list_horizontal_set(sd->list, sd->horizontal);
1292 evas_object_event_callback_add
1293 (sd->list, EVAS_CALLBACK_RESIZE, _list_resize_cb, obj);
1294 elm_layout_content_set(obj, "default", sd->list);
1298 elm_list_item_append(sd->list, label, icon, NULL, func, data);
1300 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1302 if (sd->visible) elm_layout_sizing_eval(obj);
1304 *ret = (Elm_Object_Item *)item;
1308 elm_ctxpopup_direction_priority_set(Evas_Object *obj,
1309 Elm_Ctxpopup_Direction first,
1310 Elm_Ctxpopup_Direction second,
1311 Elm_Ctxpopup_Direction third,
1312 Elm_Ctxpopup_Direction fourth)
1314 ELM_CTXPOPUP_CHECK(obj);
1315 eo_do(obj, elm_obj_ctxpopup_direction_priority_set(first, second, third, fourth));
1319 _direction_priority_set(Eo *obj, void *_pd, va_list *list)
1321 Elm_Ctxpopup_Direction first = va_arg(*list, Elm_Ctxpopup_Direction);
1322 Elm_Ctxpopup_Direction second = va_arg(*list, Elm_Ctxpopup_Direction);
1323 Elm_Ctxpopup_Direction third = va_arg(*list, Elm_Ctxpopup_Direction);
1324 Elm_Ctxpopup_Direction fourth = va_arg(*list, Elm_Ctxpopup_Direction);
1326 Elm_Ctxpopup_Smart_Data *sd = _pd;
1328 sd->dir_priority[0] = first;
1329 sd->dir_priority[1] = second;
1330 sd->dir_priority[2] = third;
1331 sd->dir_priority[3] = fourth;
1333 if (sd->visible) elm_layout_sizing_eval(obj);
1337 elm_ctxpopup_direction_priority_get(Evas_Object *obj,
1338 Elm_Ctxpopup_Direction *first,
1339 Elm_Ctxpopup_Direction *second,
1340 Elm_Ctxpopup_Direction *third,
1341 Elm_Ctxpopup_Direction *fourth)
1343 ELM_CTXPOPUP_CHECK(obj);
1344 eo_do(obj, elm_obj_ctxpopup_direction_priority_get(first, second, third, fourth));
1348 _direction_priority_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
1350 Elm_Ctxpopup_Direction *first = va_arg(*list, Elm_Ctxpopup_Direction *);
1351 Elm_Ctxpopup_Direction *second = va_arg(*list, Elm_Ctxpopup_Direction *);
1352 Elm_Ctxpopup_Direction *third = va_arg(*list, Elm_Ctxpopup_Direction *);
1353 Elm_Ctxpopup_Direction *fourth = va_arg(*list, Elm_Ctxpopup_Direction *);
1355 Elm_Ctxpopup_Smart_Data *sd = _pd;
1357 if (first) *first = sd->dir_priority[0];
1358 if (second) *second = sd->dir_priority[1];
1359 if (third) *third = sd->dir_priority[2];
1360 if (fourth) *fourth = sd->dir_priority[3];
1363 EAPI Elm_Ctxpopup_Direction
1364 elm_ctxpopup_direction_get(const Evas_Object *obj)
1366 ELM_CTXPOPUP_CHECK(obj) ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1367 Elm_Ctxpopup_Direction ret = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1368 eo_do((Eo *) obj, elm_obj_ctxpopup_direction_get(&ret));
1373 _direction_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
1375 Elm_Ctxpopup_Direction *ret = va_arg(*list, Elm_Ctxpopup_Direction *);
1376 Elm_Ctxpopup_Smart_Data *sd = _pd;
1382 elm_ctxpopup_dismiss(Evas_Object *obj)
1384 ELM_CTXPOPUP_CHECK(obj);
1385 eo_do(obj, elm_obj_ctxpopup_dismiss());
1389 _dismiss(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
1391 Elm_Ctxpopup_Smart_Data *sd = _pd;
1393 _hide_signals_emit(obj, sd->dir);
1397 _class_constructor(Eo_Class *klass)
1399 const Eo_Op_Func_Description func_desc[] = {
1400 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
1402 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _elm_ctxpopup_smart_add),
1403 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DEL), _elm_ctxpopup_smart_del),
1405 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_PARENT_SET), _elm_ctxpopup_smart_parent_set),
1406 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_DISABLE), _elm_ctxpopup_smart_disable),
1407 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_EVENT), _elm_ctxpopup_smart_event),
1408 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_THEME), _elm_ctxpopup_smart_theme),
1409 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_SUB_OBJECT_ADD), _elm_ctxpopup_smart_sub_object_add),
1410 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT_MANAGER_IS), _elm_ctxpopup_smart_focus_next_manager_is),
1411 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT), _elm_ctxpopup_smart_focus_next),
1412 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_DIRECTION_MANAGER_IS), _elm_ctxpopup_smart_focus_direction_manager_is),
1414 EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_SET), _elm_ctxpopup_smart_content_set),
1415 EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_GET), _elm_ctxpopup_smart_content_get),
1416 EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_UNSET), _elm_ctxpopup_smart_content_unset),
1418 EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_SIZING_EVAL), _elm_ctxpopup_smart_sizing_eval),
1419 EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_SUB_OBJECT_ADD_ENABLE), _elm_ctxpopup_smart_layout_sub_object_add_enable),
1421 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_HOVER_PARENT_SET), _hover_parent_set),
1422 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_HOVER_PARENT_GET), _hover_parent_get),
1423 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_CLEAR), _clear),
1424 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_HORIZONTAL_SET), _horizontal_set),
1425 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_HORIZONTAL_GET), _horizontal_get),
1426 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_ITEM_APPEND), _item_append),
1427 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_PRIORITY_SET), _direction_priority_set),
1428 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_PRIORITY_GET), _direction_priority_get),
1429 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_GET), _direction_get),
1430 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_DISMISS), _dismiss),
1433 eo_class_funcs_set(klass, func_desc);
1435 static const Eo_Op_Description op_desc[] = {
1436 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_HOVER_PARENT_SET, "Set the Ctxpopup's parent."),
1437 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_HOVER_PARENT_GET, "Get the Ctxpopup's parent."),
1438 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_CLEAR, "Clear all items in the given ctxpopup object."),
1439 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_HORIZONTAL_SET, "Change the ctxpopup's orientation to horizontal or vertical."),
1440 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_HORIZONTAL_GET, "Get the value of current ctxpopup object's orientation."),
1441 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_ITEM_APPEND, "Add a new item to a ctxpopup object."),
1442 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_PRIORITY_SET, "Set the direction priority of a ctxpopup."),
1443 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_PRIORITY_GET, "Get the direction priority of a ctxpopup."),
1444 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_GET, "Get the current direction of a ctxpopup."),
1445 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_DISMISS, "Dismiss a ctxpopup object."),
1446 EO_OP_DESCRIPTION_SENTINEL
1448 static const Eo_Class_Description class_desc = {
1451 EO_CLASS_TYPE_REGULAR,
1452 EO_CLASS_DESCRIPTION_OPS(&ELM_OBJ_CTXPOPUP_BASE_ID, op_desc, ELM_OBJ_CTXPOPUP_SUB_ID_LAST),
1454 sizeof(Elm_Ctxpopup_Smart_Data),
1458 EO_DEFINE_CLASS(elm_obj_ctxpopup_class_get, &class_desc, ELM_OBJ_LAYOUT_CLASS, NULL);