1 #include <Elementary.h>
3 #include "elm_widget_ctxpopup.h"
5 EAPI Eo_Op ELM_OBJ_CTXPOPUP_BASE_ID = EO_NOOP;
7 #define MY_CLASS ELM_OBJ_CTXPOPUP_CLASS
9 #define MY_CLASS_NAME "elm_ctxpopup"
11 EAPI const char ELM_CTXPOPUP_SMART_NAME[] = "elm_ctxpopup";
13 static const char SIG_DISMISSED[] = "dismissed";
14 static const Evas_Smart_Cb_Description _smart_callbacks[] = {
21 _elm_ctxpopup_smart_focus_next_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
23 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
28 _elm_ctxpopup_smart_focus_direction_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
30 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
35 _elm_ctxpopup_smart_focus_next(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
37 Elm_Ctxpopup_Smart_Data *sd = _pd;
39 Elm_Focus_Direction dir = va_arg(*list, Elm_Focus_Direction);
40 Evas_Object **next = va_arg(*list, Evas_Object **);
41 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
42 if (ret) *ret = EINA_FALSE;
47 if (!elm_widget_focus_next_get(sd->box, dir, next))
49 elm_widget_focused_object_clear(sd->box);
50 elm_widget_focus_next_get(sd->box, dir, next);
53 if (ret) *ret = EINA_TRUE;
57 _elm_ctxpopup_smart_event(Eo *obj, void *_pd, va_list *list)
59 Evas_Object *src = va_arg(*list, Evas_Object *);
61 Evas_Callback_Type type = va_arg(*list, Evas_Callback_Type);
62 void *event_info = va_arg(*list, void *);
63 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
64 if (ret) *ret = EINA_FALSE;
66 Evas_Event_Key_Down *ev = event_info;
68 Elm_Ctxpopup_Smart_Data *sd = _pd;
70 if (elm_widget_disabled_get(obj)) return;
71 if (type != EVAS_CALLBACK_KEY_DOWN) return;
72 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
74 if (!strcmp(ev->keyname, "Tab"))
76 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
77 elm_widget_focus_cycle(sd->box, ELM_FOCUS_PREVIOUS);
79 elm_widget_focus_cycle(sd->box, ELM_FOCUS_NEXT);
80 if (ret) *ret = EINA_TRUE;
84 if (strcmp(ev->keyname, "Escape")) return;
86 evas_object_hide(obj);
87 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
88 if (ret) *ret = EINA_TRUE;
92 _x_pos_adjust(Evas_Coord_Point *pos,
93 Evas_Coord_Point *base_size,
94 Evas_Coord_Rectangle *hover_area)
96 pos->x -= (base_size->x / 2);
98 if (pos->x < hover_area->x)
99 pos->x = hover_area->x;
100 else if ((pos->x + base_size->x) > (hover_area->x + hover_area->w))
101 pos->x = (hover_area->x + hover_area->w) - base_size->x;
103 if (base_size->x > hover_area->w)
104 base_size->x -= (base_size->x - hover_area->w);
106 if (pos->x < hover_area->x)
107 pos->x = hover_area->x;
111 _y_pos_adjust(Evas_Coord_Point *pos,
112 Evas_Coord_Point *base_size,
113 Evas_Coord_Rectangle *hover_area)
115 pos->y -= (base_size->y / 2);
117 if (pos->y < hover_area->y)
118 pos->y = hover_area->y;
119 else if ((pos->y + base_size->y) > (hover_area->y + hover_area->h))
120 pos->y = hover_area->y + hover_area->h - base_size->y;
122 if (base_size->y > hover_area->h)
123 base_size->y -= (base_size->y - hover_area->h);
125 if (pos->y < hover_area->y)
126 pos->y = hover_area->y;
129 static Elm_Ctxpopup_Direction
130 _base_geometry_calc(Evas_Object *obj,
131 Evas_Coord_Rectangle *rect)
133 Elm_Ctxpopup_Direction dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
134 Evas_Coord_Rectangle hover_area;
135 Evas_Coord_Point pos = {0, 0};
136 Evas_Coord_Point arrow_size;
137 Evas_Coord_Point base_size;
138 Evas_Coord_Point max_size;
139 Evas_Coord_Point min_size;
140 Evas_Coord_Point temp;
143 ELM_CTXPOPUP_DATA_GET(obj, sd);
144 Elm_Widget_Smart_Data *wd = eo_data_get(obj, ELM_OBJ_WIDGET_CLASS);
146 if (!rect) return ELM_CTXPOPUP_DIRECTION_DOWN;
148 edje_object_part_geometry_get
149 (sd->arrow, "ctxpopup_arrow", NULL, NULL, &arrow_size.x, &arrow_size.y);
150 evas_object_resize(sd->arrow, arrow_size.x, arrow_size.y);
152 //Initialize Area Rectangle.
153 evas_object_geometry_get
154 (sd->parent, &hover_area.x, &hover_area.y, &hover_area.w,
157 evas_object_geometry_get(obj, &pos.x, &pos.y, NULL, NULL);
160 edje_object_size_min_calc
161 (wd->resize_obj, &base_size.x, &base_size.y);
162 evas_object_smart_calculate(wd->resize_obj);
165 evas_object_size_hint_max_get(obj, &max_size.x, &max_size.y);
167 if ((max_size.y > 0) && (base_size.y > max_size.y))
168 base_size.y = max_size.y;
170 if ((max_size.x > 0) && (base_size.x > max_size.x))
171 base_size.x = max_size.x;
174 evas_object_size_hint_min_get(obj, &min_size.x, &min_size.y);
176 if ((min_size.y > 0) && (base_size.y < min_size.y))
177 base_size.y = min_size.y;
179 if ((min_size.x > 0) && (base_size.x < min_size.x))
180 base_size.x = min_size.x;
182 //Check the Which direction is available.
183 //If find a avaialble direction, it adjusts position and size.
184 for (idx = 0; idx < 4; idx++)
186 switch (sd->dir_priority[idx])
188 case ELM_CTXPOPUP_DIRECTION_UP:
189 temp.y = (pos.y - base_size.y);
190 if ((temp.y - arrow_size.y) < hover_area.y)
193 _x_pos_adjust(&pos, &base_size, &hover_area);
194 pos.y -= base_size.y;
195 dir = ELM_CTXPOPUP_DIRECTION_UP;
198 case ELM_CTXPOPUP_DIRECTION_LEFT:
199 temp.x = (pos.x - base_size.x);
200 if ((temp.x - arrow_size.x) < hover_area.x)
203 _y_pos_adjust(&pos, &base_size, &hover_area);
204 pos.x -= base_size.x;
205 dir = ELM_CTXPOPUP_DIRECTION_LEFT;
208 case ELM_CTXPOPUP_DIRECTION_RIGHT:
209 temp.x = (pos.x + base_size.x);
210 if ((temp.x + arrow_size.x) >
211 (hover_area.x + hover_area.w))
214 _y_pos_adjust(&pos, &base_size, &hover_area);
215 dir = ELM_CTXPOPUP_DIRECTION_RIGHT;
218 case ELM_CTXPOPUP_DIRECTION_DOWN:
219 temp.y = (pos.y + base_size.y);
220 if ((temp.y + arrow_size.y) >
221 (hover_area.y + hover_area.h))
224 _x_pos_adjust(&pos, &base_size, &hover_area);
225 dir = ELM_CTXPOPUP_DIRECTION_DOWN;
234 //In this case, all directions are invalid because of lack of space.
237 Evas_Coord length[2];
241 length[0] = pos.y - hover_area.y;
242 length[1] = (hover_area.y + hover_area.h) - pos.y;
244 // ELM_CTXPOPUP_DIRECTION_UP
245 if (length[0] > length[1])
247 _x_pos_adjust(&pos, &base_size, &hover_area);
248 pos.y -= base_size.y;
249 dir = ELM_CTXPOPUP_DIRECTION_UP;
250 if (pos.y < (hover_area.y + arrow_size.y))
252 base_size.y -= ((hover_area.y + arrow_size.y) - pos.y);
253 pos.y = hover_area.y + arrow_size.y;
256 //ELM_CTXPOPUP_DIRECTION_DOWN
259 _x_pos_adjust(&pos, &base_size, &hover_area);
260 dir = ELM_CTXPOPUP_DIRECTION_DOWN;
261 if ((pos.y + arrow_size.y + base_size.y) >
262 (hover_area.y + hover_area.h))
264 ((pos.y + arrow_size.y + base_size.y) -
265 (hover_area.y + hover_area.h));
270 length[0] = pos.x - hover_area.x;
271 length[1] = (hover_area.x + hover_area.w) - pos.x;
273 //ELM_CTXPOPUP_DIRECTION_LEFT
274 if (length[0] > length[1])
276 _y_pos_adjust(&pos, &base_size, &hover_area);
277 pos.x -= base_size.x;
278 dir = ELM_CTXPOPUP_DIRECTION_LEFT;
279 if (pos.x < (hover_area.x + arrow_size.x))
281 base_size.x -= ((hover_area.x + arrow_size.x) - pos.x);
282 pos.x = hover_area.x + arrow_size.x;
285 //ELM_CTXPOPUP_DIRECTION_RIGHT
288 _y_pos_adjust(&pos, &base_size, &hover_area);
289 dir = ELM_CTXPOPUP_DIRECTION_RIGHT;
290 if (pos.x + (arrow_size.x + base_size.x) >
291 hover_area.x + hover_area.w)
293 ((pos.x + arrow_size.x + base_size.x) -
294 (hover_area.x + hover_area.w));
299 //Final position and size.
302 rect->w = base_size.x;
303 rect->h = base_size.y;
309 _arrow_update(Evas_Object *obj,
310 Elm_Ctxpopup_Direction dir,
311 Evas_Coord_Rectangle base_size)
313 Evas_Coord_Rectangle arrow_size;
317 ELM_CTXPOPUP_DATA_GET(obj, sd);
318 Elm_Widget_Smart_Data *wd = eo_data_get(obj, ELM_OBJ_WIDGET_CLASS);
320 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
321 evas_object_geometry_get
322 (sd->arrow, NULL, NULL, &arrow_size.w, &arrow_size.h);
324 /* arrow is not being kept as sub-object on purpose, here. the
325 * design of the widget does not help with the contrary */
329 case ELM_CTXPOPUP_DIRECTION_RIGHT:
330 edje_object_signal_emit(sd->arrow, "elm,state,left", "elm");
331 edje_object_part_swallow
333 (elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_right" :
334 "elm.swallow.arrow_left"), sd->arrow);
338 if (y < ((arrow_size.h * 0.5) + base_size.y))
340 else if (y > base_size.y + base_size.h - (arrow_size.h * 0.5))
341 y = base_size.h - arrow_size.h;
343 y = y - base_size.y - (arrow_size.h * 0.5);
344 drag = (double)(y) / (double)(base_size.h - arrow_size.h);
345 edje_object_part_drag_value_set
347 (elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_right" :
348 "elm.swallow.arrow_left"), 1, drag);
352 case ELM_CTXPOPUP_DIRECTION_LEFT:
353 edje_object_signal_emit(sd->arrow, "elm,state,right", "elm");
354 edje_object_part_swallow
356 (elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_left" :
357 "elm.swallow.arrow_right"), sd->arrow);
361 if (y < ((arrow_size.h * 0.5) + base_size.y))
363 else if (y > (base_size.y + base_size.h - (arrow_size.h * 0.5)))
364 y = base_size.h - arrow_size.h;
366 y = y - base_size.y - (arrow_size.h * 0.5);
367 drag = (double)(y) / (double)(base_size.h - arrow_size.h);
368 edje_object_part_drag_value_set
370 (elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_left" :
371 "elm.swallow.arrow_right"), 0, drag);
375 case ELM_CTXPOPUP_DIRECTION_DOWN:
376 edje_object_signal_emit(sd->arrow, "elm,state,top", "elm");
377 edje_object_part_swallow
378 (wd->resize_obj, "elm.swallow.arrow_up",
383 if (x < ((arrow_size.w * 0.5) + base_size.x))
385 else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5)))
386 x = base_size.w - arrow_size.w;
388 x = x - base_size.x - (arrow_size.w * 0.5);
389 drag = (double)(x) / (double)(base_size.w - arrow_size.w);
390 edje_object_part_drag_value_set
391 (wd->resize_obj, "elm.swallow.arrow_up", drag,
396 case ELM_CTXPOPUP_DIRECTION_UP:
397 edje_object_signal_emit(sd->arrow, "elm,state,bottom", "elm");
398 edje_object_part_swallow
399 (wd->resize_obj, "elm.swallow.arrow_down",
404 if (x < ((arrow_size.w * 0.5) + base_size.x))
406 else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5)))
407 x = base_size.w - arrow_size.w;
408 else x = x - base_size.x - (arrow_size.w * 0.5);
409 drag = (double)(x) / (double)(base_size.w - arrow_size.w);
410 edje_object_part_drag_value_set
411 (wd->resize_obj, "elm.swallow.arrow_down",
420 //should be here for getting accurate geometry value
421 evas_object_smart_calculate(wd->resize_obj);
425 _show_signals_emit(Evas_Object *obj,
426 Elm_Ctxpopup_Direction dir)
428 ELM_CTXPOPUP_DATA_GET(obj, sd);
430 if (!sd->visible) return;
431 if ((sd->list) && (!sd->list_visible)) return;
435 case ELM_CTXPOPUP_DIRECTION_UP:
436 elm_layout_signal_emit(obj, "elm,state,show,up", "elm");
439 case ELM_CTXPOPUP_DIRECTION_LEFT:
440 elm_layout_signal_emit(obj,
441 (elm_widget_mirrored_get(obj) ? "elm,state,show,right" :
442 "elm,state,show,left"), "elm");
445 case ELM_CTXPOPUP_DIRECTION_RIGHT:
446 elm_layout_signal_emit(obj,
447 (elm_widget_mirrored_get(obj) ? "elm,state,show,left" :
448 "elm,state,show,right"), "elm");
451 case ELM_CTXPOPUP_DIRECTION_DOWN:
452 elm_layout_signal_emit(obj, "elm,state,show,down", "elm");
459 edje_object_signal_emit(sd->bg, "elm,state,show", "elm");
460 elm_layout_signal_emit(obj, "elm,state,show", "elm");
464 _hide_signals_emit(Evas_Object *obj,
465 Elm_Ctxpopup_Direction dir)
467 ELM_CTXPOPUP_DATA_GET(obj, sd);
469 if (!sd->visible) return;
473 case ELM_CTXPOPUP_DIRECTION_UP:
474 elm_layout_signal_emit(obj, "elm,state,hide,up", "elm");
477 case ELM_CTXPOPUP_DIRECTION_LEFT:
478 elm_layout_signal_emit(obj,
479 (elm_widget_mirrored_get(obj) ? "elm,state,hide,right" :
480 "elm,state,hide,left"), "elm");
483 case ELM_CTXPOPUP_DIRECTION_RIGHT:
484 elm_layout_signal_emit(obj,
485 (elm_widget_mirrored_get(obj) ? "elm,state,hide,left" :
486 "elm,state,hide,right"), "elm");
489 case ELM_CTXPOPUP_DIRECTION_DOWN:
490 elm_layout_signal_emit(obj, "elm,state,hide,down", "elm");
497 edje_object_signal_emit(sd->bg, "elm,state,hide", "elm");
501 _base_shift_by_arrow(Evas_Object *arrow,
502 Elm_Ctxpopup_Direction dir,
503 Evas_Coord_Rectangle *rect)
505 Evas_Coord arrow_w, arrow_h;
507 evas_object_geometry_get(arrow, NULL, NULL, &arrow_w, &arrow_h);
510 case ELM_CTXPOPUP_DIRECTION_RIGHT:
514 case ELM_CTXPOPUP_DIRECTION_LEFT:
518 case ELM_CTXPOPUP_DIRECTION_DOWN:
522 case ELM_CTXPOPUP_DIRECTION_UP:
532 _elm_ctxpopup_smart_layout_sub_object_add_enable(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
534 Eina_Bool *enable = va_arg(*list, Eina_Bool *);
535 *enable = EINA_FALSE;
539 _elm_ctxpopup_smart_sub_object_add(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
541 Evas_Object *sobj = va_arg(*list, Evas_Object *);
542 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
545 eo_do_super(obj, elm_wdg_sub_object_add(sobj, &int_ret));
547 if (ret) *ret = int_ret;
551 _elm_ctxpopup_smart_sizing_eval(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
553 Evas_Coord_Rectangle rect = { 0, 0, 1, 1 };
554 Evas_Coord_Point list_size = { 0, 0 };
556 Elm_Ctxpopup_Smart_Data *sd = _pd;
557 Elm_Widget_Smart_Data *wd = eo_data_get(obj, ELM_OBJ_WIDGET_CLASS);
559 if (!sd->arrow) return; /* simple way to flag "under deletion" */
562 sd->dir = _base_geometry_calc(obj, &rect);
564 _arrow_update(obj, sd->dir, rect);
566 _base_shift_by_arrow(sd->arrow, sd->dir, &rect);
568 if ((sd->list) && (sd->list_visible))
570 evas_object_geometry_get(sd->list, 0, 0, &list_size.x, &list_size.y);
571 if ((list_size.x >= rect.w) || (list_size.y >= rect.h))
573 elm_list_mode_set(sd->list, ELM_LIST_COMPRESS);
574 evas_object_size_hint_min_set(sd->box, rect.w, rect.h);
575 evas_object_size_hint_min_set(obj, rect.w, rect.h);
579 evas_object_move(wd->resize_obj, rect.x, rect.y);
580 evas_object_resize(wd->resize_obj, rect.w, rect.h);
582 _show_signals_emit(obj, sd->dir);
586 _on_parent_del(void *data,
588 Evas_Object *obj __UNUSED__,
589 void *event_info __UNUSED__)
591 evas_object_del(data);
595 _on_parent_move(void *data,
597 Evas_Object *obj __UNUSED__,
598 void *event_info __UNUSED__)
600 ELM_CTXPOPUP_DATA_GET(data, sd);
602 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
604 if (sd->visible) elm_layout_sizing_eval(data);
608 _on_parent_resize(void *data,
610 Evas_Object *obj __UNUSED__,
611 void *event_info __UNUSED__)
613 ELM_CTXPOPUP_DATA_GET(data, sd);
615 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
617 evas_object_hide(data);
618 evas_object_smart_callback_call(data, SIG_DISMISSED, NULL);
622 _parent_detach(Evas_Object *obj)
624 ELM_CTXPOPUP_DATA_GET(obj, sd);
626 if (!sd->parent) return;
628 evas_object_event_callback_del_full
629 (sd->parent, EVAS_CALLBACK_DEL, _on_parent_del, obj);
630 evas_object_event_callback_del_full
631 (sd->parent, EVAS_CALLBACK_MOVE, _on_parent_move, obj);
632 evas_object_event_callback_del_full
633 (sd->parent, EVAS_CALLBACK_RESIZE, _on_parent_resize, obj);
637 _on_content_resized(void *data,
639 Evas_Object *obj __UNUSED__,
640 void *event_info __UNUSED__)
642 ELM_CTXPOPUP_DATA_GET(data, sd);
644 elm_box_recalculate(sd->box);
645 elm_layout_sizing_eval(data);
648 //FIXME: lost the content size when theme hook is called.
650 _elm_ctxpopup_smart_theme(Eo *obj, void *_pd, va_list *list)
652 Elm_Ctxpopup_Smart_Data *sd = _pd;
655 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
656 if (ret) *ret = EINA_FALSE;
658 eo_do_super(obj, elm_wdg_theme(&int_ret));
659 if (!int_ret) return;
661 elm_widget_theme_object_set
662 (obj, sd->bg, "ctxpopup", "bg", elm_widget_style_get(obj));
663 elm_widget_theme_object_set
664 (obj, sd->arrow, "ctxpopup", "arrow", elm_widget_style_get(obj));
668 if (!strncmp(elm_object_style_get(obj), "default", strlen("default")))
669 elm_object_style_set(sd->list, "ctxpopup");
671 elm_object_style_set(sd->list, elm_object_style_get(obj));
674 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
676 if (sd->visible) elm_layout_sizing_eval(obj);
678 if (ret) *ret = EINA_TRUE;
681 /* kind of a big and tricky override here: an internal box will hold
682 * the actual content. content aliases won't be of much help here */
684 _elm_ctxpopup_smart_content_set(Eo *obj, void *_pd, va_list *list)
686 Evas_Coord min_w = -1, min_h = -1;
688 Elm_Ctxpopup_Smart_Data *sd = _pd;
689 const char *part = va_arg(*list, const char *);
690 Evas_Object *content = va_arg(*list, Evas_Object *);
691 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
692 Eina_Bool int_ret = EINA_TRUE;
694 if ((part) && (strcmp(part, "default")))
696 eo_do_super(obj, elm_obj_container_content_set(part, content, &int_ret));
702 int_ret = EINA_FALSE;
706 if (content == sd->content) goto end;
708 if (sd->content) evas_object_del(sd->content);
709 if (sd->content == sd->list) sd->list = NULL;
711 evas_object_size_hint_weight_set
712 (content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
713 evas_object_size_hint_fill_set
714 (content, EVAS_HINT_FILL, EVAS_HINT_FILL);
716 /* since it's going to be a box content, not a layout's... */
717 evas_object_show(content);
719 evas_object_size_hint_min_get(content, &min_w, &min_h);
720 evas_object_size_hint_min_set(sd->box, min_w, min_h);
721 elm_box_pack_end(sd->box, content);
723 sd->content = content;
724 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
726 if (sd->visible) elm_layout_sizing_eval(obj);
729 if (ret) *ret = int_ret;
733 _elm_ctxpopup_smart_content_get(Eo *obj, void *_pd, va_list *list)
735 const char *part = va_arg(*list, const char *);
736 Evas_Object **ret = va_arg(*list, Evas_Object **);
739 if ((part) && (strcmp(part, "default")))
741 eo_do_super(obj, elm_obj_container_content_get(part, ret));
745 Elm_Ctxpopup_Smart_Data *sd = _pd;
751 _elm_ctxpopup_smart_content_unset(Eo *obj, void *_pd, va_list *list)
753 Evas_Object *content;
755 const char *part = va_arg(*list, const char *);
756 Evas_Object **ret = va_arg(*list, Evas_Object **);
758 if ((part) && (strcmp(part, "default")))
760 eo_do_super(obj, elm_obj_container_content_unset(part, &content));
764 Elm_Ctxpopup_Smart_Data *sd = _pd;
765 content = sd->content;
766 if (!content) goto end;
769 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
771 if (sd->visible) elm_layout_sizing_eval(obj);
774 if (ret) *ret = content;
778 _item_text_set_hook(Elm_Object_Item *it,
782 Elm_Ctxpopup_Item *ctxpopup_it;
784 if ((part) && (strcmp(part, "default"))) return;
786 ctxpopup_it = (Elm_Ctxpopup_Item *)it;
788 ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
790 elm_object_item_part_text_set(ctxpopup_it->list_item, "default", label);
791 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
793 if (sd->visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it));
797 _item_text_get_hook(const Elm_Object_Item *it,
800 Elm_Ctxpopup_Item *ctxpopup_it;
802 if (part && strcmp(part, "default")) return NULL;
804 ctxpopup_it = (Elm_Ctxpopup_Item *)it;
805 return elm_object_item_part_text_get(ctxpopup_it->list_item, "default");
809 _item_content_set_hook(Elm_Object_Item *it,
811 Evas_Object *content)
813 Elm_Ctxpopup_Item *ctxpopup_it;
815 if ((part) && (strcmp(part, "icon"))
816 && (strcmp(part, "start"))
817 && (strcmp(part, "end"))) return;
819 ctxpopup_it = (Elm_Ctxpopup_Item *)it;
821 ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
823 if ((part) && (!strcmp(part, "end")))
824 elm_object_item_part_content_set(ctxpopup_it->list_item, "end", content);
826 elm_object_item_part_content_set
827 (ctxpopup_it->list_item, "start", content);
829 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
831 if (sd->visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it));
835 _item_content_get_hook(const Elm_Object_Item *it,
838 Elm_Ctxpopup_Item *ctxpopup_it;
840 if (part && strcmp(part, "icon") && strcmp(part, "start")
841 && strcmp(part, "end")) return NULL;
843 ctxpopup_it = (Elm_Ctxpopup_Item *)it;
845 if (part && !strcmp(part, "end"))
846 return elm_object_item_part_content_get(ctxpopup_it->list_item, "end");
848 return elm_object_item_part_content_get(ctxpopup_it->list_item, "start");
852 _item_disable_hook(Elm_Object_Item *it)
854 Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it;
856 elm_object_item_disabled_set
857 (ctxpopup_it->list_item, elm_widget_item_disabled_get(ctxpopup_it));
861 _item_signal_emit_hook(Elm_Object_Item *it,
862 const char *emission,
865 Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it;
867 elm_object_item_signal_emit(ctxpopup_it->list_item, emission, source);
871 _bg_clicked_cb(void *data,
872 Evas_Object *obj __UNUSED__,
873 const char *emission __UNUSED__,
874 const char *source __UNUSED__)
876 ELM_CTXPOPUP_DATA_GET(data, sd);
878 _hide_signals_emit(data, sd->dir);
882 _on_show(void *data __UNUSED__,
885 void *event_info __UNUSED__)
887 ELM_CTXPOPUP_DATA_GET(obj, sd);
891 elm_list_go(sd->list);
892 sd->visible = EINA_TRUE;
893 elm_object_focus_set(obj, EINA_TRUE);
897 if (!sd->content) return;
899 sd->visible = EINA_TRUE;
901 evas_object_show(sd->bg);
902 evas_object_show(sd->arrow);
904 edje_object_signal_emit(sd->bg, "elm,state,show", "elm");
905 elm_layout_signal_emit(obj, "elm,state,show", "elm");
907 elm_layout_sizing_eval(obj);
909 elm_object_focus_set(obj, EINA_TRUE);
913 _on_hide(void *data __UNUSED__,
916 void *event_info __UNUSED__)
918 ELM_CTXPOPUP_DATA_GET(obj, sd);
920 if (!sd->visible) return;
922 evas_object_hide(sd->bg);
923 evas_object_hide(sd->arrow);
925 sd->visible = EINA_FALSE;
926 sd->list_visible = EINA_FALSE;
930 _on_move(void *data __UNUSED__,
933 void *event_info __UNUSED__)
935 ELM_CTXPOPUP_DATA_GET(obj, sd);
937 if (sd->visible) evas_object_show(sd->arrow);
939 elm_layout_sizing_eval(obj);
943 _hide_finished_cb(void *data,
944 Evas_Object *obj __UNUSED__,
945 const char *emission __UNUSED__,
946 const char *source __UNUSED__)
948 evas_object_hide(data);
949 evas_object_smart_callback_call(data, SIG_DISMISSED, NULL);
953 _list_resize_cb(void *data,
955 Evas_Object *obj __UNUSED__,
956 void *event_info __UNUSED__)
958 ELM_CTXPOPUP_DATA_GET(data, sd);
960 if (!sd->visible) return;
961 if (sd->list_visible) return;
963 sd->list_visible = EINA_TRUE;
965 evas_object_show(sd->bg);
966 evas_object_show(sd->arrow);
968 elm_layout_sizing_eval(data);
972 _ctxpopup_restack_cb(void *data __UNUSED__,
975 void *event_info __UNUSED__)
977 ELM_CTXPOPUP_DATA_GET(obj, sd);
979 evas_object_layer_set(sd->bg, evas_object_layer_get(obj));
983 _list_del(Elm_Ctxpopup_Smart_Data *sd)
985 if (!sd->list) return;
987 evas_object_del(sd->list);
992 _item_del_pre_hook(Elm_Object_Item *it)
995 Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it;
997 ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
999 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1001 list = elm_object_item_widget_get(ctxpopup_it->list_item);
1003 if (eina_list_count(elm_list_items_get(list)) < 2)
1005 elm_object_item_del(ctxpopup_it->list_item);
1006 sd->items = eina_list_remove(sd->items, ctxpopup_it);
1007 evas_object_hide(WIDGET(ctxpopup_it));
1012 elm_object_item_del(ctxpopup_it->list_item);
1013 sd->items = eina_list_remove(sd->items, ctxpopup_it);
1014 if (sd->list_visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it));
1020 _elm_ctxpopup_smart_disable(Eo *obj, void *_pd, va_list *list)
1022 Elm_Ctxpopup_Smart_Data *sd = _pd;
1024 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
1025 if (ret) *ret = EINA_FALSE;
1028 eo_do_super(obj, elm_wdg_disable(&int_ret));
1029 if (!int_ret) return;
1031 elm_object_disabled_set(sd->list, elm_widget_disabled_get(obj));
1033 if (ret) *ret = EINA_TRUE;
1037 _elm_ctxpopup_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
1039 Elm_Ctxpopup_Smart_Data *priv = _pd;
1041 eo_do_super(obj, evas_obj_smart_add());
1043 elm_layout_theme_set(obj, "ctxpopup", "base", elm_widget_style_get(obj));
1044 elm_layout_signal_callback_add
1045 (obj, "elm,action,hide,finished", "", _hide_finished_cb, obj);
1048 priv->bg = edje_object_add(evas_object_evas_get(obj));
1049 elm_widget_theme_object_set(obj, priv->bg, "ctxpopup", "bg", "default");
1050 edje_object_signal_callback_add
1051 (priv->bg, "elm,action,click", "", _bg_clicked_cb, obj);
1053 evas_object_stack_below(priv->bg, obj);
1056 priv->arrow = edje_object_add(evas_object_evas_get(obj));
1057 elm_widget_theme_object_set
1058 (obj, priv->arrow, "ctxpopup", "arrow", "default");
1060 priv->dir_priority[0] = ELM_CTXPOPUP_DIRECTION_UP;
1061 priv->dir_priority[1] = ELM_CTXPOPUP_DIRECTION_LEFT;
1062 priv->dir_priority[2] = ELM_CTXPOPUP_DIRECTION_RIGHT;
1063 priv->dir_priority[3] = ELM_CTXPOPUP_DIRECTION_DOWN;
1064 priv->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1066 evas_object_event_callback_add
1067 (obj, EVAS_CALLBACK_RESTACK, _ctxpopup_restack_cb, obj);
1069 priv->box = elm_box_add(obj);
1070 evas_object_size_hint_weight_set
1071 (priv->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1073 evas_object_event_callback_add
1074 (priv->box, EVAS_CALLBACK_RESIZE, _on_content_resized, obj);
1076 /* box will be our content placeholder, thus the parent's version call */
1078 eo_do_super(obj, elm_obj_container_content_set("elm.swallow.content", priv->box, &ret));
1080 evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _on_show, NULL);
1081 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _on_hide, NULL);
1082 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _on_move, NULL);
1084 elm_widget_can_focus_set(obj, EINA_TRUE);
1088 _elm_ctxpopup_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
1090 Elm_Ctxpopup_Smart_Data *sd = _pd;
1091 Elm_Ctxpopup_Item *it;
1093 evas_object_event_callback_del_full
1094 (sd->box, EVAS_CALLBACK_RESIZE, _on_content_resized, obj);
1095 _parent_detach(obj);
1097 elm_ctxpopup_clear(obj);
1098 evas_object_del(sd->arrow);
1099 sd->arrow = NULL; /* stops _sizing_eval() from going on on deletion */
1101 evas_object_del(sd->bg);
1104 EINA_LIST_FREE (sd->items, it)
1105 elm_widget_item_free(it);
1107 eo_do_super(obj, evas_obj_smart_del());
1111 _elm_ctxpopup_smart_parent_set(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
1113 Evas_Object *parent = va_arg(*list, Evas_Object *);
1114 //default parent is to be hover parent
1115 elm_ctxpopup_hover_parent_set(obj, parent);
1119 elm_ctxpopup_add(Evas_Object *parent)
1121 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
1122 Evas_Object *obj = eo_add(MY_CLASS, parent);
1128 _constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
1130 eo_do_super(obj, eo_constructor());
1132 evas_obj_type_set(MY_CLASS_NAME),
1133 evas_obj_smart_callbacks_descriptions_set(_smart_callbacks, NULL));
1135 if (!elm_widget_sub_object_add(eo_parent_get(obj), obj))
1136 ERR("could not add %p as sub object of %p", obj, eo_parent_get(obj));
1140 elm_ctxpopup_hover_parent_set(Evas_Object *obj,
1141 Evas_Object *parent)
1143 ELM_CTXPOPUP_CHECK(obj);
1144 eo_do(obj, elm_obj_ctxpopup_hover_parent_set(parent));
1148 _hover_parent_set(Eo *obj, void *_pd, va_list *list)
1150 Evas_Coord x, y, w, h;
1151 Evas_Object *parent = va_arg(*list, Evas_Object *);
1153 Elm_Ctxpopup_Smart_Data *sd = _pd;
1155 if (!parent) return;
1157 _parent_detach(obj);
1159 evas_object_event_callback_add
1160 (parent, EVAS_CALLBACK_DEL, _on_parent_del, obj);
1161 evas_object_event_callback_add
1162 (parent, EVAS_CALLBACK_MOVE, _on_parent_move, obj);
1163 evas_object_event_callback_add
1164 (parent, EVAS_CALLBACK_RESIZE, _on_parent_resize, obj);
1166 sd->parent = parent;
1169 evas_object_geometry_get(parent, &x, &y, &w, &h);
1170 evas_object_move(sd->bg, x, y);
1171 evas_object_resize(sd->bg, w, h);
1173 if (sd->visible) elm_layout_sizing_eval(obj);
1177 elm_ctxpopup_hover_parent_get(const Evas_Object *obj)
1179 ELM_CTXPOPUP_CHECK(obj) NULL;
1180 Evas_Object *ret = NULL;
1181 eo_do((Eo *) obj, elm_obj_ctxpopup_hover_parent_get(&ret));
1186 _hover_parent_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
1188 Evas_Object **ret = va_arg(*list, Evas_Object **);
1189 Elm_Ctxpopup_Smart_Data *sd = _pd;
1194 elm_ctxpopup_clear(Evas_Object *obj)
1196 ELM_CTXPOPUP_CHECK(obj);
1197 eo_do(obj, elm_obj_ctxpopup_clear());
1201 _clear(Eo *obj EINA_UNUSED, void *_pd, va_list *list EINA_UNUSED)
1203 Elm_Ctxpopup_Smart_Data *sd = _pd;
1206 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1210 elm_ctxpopup_horizontal_set(Evas_Object *obj,
1211 Eina_Bool horizontal)
1213 ELM_CTXPOPUP_CHECK(obj);
1214 eo_do(obj, elm_obj_ctxpopup_horizontal_set(horizontal));
1218 _horizontal_set(Eo *obj, void *_pd, va_list *list)
1220 Eina_Bool horizontal = va_arg(*list, int);
1221 Elm_Ctxpopup_Smart_Data *sd = _pd;
1223 sd->horizontal = !!horizontal;
1225 if (!sd->list) return;
1227 elm_list_horizontal_set(sd->list, sd->horizontal);
1229 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1231 if (sd->visible) elm_layout_sizing_eval(obj);
1235 elm_ctxpopup_horizontal_get(const Evas_Object *obj)
1237 ELM_CTXPOPUP_CHECK(obj) EINA_FALSE;
1238 Eina_Bool ret = EINA_FALSE;
1239 eo_do((Eo *) obj, elm_obj_ctxpopup_horizontal_get(&ret));
1244 _horizontal_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
1246 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
1247 Elm_Ctxpopup_Smart_Data *sd = _pd;
1249 *ret = sd->horizontal;
1252 EAPI Elm_Object_Item *
1253 elm_ctxpopup_item_append(Evas_Object *obj,
1260 ELM_CTXPOPUP_CHECK(obj) NULL;
1261 Elm_Object_Item *ret = NULL;
1262 eo_do(obj, elm_obj_ctxpopup_item_append(label, icon, func, data, &ret));
1267 _item_wrap_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1269 Elm_Ctxpopup_Item *item = data;
1270 item->wcb.org_func_cb((void *)item->wcb.org_data, item->wcb.cobj, item);
1274 _item_append(Eo *obj, void *_pd, va_list *list)
1276 const char *label = va_arg(*list, const char *);
1277 Evas_Object *icon = va_arg(*list, Evas_Object *);
1278 Evas_Smart_Cb func = va_arg(*list, Evas_Smart_Cb);
1279 const void *data = va_arg(*list, const void *);
1280 Elm_Object_Item **ret = va_arg(*list, Elm_Object_Item **);
1283 Elm_Ctxpopup_Item *item;
1285 Elm_Ctxpopup_Smart_Data *sd = _pd;
1287 item = elm_widget_item_new(obj, Elm_Ctxpopup_Item);
1290 elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook);
1291 elm_widget_item_disable_hook_set(item, _item_disable_hook);
1292 elm_widget_item_text_set_hook_set(item, _item_text_set_hook);
1293 elm_widget_item_text_get_hook_set(item, _item_text_get_hook);
1294 elm_widget_item_content_set_hook_set(item, _item_content_set_hook);
1295 elm_widget_item_content_get_hook_set(item, _item_content_get_hook);
1296 elm_widget_item_signal_emit_hook_set(item, _item_signal_emit_hook);
1300 //The first item is appended.
1301 sd->list = elm_list_add(obj);
1302 elm_list_mode_set(sd->list, ELM_LIST_EXPAND);
1303 elm_list_horizontal_set(sd->list, sd->horizontal);
1304 evas_object_event_callback_add
1305 (sd->list, EVAS_CALLBACK_RESIZE, _list_resize_cb, obj);
1306 elm_layout_content_set(obj, "default", sd->list);
1309 item->wcb.org_func_cb = func;
1310 item->wcb.org_data = data;
1311 item->wcb.cobj = obj;
1313 elm_list_item_append(sd->list, label, icon, NULL, _item_wrap_cb, item);
1314 sd->items = eina_list_append(sd->items, item);
1316 sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1318 if (sd->visible) elm_layout_sizing_eval(obj);
1320 *ret = (Elm_Object_Item *)item;
1324 elm_ctxpopup_direction_priority_set(Evas_Object *obj,
1325 Elm_Ctxpopup_Direction first,
1326 Elm_Ctxpopup_Direction second,
1327 Elm_Ctxpopup_Direction third,
1328 Elm_Ctxpopup_Direction fourth)
1330 ELM_CTXPOPUP_CHECK(obj);
1331 eo_do(obj, elm_obj_ctxpopup_direction_priority_set(first, second, third, fourth));
1335 _direction_priority_set(Eo *obj, void *_pd, va_list *list)
1337 Elm_Ctxpopup_Direction first = va_arg(*list, Elm_Ctxpopup_Direction);
1338 Elm_Ctxpopup_Direction second = va_arg(*list, Elm_Ctxpopup_Direction);
1339 Elm_Ctxpopup_Direction third = va_arg(*list, Elm_Ctxpopup_Direction);
1340 Elm_Ctxpopup_Direction fourth = va_arg(*list, Elm_Ctxpopup_Direction);
1342 Elm_Ctxpopup_Smart_Data *sd = _pd;
1344 sd->dir_priority[0] = first;
1345 sd->dir_priority[1] = second;
1346 sd->dir_priority[2] = third;
1347 sd->dir_priority[3] = fourth;
1349 if (sd->visible) elm_layout_sizing_eval(obj);
1353 elm_ctxpopup_direction_priority_get(Evas_Object *obj,
1354 Elm_Ctxpopup_Direction *first,
1355 Elm_Ctxpopup_Direction *second,
1356 Elm_Ctxpopup_Direction *third,
1357 Elm_Ctxpopup_Direction *fourth)
1359 ELM_CTXPOPUP_CHECK(obj);
1360 eo_do(obj, elm_obj_ctxpopup_direction_priority_get(first, second, third, fourth));
1364 _direction_priority_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
1366 Elm_Ctxpopup_Direction *first = va_arg(*list, Elm_Ctxpopup_Direction *);
1367 Elm_Ctxpopup_Direction *second = va_arg(*list, Elm_Ctxpopup_Direction *);
1368 Elm_Ctxpopup_Direction *third = va_arg(*list, Elm_Ctxpopup_Direction *);
1369 Elm_Ctxpopup_Direction *fourth = va_arg(*list, Elm_Ctxpopup_Direction *);
1371 Elm_Ctxpopup_Smart_Data *sd = _pd;
1373 if (first) *first = sd->dir_priority[0];
1374 if (second) *second = sd->dir_priority[1];
1375 if (third) *third = sd->dir_priority[2];
1376 if (fourth) *fourth = sd->dir_priority[3];
1379 EAPI Elm_Ctxpopup_Direction
1380 elm_ctxpopup_direction_get(const Evas_Object *obj)
1382 ELM_CTXPOPUP_CHECK(obj) ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1383 Elm_Ctxpopup_Direction ret = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
1384 eo_do((Eo *) obj, elm_obj_ctxpopup_direction_get(&ret));
1389 _direction_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
1391 Elm_Ctxpopup_Direction *ret = va_arg(*list, Elm_Ctxpopup_Direction *);
1392 Elm_Ctxpopup_Smart_Data *sd = _pd;
1398 elm_ctxpopup_dismiss(Evas_Object *obj)
1400 ELM_CTXPOPUP_CHECK(obj);
1401 eo_do(obj, elm_obj_ctxpopup_dismiss());
1405 _dismiss(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
1407 Elm_Ctxpopup_Smart_Data *sd = _pd;
1409 _hide_signals_emit(obj, sd->dir);
1413 _class_constructor(Eo_Class *klass)
1415 const Eo_Op_Func_Description func_desc[] = {
1416 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
1418 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _elm_ctxpopup_smart_add),
1419 EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DEL), _elm_ctxpopup_smart_del),
1421 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_PARENT_SET), _elm_ctxpopup_smart_parent_set),
1422 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_DISABLE), _elm_ctxpopup_smart_disable),
1423 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_EVENT), _elm_ctxpopup_smart_event),
1424 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_THEME), _elm_ctxpopup_smart_theme),
1425 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_SUB_OBJECT_ADD), _elm_ctxpopup_smart_sub_object_add),
1426 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT_MANAGER_IS), _elm_ctxpopup_smart_focus_next_manager_is),
1427 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT), _elm_ctxpopup_smart_focus_next),
1428 EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_DIRECTION_MANAGER_IS), _elm_ctxpopup_smart_focus_direction_manager_is),
1430 EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_SET), _elm_ctxpopup_smart_content_set),
1431 EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_GET), _elm_ctxpopup_smart_content_get),
1432 EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_UNSET), _elm_ctxpopup_smart_content_unset),
1434 EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_SIZING_EVAL), _elm_ctxpopup_smart_sizing_eval),
1435 EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_SUB_OBJECT_ADD_ENABLE), _elm_ctxpopup_smart_layout_sub_object_add_enable),
1437 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_HOVER_PARENT_SET), _hover_parent_set),
1438 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_HOVER_PARENT_GET), _hover_parent_get),
1439 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_CLEAR), _clear),
1440 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_HORIZONTAL_SET), _horizontal_set),
1441 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_HORIZONTAL_GET), _horizontal_get),
1442 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_ITEM_APPEND), _item_append),
1443 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_PRIORITY_SET), _direction_priority_set),
1444 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_PRIORITY_GET), _direction_priority_get),
1445 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_GET), _direction_get),
1446 EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_DISMISS), _dismiss),
1449 eo_class_funcs_set(klass, func_desc);
1451 evas_smart_legacy_type_register(MY_CLASS_NAME, klass);
1453 static const Eo_Op_Description op_desc[] = {
1454 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_HOVER_PARENT_SET, "Set the Ctxpopup's parent."),
1455 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_HOVER_PARENT_GET, "Get the Ctxpopup's parent."),
1456 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_CLEAR, "Clear all items in the given ctxpopup object."),
1457 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_HORIZONTAL_SET, "Change the ctxpopup's orientation to horizontal or vertical."),
1458 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_HORIZONTAL_GET, "Get the value of current ctxpopup object's orientation."),
1459 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_ITEM_APPEND, "Add a new item to a ctxpopup object."),
1460 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_PRIORITY_SET, "Set the direction priority of a ctxpopup."),
1461 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_PRIORITY_GET, "Get the direction priority of a ctxpopup."),
1462 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_GET, "Get the current direction of a ctxpopup."),
1463 EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_DISMISS, "Dismiss a ctxpopup object."),
1464 EO_OP_DESCRIPTION_SENTINEL
1466 static const Eo_Class_Description class_desc = {
1469 EO_CLASS_TYPE_REGULAR,
1470 EO_CLASS_DESCRIPTION_OPS(&ELM_OBJ_CTXPOPUP_BASE_ID, op_desc, ELM_OBJ_CTXPOPUP_SUB_ID_LAST),
1472 sizeof(Elm_Ctxpopup_Smart_Data),
1476 EO_DEFINE_CLASS(elm_obj_ctxpopup_class_get, &class_desc, ELM_OBJ_LAYOUT_CLASS, NULL);