1 #include <Elementary.h>
2 #include <Elementary_Cursor.h>
4 #include "els_scroller.h"
6 #include "elm_genlist.h"
10 * Handle non-homogeneous objects too.
14 #define REORDER_EFFECT_TIME 0.5
16 #define ELM_GEN_SETUP(wd) \
17 (wd)->calc_cb = (Ecore_Cb)_calc_job
19 #define ELM_GEN_ITEM_SETUP(it) \
20 (it)->del_cb = (Ecore_Cb)_item_del; \
21 (it)->highlight_cb = (Ecore_Cb)_item_highlight; \
22 (it)->unsel_cb = (Ecore_Cb)_item_unselect; \
23 (it)->unrealize_cb = (Ecore_Cb)_item_unrealize_cb
25 struct Elm_Gen_Item_Type
28 Ecore_Animator *item_moving_effect_timer;
29 Evas_Coord gx, gy, ox, oy, tx, ty, rx, ry;
30 unsigned int moving_effect_start_time;
33 Eina_Bool group_realized : 1;
39 Eina_Inlist_Sorted_State *state;
40 Evas_Object *obj; /* the gengrid object */
41 Evas_Object *scr; /* a smart scroller object which is used internally in genlist */
42 Evas_Object *pan_smart; /* "elm_genlist_pan" evas smart object. this is an extern pan of smart scroller(scr). */
44 Eina_List *group_items; /* list of groups index items */
45 Eina_Inlist *items; /* inlist of all items */
46 Elm_Gen_Item *reorder_it; /* item currently being repositioned */
47 Elm_Gen_Item *last_selected_item;
48 Pan *pan; /* pan_smart object's smart data */
51 int item_width, item_height;
52 int group_item_width, group_item_height;
55 Evas_Coord pan_x, pan_y;
56 Eina_Bool reorder_mode : 1;
57 Eina_Bool on_hold : 1;
59 Eina_Bool no_select : 1;
60 Eina_Bool wasselected : 1;
61 Eina_Bool always_select : 1;
62 Eina_Bool clear_me : 1;
63 Eina_Bool h_bounce : 1;
64 Eina_Bool v_bounce : 1;
65 Ecore_Cb del_cb, calc_cb, sizing_cb;
67 ////////////////////////////////////
68 double align_x, align_y;
70 Evas_Coord old_pan_x, old_pan_y;
71 Evas_Coord reorder_item_x, reorder_item_y;
75 Eina_Bool horizontal : 1;
76 Eina_Bool longpressed : 1;
77 Eina_Bool reorder_item_changed : 1;
78 Eina_Bool move_effect_enabled : 1;
81 static const char *widtype = NULL;
82 static void _item_highlight(Elm_Gen_Item *it);
83 static void _item_unrealize_cb(Elm_Gen_Item *it);
84 static void _item_unselect(Elm_Gen_Item *it);
85 static void _calc_job(void *data);
86 static void _on_focus_hook(void *data,
88 static Eina_Bool _item_multi_select_up(Widget_Data *wd);
89 static Eina_Bool _item_multi_select_down(Widget_Data *wd);
90 static Eina_Bool _item_multi_select_left(Widget_Data *wd);
91 static Eina_Bool _item_multi_select_right(Widget_Data *wd);
92 static Eina_Bool _item_single_select_up(Widget_Data *wd);
93 static Eina_Bool _item_single_select_down(Widget_Data *wd);
94 static Eina_Bool _item_single_select_left(Widget_Data *wd);
95 static Eina_Bool _item_single_select_right(Widget_Data *wd);
96 static Eina_Bool _event_hook(Evas_Object *obj,
98 Evas_Callback_Type type,
100 static Eina_Bool _deselect_all_items(Widget_Data *wd);
102 static Evas_Smart_Class _pan_sc = EVAS_SMART_CLASS_INIT_VERSION;
103 static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
105 static const char SIG_ACTIVATED[] = "activated";
106 static const char SIG_CLICKED_DOUBLE[] = "clicked,double";
107 static const char SIG_LONGPRESSED[] = "longpressed";
108 static const char SIG_SELECTED[] = "selected";
109 static const char SIG_UNSELECTED[] = "unselected";
110 static const char SIG_REALIZED[] = "realized";
111 static const char SIG_UNREALIZED[] = "unrealized";
112 static const char SIG_CHANGED[] = "changed";
113 static const char SIG_DRAG_START_UP[] = "drag,start,up";
114 static const char SIG_DRAG_START_DOWN[] = "drag,start,down";
115 static const char SIG_DRAG_START_LEFT[] = "drag,start,left";
116 static const char SIG_DRAG_START_RIGHT[] = "drag,start,right";
117 static const char SIG_DRAG_STOP[] = "drag,stop";
118 static const char SIG_DRAG[] = "drag";
119 static const char SIG_SCROLL[] = "scroll";
120 static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
121 static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
122 static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
123 static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
124 static const char SIG_EDGE_TOP[] = "edge,top";
125 static const char SIG_EDGE_BOTTOM[] = "edge,bottom";
126 static const char SIG_EDGE_LEFT[] = "edge,left";
127 static const char SIG_EDGE_RIGHT[] = "edge,right";
128 static const char SIG_MOVED[] = "moved";
130 static const Evas_Smart_Cb_Description _signals[] = {
132 {SIG_CLICKED_DOUBLE, ""},
133 {SIG_LONGPRESSED, ""},
135 {SIG_UNSELECTED, ""},
137 {SIG_UNREALIZED, ""},
139 {SIG_DRAG_START_UP, ""},
140 {SIG_DRAG_START_DOWN, ""},
141 {SIG_DRAG_START_LEFT, ""},
142 {SIG_DRAG_START_RIGHT, ""},
146 {SIG_SCROLL_ANIM_START, ""},
147 {SIG_SCROLL_ANIM_STOP, ""},
148 {SIG_SCROLL_DRAG_START, ""},
149 {SIG_SCROLL_DRAG_STOP, ""},
151 {SIG_EDGE_BOTTOM, ""},
153 {SIG_EDGE_RIGHT, ""},
158 static Eina_Compare_Cb _elm_gengrid_item_compare_cb;
159 static Eina_Compare_Cb _elm_gengrid_item_compare_data_cb;
162 _event_hook(Evas_Object *obj,
163 Evas_Object *src __UNUSED__,
164 Evas_Callback_Type type,
167 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
168 Evas_Event_Key_Down *ev = event_info;
169 Widget_Data *wd = elm_widget_data_get(obj);
170 if (!wd) return EINA_FALSE;
171 if (!wd->items) return EINA_FALSE;
172 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
173 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
175 Elm_Gen_Item *it = NULL;
178 Evas_Coord step_x = 0;
179 Evas_Coord step_y = 0;
182 Evas_Coord page_x = 0;
183 Evas_Coord page_y = 0;
185 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
186 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
187 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
188 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
190 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
192 if ((wd->horizontal) &&
193 (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
194 (_item_multi_select_up(wd)))
195 || (_item_single_select_up(wd))))
197 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
200 else if ((!wd->horizontal) &&
201 (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
202 (_item_multi_select_left(wd)))
203 || (_item_single_select_left(wd))))
205 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
211 else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")))
213 if ((wd->horizontal) &&
214 (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
215 (_item_multi_select_down(wd)))
216 || (_item_single_select_down(wd))))
218 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
221 else if ((!wd->horizontal) &&
222 (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
223 (_item_multi_select_right(wd)))
224 || (_item_single_select_right(wd))))
226 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
232 else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
234 if ((wd->horizontal) &&
235 (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
236 (_item_multi_select_left(wd)))
237 || (_item_single_select_left(wd))))
239 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
242 else if ((!wd->horizontal) &&
243 (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
244 (_item_multi_select_up(wd)))
245 || (_item_single_select_up(wd))))
247 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
253 else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
255 if ((wd->horizontal) &&
256 (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
257 (_item_multi_select_right(wd)))
258 || (_item_single_select_right(wd))))
260 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
263 else if ((!wd->horizontal) &&
264 (((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
265 (_item_multi_select_down(wd)))
266 || (_item_single_select_down(wd))))
268 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
274 else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
276 it = elm_gengrid_first_item_get(obj);
277 elm_gengrid_item_bring_in(it);
278 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
281 else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
283 it = elm_gengrid_last_item_get(obj);
284 elm_gengrid_item_bring_in(it);
285 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
288 else if ((!strcmp(ev->keyname, "Prior")) || (!strcmp(ev->keyname, "KP_Prior")))
293 x -= -(page_x * v_w) / 100;
300 y -= -(page_y * v_h) / 100;
305 else if ((!strcmp(ev->keyname, "Next")) || (!strcmp(ev->keyname, "KP_Next")))
310 x += -(page_x * v_w) / 100;
317 y += -(page_y * v_h) / 100;
322 else if (!strcmp(ev->keyname, "Escape"))
324 if (!_deselect_all_items(wd)) return EINA_FALSE;
325 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
328 else if ((!strcmp(ev->keyname, "Return")) ||
329 (!strcmp(ev->keyname, "KP_Enter")) ||
330 (!strcmp(ev->keyname, "space")))
332 it = elm_gengrid_selected_item_get(obj);
333 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
335 else return EINA_FALSE;
337 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
338 elm_smart_scroller_child_pos_set(wd->scr, x, y);
343 _deselect_all_items(Widget_Data *wd)
345 if (!wd->selected) return EINA_FALSE;
347 elm_gengrid_item_selected_set(wd->selected->data, EINA_FALSE);
353 _item_multi_select_left(Widget_Data *wd)
355 if (!wd->selected) return EINA_FALSE;
357 Elm_Gen_Item *prev = elm_gengrid_item_prev_get(wd->last_selected_item);
358 if (!prev) return EINA_TRUE;
359 if (elm_gengrid_item_selected_get(prev))
361 elm_gengrid_item_selected_set(wd->last_selected_item, EINA_FALSE);
362 wd->last_selected_item = prev;
363 elm_gengrid_item_show(wd->last_selected_item);
367 elm_gengrid_item_selected_set(prev, EINA_TRUE);
368 elm_gengrid_item_show(prev);
375 _item_multi_select_right(Widget_Data *wd)
377 if (!wd->selected) return EINA_FALSE;
379 Elm_Gen_Item *next = elm_gengrid_item_next_get(wd->last_selected_item);
380 if (!next) return EINA_TRUE;
381 if (elm_gengrid_item_selected_get(next))
383 elm_gengrid_item_selected_set(wd->last_selected_item, EINA_FALSE);
384 wd->last_selected_item = next;
385 elm_gengrid_item_show(wd->last_selected_item);
389 elm_gengrid_item_selected_set(next, EINA_TRUE);
390 elm_gengrid_item_show(next);
397 _item_multi_select_up(Widget_Data *wd)
400 Eina_Bool r = EINA_TRUE;
402 if (!wd->selected) return EINA_FALSE;
404 for (i = 0; (r) && (i < wd->nmax); i++)
405 r &= _item_multi_select_left(wd);
411 _item_multi_select_down(Widget_Data *wd)
414 Eina_Bool r = EINA_TRUE;
416 if (!wd->selected) return EINA_FALSE;
418 for (i = 0; (r) && (i < wd->nmax); i++)
419 r &= _item_multi_select_right(wd);
425 _item_single_select_up(Widget_Data *wd)
433 prev = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
434 while ((prev) && (prev->delete_me))
435 prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
436 elm_gengrid_item_selected_set(prev, EINA_TRUE);
437 elm_gengrid_item_show(prev);
440 else prev = elm_gengrid_item_prev_get(wd->last_selected_item);
442 if (!prev) return EINA_FALSE;
444 for (i = 1; i < wd->nmax; i++)
446 Elm_Gen_Item *tmp = elm_gengrid_item_prev_get(prev);
447 if (!tmp) return EINA_FALSE;
451 _deselect_all_items(wd);
453 elm_gengrid_item_selected_set(prev, EINA_TRUE);
454 elm_gengrid_item_show(prev);
459 _item_single_select_down(Widget_Data *wd)
467 next = ELM_GEN_ITEM_FROM_INLIST(wd->items);
468 while ((next) && (next->delete_me))
469 next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
470 elm_gengrid_item_selected_set(next, EINA_TRUE);
471 elm_gengrid_item_show(next);
474 else next = elm_gengrid_item_next_get(wd->last_selected_item);
476 if (!next) return EINA_FALSE;
478 for (i = 1; i < wd->nmax; i++)
480 Elm_Gen_Item *tmp = elm_gengrid_item_next_get(next);
481 if (!tmp) return EINA_FALSE;
485 _deselect_all_items(wd);
487 elm_gengrid_item_selected_set(next, EINA_TRUE);
488 elm_gengrid_item_show(next);
493 _item_single_select_left(Widget_Data *wd)
498 prev = ELM_GEN_ITEM_FROM_INLIST(wd->items->last);
499 while ((prev) && (prev->delete_me))
500 prev = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(prev)->prev);
502 else prev = elm_gengrid_item_prev_get(wd->last_selected_item);
504 if (!prev) return EINA_FALSE;
506 _deselect_all_items(wd);
508 elm_gengrid_item_selected_set(prev, EINA_TRUE);
509 elm_gengrid_item_show(prev);
514 _item_single_select_right(Widget_Data *wd)
519 next = ELM_GEN_ITEM_FROM_INLIST(wd->items);
520 while ((next) && (next->delete_me))
521 next = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(next)->next);
523 else next = elm_gengrid_item_next_get(wd->last_selected_item);
525 if (!next) return EINA_FALSE;
527 _deselect_all_items(wd);
529 elm_gengrid_item_selected_set(next, EINA_TRUE);
530 elm_gengrid_item_show(next);
535 _on_focus_hook(void *data __UNUSED__,
538 Widget_Data *wd = elm_widget_data_get(obj);
540 if (elm_widget_focus_get(obj))
542 edje_object_signal_emit(wd->obj, "elm,action,focus", "elm");
543 evas_object_focus_set(wd->obj, EINA_TRUE);
544 if ((wd->selected) && (!wd->last_selected_item))
545 wd->last_selected_item = eina_list_data_get(wd->selected);
549 edje_object_signal_emit(wd->obj, "elm,action,unfocus", "elm");
550 evas_object_focus_set(wd->obj, EINA_FALSE);
555 _mirrored_set(Evas_Object *obj, Eina_Bool rtl)
557 Widget_Data *wd = elm_widget_data_get(obj);
560 elm_smart_scroller_mirrored_set(wd->scr, rtl);
561 if (!wd->items) return;
562 it = ELM_GEN_ITEM_FROM_INLIST(wd->items);
566 edje_object_mirrored_set(VIEW(it), rtl);
567 elm_gengrid_item_update(it);
568 it = ELM_GEN_ITEM_FROM_INLIST(EINA_INLIST_GET(it)->next);
573 _theme_hook(Evas_Object *obj)
575 Widget_Data *wd = elm_widget_data_get(obj);
577 _elm_widget_mirrored_reload(obj);
578 _mirrored_set(obj, elm_widget_mirrored_get(obj));
579 elm_smart_scroller_object_theme_set(obj, wd->scr, "gengrid", "base",
580 elm_widget_style_get(obj));
584 _del_pre_hook(Evas_Object *obj)
586 Widget_Data *wd = elm_widget_data_get(obj);
588 elm_gengrid_clear(obj);
589 evas_object_del(wd->pan_smart);
590 wd->pan_smart = NULL;
594 _del_hook(Evas_Object *obj)
596 Widget_Data *wd = elm_widget_data_get(obj);
597 if (wd->calc_job) ecore_job_del(wd->calc_job);
602 _signal_emit_hook(Evas_Object *obj,
603 const char *emission,
606 Widget_Data *wd = elm_widget_data_get(obj);
608 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
613 _signal_callback_add_hook(Evas_Object *obj,
614 const char *emission,
616 Edje_Signal_Cb func_cb,
619 Widget_Data *wd = elm_widget_data_get(obj);
621 edje_object_signal_callback_add(elm_smart_scroller_edje_object_get(wd->scr),
622 emission, source, func_cb, data);
626 _signal_callback_del_hook(Evas_Object *obj,
627 const char *emission,
629 Edje_Signal_Cb func_cb,
632 Widget_Data *wd = elm_widget_data_get(obj);
634 edje_object_signal_callback_del_full(elm_smart_scroller_edje_object_get(wd->scr),
635 emission, source, func_cb, data);
639 _mouse_move(void *data,
640 Evas *evas __UNUSED__,
644 Elm_Gen_Item *it = data;
645 Evas_Event_Mouse_Move *ev = event_info;
646 Evas_Coord minw = 0, minh = 0, x, y, dx, dy, adx, ady;
647 Evas_Coord ox, oy, ow, oh, it_scrl_x, it_scrl_y;
649 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
651 if (!it->wd->on_hold)
653 it->wd->on_hold = EINA_TRUE;
654 if (!it->wd->wasselected)
658 if ((it->dragging) && (it->down))
662 ecore_timer_del(it->long_timer);
663 it->long_timer = NULL;
665 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG, it);
668 if ((!it->down) || (it->wd->longpressed))
672 ecore_timer_del(it->long_timer);
673 it->long_timer = NULL;
675 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
677 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &ow, &oh);
679 it_scrl_x = ev->cur.canvas.x - it->wd->reorder_it->dx;
680 it_scrl_y = ev->cur.canvas.y - it->wd->reorder_it->dy;
682 if (it_scrl_x < ox) it->wd->reorder_item_x = ox;
683 else if (it_scrl_x + it->wd->item_width > ox + ow)
684 it->wd->reorder_item_x = ox + ow - it->wd->item_width;
685 else it->wd->reorder_item_x = it_scrl_x;
687 if (it_scrl_y < oy) it->wd->reorder_item_y = oy;
688 else if (it_scrl_y + it->wd->item_height > oy + oh)
689 it->wd->reorder_item_y = oy + oh - it->wd->item_height;
690 else it->wd->reorder_item_y = it_scrl_y;
692 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
693 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
697 if (!it->display_only)
698 elm_coords_finger_size_adjust(1, &minw, 1, &minh);
699 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
700 x = ev->cur.canvas.x - x;
701 y = ev->cur.canvas.y - y;
704 if (adx < 0) adx = -dx;
707 if (ady < 0) ady = -dy;
710 if ((adx > minw) || (ady > minh))
712 const char *left_drag, *right_drag;
713 if (!elm_widget_mirrored_get(WIDGET(it)))
715 left_drag = SIG_DRAG_START_LEFT;
716 right_drag = SIG_DRAG_START_RIGHT;
720 left_drag = SIG_DRAG_START_RIGHT;
721 right_drag = SIG_DRAG_START_LEFT;
727 ecore_timer_del(it->long_timer);
728 it->long_timer = NULL;
730 if (!it->wd->wasselected)
735 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_START_UP,
740 evas_object_smart_callback_call(WIDGET(it),
747 evas_object_smart_callback_call(WIDGET(it),
748 SIG_DRAG_START_DOWN, it);
752 evas_object_smart_callback_call(WIDGET(it),
755 evas_object_smart_callback_call(WIDGET(it),
763 _long_press(void *data)
765 Elm_Gen_Item *it = data;
767 it->long_timer = NULL;
768 if ((it->disabled) || (it->dragging)) return ECORE_CALLBACK_CANCEL;
769 it->wd->longpressed = EINA_TRUE;
770 evas_object_smart_callback_call(WIDGET(it), SIG_LONGPRESSED, it);
771 if (it->wd->reorder_mode)
773 it->wd->reorder_it = it;
774 evas_object_raise(VIEW(it));
775 elm_smart_scroller_hold_set(it->wd->scr, EINA_TRUE);
776 elm_smart_scroller_bounce_allow_set(it->wd->scr, EINA_FALSE, EINA_FALSE);
777 edje_object_signal_emit(VIEW(it), "elm,state,reorder,enabled", "elm");
779 return ECORE_CALLBACK_CANCEL;
783 _mouse_down(void *data,
784 Evas *evas __UNUSED__,
788 Elm_Gen_Item *it = data;
789 Evas_Event_Mouse_Down *ev = event_info;
792 if (ev->button != 1) return;
795 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
796 it->dx = ev->canvas.x - x;
797 it->dy = ev->canvas.y - y;
798 it->wd->longpressed = EINA_FALSE;
799 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
800 else it->wd->on_hold = EINA_FALSE;
801 it->wd->wasselected = it->selected;
803 if (ev->flags & EVAS_BUTTON_DOUBLE_CLICK)
805 evas_object_smart_callback_call(WIDGET(it), SIG_CLICKED_DOUBLE, it);
806 evas_object_smart_callback_call(WIDGET(it), SIG_ACTIVATED, it);
808 if (it->long_timer) ecore_timer_del(it->long_timer);
810 it->long_timer = ecore_timer_add(_elm_config->longpress_timeout,
813 it->long_timer = NULL;
817 _mouse_up(void *data,
818 Evas *evas __UNUSED__,
819 Evas_Object *obj __UNUSED__,
822 Elm_Gen_Item *it = data;
823 Evas_Event_Mouse_Up *ev = event_info;
824 Eina_Bool dragged = EINA_FALSE;
826 if (ev->button != 1) return;
827 it->down = EINA_FALSE;
828 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) it->wd->on_hold = EINA_TRUE;
829 else it->wd->on_hold = EINA_FALSE;
832 ecore_timer_del(it->long_timer);
833 it->long_timer = NULL;
837 it->dragging = EINA_FALSE;
838 evas_object_smart_callback_call(WIDGET(it), SIG_DRAG_STOP, it);
843 it->wd->longpressed = EINA_FALSE;
844 it->wd->on_hold = EINA_FALSE;
847 if ((it->wd->reorder_mode) && (it->wd->reorder_it))
849 evas_object_smart_callback_call(WIDGET(it), SIG_MOVED, it->wd->reorder_it);
850 it->wd->reorder_it = NULL;
851 it->wd->move_effect_enabled = EINA_FALSE;
852 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
853 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
855 elm_smart_scroller_hold_set(it->wd->scr, EINA_FALSE);
856 elm_smart_scroller_bounce_allow_set(it->wd->scr, it->wd->h_bounce, it->wd->v_bounce);
857 edje_object_signal_emit(VIEW(it), "elm,state,reorder,disabled", "elm");
859 if (it->wd->longpressed)
861 it->wd->longpressed = EINA_FALSE;
862 if (!it->wd->wasselected) _item_unselect(it);
863 it->wd->wasselected = EINA_FALSE;
868 if (it->want_unrealize)
869 elm_gen_item_unrealize(it, EINA_FALSE);
871 if ((it->disabled) || (dragged)) return;
879 else _item_unselect(it);
885 while (it->wd->selected)
886 _item_unselect(it->wd->selected->data);
890 const Eina_List *l, *l_next;
893 EINA_LIST_FOREACH_SAFE(it->wd->selected, l, l_next, item2)
894 if (item2 != it) _item_unselect(item2);
902 _item_highlight(Elm_Gen_Item *it)
904 if ((it->wd->no_select) || (it->delete_me) || (it->highlighted)) return;
905 edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
906 it->highlighted = EINA_TRUE;
910 _item_realize(Elm_Gen_Item *it)
915 if ((it->realized) || (it->delete_me)) return;
916 VIEW(it) = edje_object_add(evas_object_evas_get(WIDGET(it)));
917 edje_object_scale_set(VIEW(it), elm_widget_scale_get(WIDGET(it)) *
919 edje_object_mirrored_set(VIEW(it), elm_widget_mirrored_get(WIDGET(it)));
920 evas_object_smart_member_add(VIEW(it), it->wd->pan_smart);
921 elm_widget_sub_object_add(WIDGET(it), VIEW(it));
922 snprintf(style, sizeof(style), "item/%s",
923 it->itc->item_style ? it->itc->item_style : "default");
924 _elm_theme_object_set(WIDGET(it), VIEW(it), "gengrid", style,
925 elm_widget_style_get(WIDGET(it)));
927 evas_object_rectangle_add(evas_object_evas_get(WIDGET(it)));
928 evas_object_color_set(it->spacer, 0, 0, 0, 0);
929 elm_widget_sub_object_add(WIDGET(it), it->spacer);
930 evas_object_size_hint_min_set(it->spacer, 2 * _elm_config->scale, 1);
931 edje_object_part_swallow(VIEW(it), "elm.swallow.pad", it->spacer);
933 if (it->itc->func.label_get)
939 elm_widget_stringlist_get(edje_object_data_get(VIEW(it),
941 EINA_LIST_FOREACH(it->labels, l, key)
943 char *s = it->itc->func.label_get
944 ((void *)it->base.data, WIDGET(it), key);
947 edje_object_part_text_set(VIEW(it), key, s);
953 if (it->itc->func.content_get)
957 Evas_Object *ic = NULL;
960 elm_widget_stringlist_get(edje_object_data_get(VIEW(it),
962 EINA_LIST_FOREACH(it->contents, l, key)
964 if (it->itc->func.content_get)
965 ic = it->itc->func.content_get
966 ((void *)it->base.data, WIDGET(it), key);
969 it->content_objs = eina_list_append(it->content_objs, ic);
970 edje_object_part_swallow(VIEW(it), key, ic);
971 evas_object_show(ic);
972 elm_widget_sub_object_add(WIDGET(it), ic);
977 if (it->itc->func.state_get)
983 elm_widget_stringlist_get(edje_object_data_get(VIEW(it),
985 EINA_LIST_FOREACH(it->states, l, key)
987 Eina_Bool on = it->itc->func.state_get
988 ((void *)it->base.data, WIDGET(it), l->data);
991 snprintf(buf, sizeof(buf), "elm,state,%s,active", key);
992 edje_object_signal_emit(VIEW(it), buf, "elm");
999 if ((!it->wd->group_item_width) && (!it->wd->group_item_height))
1001 edje_object_size_min_restricted_calc(VIEW(it),
1002 &it->wd->group_item_width,
1003 &it->wd->group_item_height,
1004 it->wd->group_item_width,
1005 it->wd->group_item_height);
1010 if ((!it->wd->item_width) && (!it->wd->item_height))
1012 edje_object_size_min_restricted_calc(VIEW(it),
1013 &it->wd->item_width,
1014 &it->wd->item_height,
1016 it->wd->item_height);
1017 elm_coords_finger_size_adjust(1, &it->wd->item_width,
1018 1, &it->wd->item_height);
1021 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_DOWN,
1023 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_UP,
1025 evas_object_event_callback_add(VIEW(it), EVAS_CALLBACK_MOUSE_MOVE,
1029 edje_object_signal_emit(VIEW(it), "elm,state,selected", "elm");
1031 edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
1033 evas_object_show(VIEW(it));
1035 if (it->tooltip.content_cb)
1037 elm_widget_item_tooltip_content_cb_set(it,
1038 it->tooltip.content_cb,
1039 it->tooltip.data, NULL);
1040 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
1041 elm_widget_item_tooltip_size_restrict_disable(it, it->tooltip.free_size);
1044 if (it->mouse_cursor)
1045 elm_widget_item_cursor_set(it, it->mouse_cursor);
1047 it->realized = EINA_TRUE;
1048 it->want_unrealize = EINA_FALSE;
1052 _item_unrealize_cb(Elm_Gen_Item *it)
1054 evas_object_del(VIEW(it));
1056 evas_object_del(it->spacer);
1061 _reorder_item_moving_effect_timer_cb(void *data)
1063 Elm_Gen_Item *it = data;
1067 time = REORDER_EFFECT_TIME;
1068 t = ((0.0 > (t = ecore_loop_time_get()-it->item->moving_effect_start_time)) ? 0.0 : t);
1069 dx = ((it->item->tx - it->item->ox) / 10) * _elm_config->scale;
1070 dy = ((it->item->ty - it->item->oy) / 10) * _elm_config->scale;
1074 it->item->rx += (1 * sin((t / time) * (M_PI / 2)) * dx);
1075 it->item->ry += (1 * sin((t / time) * (M_PI / 2)) * dy);
1083 if ((((dx > 0) && (it->item->rx >= it->item->tx)) || ((dx <= 0) && (it->item->rx <= it->item->tx))) &&
1084 (((dy > 0) && (it->item->ry >= it->item->ty)) || ((dy <= 0) && (it->item->ry <= it->item->ty))))
1086 evas_object_move(VIEW(it), it->item->tx, it->item->ty);
1090 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &vw, &vh);
1091 if (it->wd->horizontal)
1092 evas_object_resize(VIEW(it), it->wd->group_item_width, vh);
1094 evas_object_resize(VIEW(it), vw, it->wd->group_item_height);
1097 evas_object_resize(VIEW(it), it->wd->item_width, it->wd->item_height);
1098 it->item->moving = EINA_FALSE;
1099 it->item->item_moving_effect_timer = NULL;
1100 return ECORE_CALLBACK_CANCEL;
1103 evas_object_move(VIEW(it), it->item->rx, it->item->ry);
1107 evas_object_geometry_get(it->wd->pan_smart, NULL, NULL, &vw, &vh);
1108 if (it->wd->horizontal)
1109 evas_object_resize(VIEW(it), it->wd->group_item_width, vh);
1111 evas_object_resize(VIEW(it), vw, it->wd->group_item_height);
1114 evas_object_resize(VIEW(it), it->wd->item_width, it->wd->item_height);
1116 return ECORE_CALLBACK_RENEW;
1120 _group_item_place(Pan *sd)
1122 Evas_Coord iw, ih, vw, vh;
1124 Eina_Bool was_realized;
1126 evas_object_geometry_get(sd->wd->pan_smart, NULL, NULL, &vw, &vh);
1127 if (sd->wd->horizontal)
1129 iw = sd->wd->group_item_width;
1135 ih = sd->wd->group_item_height;
1137 EINA_LIST_FOREACH(sd->wd->group_items, l, it)
1139 was_realized = it->realized;
1140 if (it->item->group_realized)
1144 evas_object_smart_callback_call(WIDGET(it), SIG_REALIZED, it);
1145 evas_object_move(VIEW(it), it->item->gx, it->item->gy);
1146 evas_object_resize(VIEW(it), iw, ih);
1147 evas_object_raise(VIEW(it));
1150 elm_gen_item_unrealize(it, EINA_FALSE);
1156 _item_place(Elm_Gen_Item *it,
1160 Evas_Coord x, y, ox, oy, cvx, cvy, cvw, cvh, iw, ih, ww;
1161 Evas_Coord tch, tcw, alignw = 0, alignh = 0, vw, vh;
1162 Eina_Bool reorder_item_move_forward = EINA_FALSE;
1166 evas_object_geometry_get(it->wd->pan_smart, &ox, &oy, &vw, &vh);
1168 /* Preload rows/columns at each side of the Gengrid */
1169 cvx = ox - PRELOAD * it->wd->item_width;
1170 cvy = oy - PRELOAD * it->wd->item_height;
1171 cvw = vw + 2 * PRELOAD * it->wd->item_width;
1172 cvh = vh + 2 * PRELOAD * it->wd->item_height;
1177 items_count = it->wd->count - eina_list_count(it->wd->group_items) + it->wd->items_lost;
1178 if (it->wd->horizontal)
1180 int columns, items_visible = 0, items_row;
1182 if (it->wd->item_height > 0)
1183 items_visible = vh / it->wd->item_height;
1184 if (items_visible < 1)
1187 columns = items_count / items_visible;
1188 if (items_count % items_visible)
1191 tcw = (it->wd->item_width * columns) + (it->wd->group_item_width * eina_list_count(it->wd->group_items));
1192 alignw = (vw - tcw) * it->wd->align_x;
1194 items_row = items_visible;
1195 if (items_row > it->wd->count)
1196 items_row = it->wd->count;
1197 tch = items_row * it->wd->item_height;
1198 alignh = (vh - tch) * it->wd->align_y;
1202 int rows, items_visible = 0, items_col;
1204 if (it->wd->item_width > 0)
1205 items_visible = vw / it->wd->item_width;
1206 if (items_visible < 1)
1209 rows = items_count / items_visible;
1210 if (items_count % items_visible)
1213 tch = (it->wd->item_height * rows) + (it->wd->group_item_height * eina_list_count(it->wd->group_items));
1214 alignh = (vh - tch) * it->wd->align_y;
1216 items_col = items_visible;
1217 if (items_col > it->wd->count)
1218 items_col = it->wd->count;
1219 tcw = items_col * it->wd->item_width;
1220 alignw = (vw - tcw) * it->wd->align_x;
1225 if (it->wd->horizontal)
1227 x = (((cx - it->item->prev_group) * it->wd->item_width) + (it->item->prev_group * it->wd->group_item_width)) - it->wd->pan_x + ox + alignw;
1229 iw = it->wd->group_item_width;
1235 y = (((cy - it->item->prev_group) * it->wd->item_height) + (it->item->prev_group * it->wd->group_item_height)) - it->wd->pan_y + oy + alignh;
1237 ih = it->wd->group_item_height;
1244 if (it->wd->horizontal)
1246 x = (((cx - it->item->prev_group) * it->wd->item_width) + (it->item->prev_group * it->wd->group_item_width)) - it->wd->pan_x + ox + alignw;
1247 y = (cy * it->wd->item_height) - it->wd->pan_y + oy + alignh;
1251 x = (cx * it->wd->item_width) - it->wd->pan_x + ox + alignw;
1252 y = (((cy - it->item->prev_group) * it->wd->item_height) + (it->item->prev_group * it->wd->group_item_height)) - it->wd->pan_y + oy + alignh;
1254 if (elm_widget_mirrored_get(WIDGET(it)))
1255 { /* Switch items side and componsate for pan_x when in RTL mode */
1256 evas_object_geometry_get(WIDGET(it), NULL, NULL, &ww, NULL);
1257 x = ww - x - it->wd->item_width - it->wd->pan_x - it->wd->pan_x;
1259 iw = it->wd->item_width;
1260 ih = it->wd->item_height;
1263 Eina_Bool was_realized = it->realized;
1264 if (ELM_RECTS_INTERSECT(x, y, iw, ih, cvx, cvy, cvw, cvh))
1268 evas_object_smart_callback_call(WIDGET(it), SIG_REALIZED, it);
1271 if (it->wd->horizontal)
1273 if (it->parent->item->gx < ox)
1275 it->parent->item->gx = x + it->wd->item_width - it->wd->group_item_width;
1276 if (it->parent->item->gx > ox)
1277 it->parent->item->gx = ox;
1279 it->parent->item->group_realized = EINA_TRUE;
1283 if (it->parent->item->gy < oy)
1285 it->parent->item->gy = y + it->wd->item_height - it->wd->group_item_height;
1286 if (it->parent->item->gy > oy)
1287 it->parent->item->gy = oy;
1289 it->parent->item->group_realized = EINA_TRUE;
1292 if (it->wd->reorder_mode)
1294 if (it->wd->reorder_it)
1296 if (it->item->moving) return;
1298 if (!it->wd->move_effect_enabled)
1303 if (it->wd->reorder_it == it)
1305 evas_object_move(VIEW(it),
1306 it->wd->reorder_item_x, it->wd->reorder_item_y);
1307 evas_object_resize(VIEW(it), iw, ih);
1312 if (it->wd->move_effect_enabled)
1314 if ((it->item->ox != x) || (it->item->oy != y))
1316 if (((it->wd->old_pan_x == it->wd->pan_x) && (it->wd->old_pan_y == it->wd->pan_y)) ||
1317 ((it->wd->old_pan_x != it->wd->pan_x) && !(it->item->ox - it->wd->pan_x + it->wd->old_pan_x == x)) ||
1318 ((it->wd->old_pan_y != it->wd->pan_y) && !(it->item->oy - it->wd->pan_y + it->wd->old_pan_y == y)))
1322 it->item->rx = it->item->ox;
1323 it->item->ry = it->item->oy;
1324 it->item->moving = EINA_TRUE;
1325 it->item->moving_effect_start_time = ecore_loop_time_get();
1326 it->item->item_moving_effect_timer = ecore_animator_add(_reorder_item_moving_effect_timer_cb, it);
1333 Evas_Coord nx, ny, nw, nh;
1336 if (it->wd->horizontal)
1338 nx = x + (it->wd->group_item_width / 2);
1346 ny = y + (it->wd->group_item_height / 2);
1353 nx = x + (it->wd->item_width / 2);
1354 ny = y + (it->wd->item_height / 2);
1359 if ( ELM_RECTS_INTERSECT(it->wd->reorder_item_x, it->wd->reorder_item_y,
1360 it->wd->item_width, it->wd->item_height,
1363 if (it->wd->horizontal)
1365 if ((it->wd->nmax * it->wd->reorder_it->x + it->wd->reorder_it->y) >
1366 (it->wd->nmax * it->x + it->y))
1367 reorder_item_move_forward = EINA_TRUE;
1371 if ((it->wd->nmax * it->wd->reorder_it->y + it->wd->reorder_it->x) >
1372 (it->wd->nmax * it->y + it->x))
1373 reorder_item_move_forward = EINA_TRUE;
1376 it->wd->items = eina_inlist_remove(it->wd->items,
1377 EINA_INLIST_GET(it->wd->reorder_it));
1378 if (reorder_item_move_forward)
1379 it->wd->items = eina_inlist_prepend_relative(it->wd->items,
1380 EINA_INLIST_GET(it->wd->reorder_it),
1381 EINA_INLIST_GET(it));
1383 it->wd->items = eina_inlist_append_relative(it->wd->items,
1384 EINA_INLIST_GET(it->wd->reorder_it),
1385 EINA_INLIST_GET(it));
1387 it->wd->reorder_item_changed = EINA_TRUE;
1388 it->wd->move_effect_enabled = EINA_TRUE;
1389 if (it->wd->calc_job) ecore_job_del(it->wd->calc_job);
1390 it->wd->calc_job = ecore_job_add(_calc_job, it->wd);
1396 else if (it->item->item_moving_effect_timer)
1398 ecore_animator_del(it->item->item_moving_effect_timer);
1399 it->item->item_moving_effect_timer = NULL;
1400 it->item->moving = EINA_FALSE;
1405 evas_object_move(VIEW(it), x, y);
1406 evas_object_resize(VIEW(it), iw, ih);
1409 it->item->group_realized = EINA_TRUE;
1414 elm_gen_item_unrealize(it, EINA_FALSE);
1416 it->item->group_realized = EINA_FALSE;
1421 _item_del(Elm_Gen_Item *it)
1423 Evas_Object *obj = WIDGET(it);
1425 evas_event_freeze(evas_object_evas_get(obj));
1426 it->wd->selected = eina_list_remove(it->wd->selected, it);
1427 if (it->realized) elm_gen_item_unrealize(it, EINA_FALSE);
1429 elm_gen_item_del_serious(it);
1430 evas_event_thaw(evas_object_evas_get(obj));
1431 evas_event_thaw_eval(evas_object_evas_get(obj));
1435 _item_unselect(Elm_Gen_Item *it)
1437 if ((it->delete_me) || (!it->highlighted)) return;
1438 edje_object_signal_emit(VIEW(it), "elm,state,unselected", "elm");
1439 it->highlighted = EINA_FALSE;
1442 it->selected = EINA_FALSE;
1443 it->wd->selected = eina_list_remove(it->wd->selected, it);
1444 evas_object_smart_callback_call(WIDGET(it), SIG_UNSELECTED, it);
1449 _calc_job(void *data)
1451 Widget_Data *wd = data;
1452 Evas_Coord minw = 0, minh = 0, nmax = 0, cvw, cvh;
1453 Elm_Gen_Item *it, *group_item = NULL;
1454 int count_group = 0;
1458 evas_object_geometry_get(wd->pan_smart, NULL, NULL, &cvw, &cvh);
1459 if ((cvw != 0) || (cvh != 0))
1461 if ((wd->horizontal) && (wd->item_height > 0))
1462 nmax = cvh / wd->item_height;
1463 else if (wd->item_width > 0)
1464 nmax = cvw / wd->item_width;
1469 EINA_INLIST_FOREACH(wd->items, it)
1471 if (it->item->prev_group != count_group)
1472 it->item->prev_group = count_group;
1475 count = count % nmax;
1477 wd->items_lost += nmax - count;
1478 //printf("%d items and I lost %d\n", count, wd->items_lost);
1480 if (count) count = 0;
1485 if (it->parent != group_item)
1486 it->parent = group_item;
1490 count = wd->count + wd->items_lost - count_group;
1493 minw = (ceil(count / (float)nmax) * wd->item_width) + (count_group * wd->group_item_width);
1494 minh = nmax * wd->item_height;
1498 minw = nmax * wd->item_width;
1499 minh = (ceil(count / (float)nmax) * wd->item_height) + (count_group * wd->group_item_height);
1502 if ((minw != wd->minw) || (minh != wd->minh))
1506 evas_object_smart_callback_call(wd->pan_smart, "changed", NULL);
1510 evas_object_smart_changed(wd->pan_smart);
1512 wd->calc_job = NULL;
1516 _pan_add(Evas_Object *obj)
1519 Evas_Object_Smart_Clipped_Data *cd;
1522 cd = evas_object_smart_data_get(obj);
1525 sd->__clipped_data = *cd;
1527 evas_object_smart_data_set(obj, sd);
1531 _pan_del(Evas_Object *obj)
1533 Pan *sd = evas_object_smart_data_get(obj);
1540 _pan_set(Evas_Object *obj,
1544 Pan *sd = evas_object_smart_data_get(obj);
1545 if ((x == sd->wd->pan_x) && (y == sd->wd->pan_y)) return;
1548 evas_object_smart_changed(obj);
1552 _pan_get(Evas_Object *obj,
1556 Pan *sd = evas_object_smart_data_get(obj);
1557 if (x) *x = sd->wd->pan_x;
1558 if (y) *y = sd->wd->pan_y;
1562 _pan_child_size_get(Evas_Object *obj,
1566 Pan *sd = evas_object_smart_data_get(obj);
1567 if (w) *w = sd->wd->minw;
1568 if (h) *h = sd->wd->minh;
1572 _pan_max_get(Evas_Object *obj,
1576 Pan *sd = evas_object_smart_data_get(obj);
1580 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
1582 *x = (ow < sd->wd->minw) ? sd->wd->minw - ow : 0;
1584 *y = (oh < sd->wd->minh) ? sd->wd->minh - oh : 0;
1588 _pan_min_get(Evas_Object *obj,
1592 Pan *sd = evas_object_smart_data_get(obj);
1596 _pan_max_get(obj, &mx, &my);
1598 *x = -mx * sd->wd->align_x;
1600 *y = -my * sd->wd->align_y;
1604 _pan_resize(Evas_Object *obj,
1608 Pan *sd = evas_object_smart_data_get(obj);
1611 evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
1612 if ((ow == w) && (oh == h)) return;
1613 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
1614 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
1618 _pan_calculate(Evas_Object *obj)
1620 Pan *sd = evas_object_smart_data_get(obj);
1621 Evas_Coord cx = 0, cy = 0;
1625 if (!sd->wd->nmax) return;
1627 sd->wd->reorder_item_changed = EINA_FALSE;
1629 EINA_INLIST_FOREACH(sd->wd->items, it)
1633 if (sd->wd->horizontal)
1650 _item_place(it, cx, cy);
1651 if (sd->wd->reorder_item_changed) return;
1654 if (sd->wd->horizontal)
1667 if (sd->wd->horizontal)
1669 cy = (cy + 1) % sd->wd->nmax;
1674 cx = (cx + 1) % sd->wd->nmax;
1679 _group_item_place(sd);
1682 if ((sd->wd->reorder_mode) && (sd->wd->reorder_it))
1684 if (!sd->wd->reorder_item_changed)
1686 sd->wd->old_pan_x = sd->wd->pan_x;
1687 sd->wd->old_pan_y = sd->wd->pan_y;
1689 sd->wd->move_effect_enabled = EINA_FALSE;
1691 evas_object_smart_callback_call(sd->wd->obj, SIG_CHANGED, NULL);
1695 _pan_move(Evas_Object *obj,
1696 Evas_Coord x __UNUSED__,
1697 Evas_Coord y __UNUSED__)
1699 Pan *sd = evas_object_smart_data_get(obj);
1701 if (sd->wd->calc_job) ecore_job_del(sd->wd->calc_job);
1702 sd->wd->calc_job = ecore_job_add(_calc_job, sd->wd);
1706 _hold_on(void *data __UNUSED__,
1708 void *event_info __UNUSED__)
1710 Widget_Data *wd = elm_widget_data_get(obj);
1712 elm_smart_scroller_hold_set(wd->scr, 1);
1716 _hold_off(void *data __UNUSED__,
1718 void *event_info __UNUSED__)
1720 Widget_Data *wd = elm_widget_data_get(obj);
1722 elm_smart_scroller_hold_set(wd->scr, 0);
1726 _freeze_on(void *data __UNUSED__,
1728 void *event_info __UNUSED__)
1730 Widget_Data *wd = elm_widget_data_get(obj);
1732 elm_smart_scroller_freeze_set(wd->scr, 1);
1736 _freeze_off(void *data __UNUSED__,
1738 void *event_info __UNUSED__)
1740 Widget_Data *wd = elm_widget_data_get(obj);
1742 elm_smart_scroller_freeze_set(wd->scr, 0);
1746 _scr_anim_start(void *data,
1747 Evas_Object *obj __UNUSED__,
1748 void *event_info __UNUSED__)
1750 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL);
1754 _scr_anim_stop(void *data,
1755 Evas_Object *obj __UNUSED__,
1756 void *event_info __UNUSED__)
1758 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
1762 _scr_drag_start(void *data,
1763 Evas_Object *obj __UNUSED__,
1764 void *event_info __UNUSED__)
1766 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
1770 _scr_drag_stop(void *data,
1771 Evas_Object *obj __UNUSED__,
1772 void *event_info __UNUSED__)
1774 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
1778 _edge_left(void *data,
1779 Evas_Object *scr __UNUSED__,
1780 void *event_info __UNUSED__)
1782 evas_object_smart_callback_call(data, SIG_EDGE_LEFT, NULL);
1786 _edge_right(void *data,
1787 Evas_Object *scr __UNUSED__,
1788 void *event_info __UNUSED__)
1790 evas_object_smart_callback_call(data, SIG_EDGE_RIGHT, NULL);
1794 _edge_top(void *data,
1795 Evas_Object *scr __UNUSED__,
1796 void *event_info __UNUSED__)
1798 evas_object_smart_callback_call(data, SIG_EDGE_TOP, NULL);
1802 _edge_bottom(void *data,
1803 Evas_Object *scr __UNUSED__,
1804 void *event_info __UNUSED__)
1806 evas_object_smart_callback_call(data, SIG_EDGE_BOTTOM, NULL);
1810 _scr_scroll(void *data,
1811 Evas_Object *obj __UNUSED__,
1812 void *event_info __UNUSED__)
1814 evas_object_smart_callback_call(data, SIG_SCROLL, NULL);
1818 _elm_gengrid_item_compare_data(const void *data, const void *data1)
1820 const Elm_Gen_Item *it = data;
1821 const Elm_Gen_Item *item1 = data1;
1823 return _elm_gengrid_item_compare_data_cb(it->base.data, item1->base.data);
1827 _elm_gengrid_item_compare(const void *data, const void *data1)
1829 Elm_Gen_Item *it, *item1;
1830 it = ELM_GEN_ITEM_FROM_INLIST(data);
1831 item1 = ELM_GEN_ITEM_FROM_INLIST(data1);
1832 return _elm_gengrid_item_compare_cb(it, item1);
1835 static Elm_Gen_Item *
1836 _item_new(Widget_Data *wd,
1837 const Elm_Gengrid_Item_Class *itc,
1840 const void *func_data)
1844 it = _elm_genlist_item_new(wd, itc, data, NULL, func, func_data);
1845 if (!it) return NULL;
1846 it->item = ELM_NEW(Elm_Gen_Item_Type);
1848 it->group = it->itc->item_style && (!strcmp(it->itc->item_style, "group_index"));
1849 ELM_GEN_ITEM_SETUP(it);
1855 elm_gengrid_add(Evas_Object *parent)
1860 static Evas_Smart *smart = NULL;
1861 Eina_Bool bounce = _elm_config->thumbscroll_bounce_enable;
1865 static Evas_Smart_Class sc;
1867 evas_object_smart_clipped_smart_set(&_pan_sc);
1869 sc.name = "elm_gengrid_pan";
1870 sc.version = EVAS_SMART_CLASS_VERSION;
1873 sc.resize = _pan_resize;
1874 sc.move = _pan_move;
1875 sc.calculate = _pan_calculate;
1876 if (!(smart = evas_smart_class_new(&sc))) return NULL;
1879 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
1881 ELM_SET_WIDTYPE(widtype, "gengrid");
1883 elm_widget_type_set(obj, "gengrid");
1884 elm_widget_sub_object_add(parent, obj);
1885 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
1886 elm_widget_data_set(obj, wd);
1887 elm_widget_del_hook_set(obj, _del_hook);
1888 elm_widget_del_pre_hook_set(obj, _del_pre_hook);
1889 elm_widget_theme_hook_set(obj, _theme_hook);
1890 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
1891 elm_widget_can_focus_set(obj, EINA_TRUE);
1892 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
1893 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
1894 elm_widget_event_hook_set(obj, _event_hook);
1896 wd->scr = elm_smart_scroller_add(e);
1897 elm_smart_scroller_widget_set(wd->scr, obj);
1898 elm_smart_scroller_object_theme_set(obj, wd->scr, "gengrid", "base",
1900 elm_smart_scroller_bounce_allow_set(wd->scr, bounce,
1901 _elm_config->thumbscroll_bounce_enable);
1902 elm_widget_resize_object_set(obj, wd->scr);
1904 evas_object_smart_callback_add(wd->scr, "animate,start", _scr_anim_start, obj);
1905 evas_object_smart_callback_add(wd->scr, "animate,stop", _scr_anim_stop, obj);
1906 evas_object_smart_callback_add(wd->scr, "drag,start", _scr_drag_start, obj);
1907 evas_object_smart_callback_add(wd->scr, "drag,stop", _scr_drag_stop, obj);
1908 evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj);
1909 evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj);
1910 evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj);
1911 evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom,
1913 evas_object_smart_callback_add(wd->scr, "scroll", _scr_scroll, obj);
1918 wd->h_bounce = bounce;
1919 wd->v_bounce = bounce;
1921 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
1922 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
1923 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
1924 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
1926 wd->pan_smart = evas_object_smart_add(e, smart);
1927 wd->pan = evas_object_smart_data_get(wd->pan_smart);
1930 elm_smart_scroller_extern_pan_set(wd->scr, wd->pan_smart,
1931 _pan_set, _pan_get, _pan_max_get,
1932 _pan_min_get, _pan_child_size_get);
1934 evas_object_smart_callbacks_descriptions_set(obj, _signals);
1936 _mirrored_set(obj, elm_widget_mirrored_get(obj));
1941 elm_gengrid_item_size_set(Evas_Object *obj,
1945 ELM_CHECK_WIDTYPE(obj, widtype);
1946 Widget_Data *wd = elm_widget_data_get(obj);
1948 if ((wd->item_width == w) && (wd->item_height == h)) return;
1950 wd->item_height = h;
1951 if (wd->calc_job) ecore_job_del(wd->calc_job);
1952 wd->calc_job = ecore_job_add(_calc_job, wd);
1956 elm_gengrid_item_size_get(const Evas_Object *obj,
1960 ELM_CHECK_WIDTYPE(obj, widtype);
1961 Widget_Data *wd = elm_widget_data_get(obj);
1963 if (w) *w = wd->item_width;
1964 if (h) *h = wd->item_height;
1968 elm_gengrid_group_item_size_set(Evas_Object *obj,
1972 ELM_CHECK_WIDTYPE(obj, widtype);
1973 Widget_Data *wd = elm_widget_data_get(obj);
1975 if ((wd->group_item_width == w) && (wd->group_item_height == h)) return;
1976 wd->group_item_width = w;
1977 wd->group_item_height = h;
1978 if (wd->calc_job) ecore_job_del(wd->calc_job);
1979 wd->calc_job = ecore_job_add(_calc_job, wd);
1983 elm_gengrid_group_item_size_get(const Evas_Object *obj,
1987 ELM_CHECK_WIDTYPE(obj, widtype);
1988 Widget_Data *wd = elm_widget_data_get(obj);
1990 if (w) *w = wd->group_item_width;
1991 if (h) *h = wd->group_item_height;
1995 elm_gengrid_align_set(Evas_Object *obj,
1999 ELM_CHECK_WIDTYPE(obj, widtype);
2001 Widget_Data *wd = elm_widget_data_get(obj);
2002 double old_h = wd->align_x, old_y = wd->align_y;
2006 else if (align_x < 0.0)
2008 wd->align_x = align_x;
2012 else if (align_y < 0.0)
2014 wd->align_y = align_y;
2016 if ((old_h != wd->align_x) || (old_y != wd->align_y))
2017 evas_object_smart_calculate(wd->pan_smart);
2021 elm_gengrid_align_get(const Evas_Object *obj,
2025 ELM_CHECK_WIDTYPE(obj, widtype);
2026 Widget_Data *wd = elm_widget_data_get(obj);
2027 if (align_x) *align_x = wd->align_x;
2028 if (align_y) *align_y = wd->align_y;
2032 elm_gengrid_item_append(Evas_Object *obj,
2033 const Elm_Gengrid_Item_Class *itc,
2036 const void *func_data)
2039 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2040 Widget_Data *wd = elm_widget_data_get(obj);
2041 if (!wd) return NULL;
2043 it = _item_new(wd, itc, data, func, func_data);
2044 if (!it) return NULL;
2045 wd->items = eina_inlist_append(wd->items, EINA_INLIST_GET(it));
2048 wd->group_items = eina_list_prepend(wd->group_items, it);
2050 if (wd->calc_job) ecore_job_del(wd->calc_job);
2051 wd->calc_job = ecore_job_add(_calc_job, wd);
2057 elm_gengrid_item_prepend(Evas_Object *obj,
2058 const Elm_Gengrid_Item_Class *itc,
2061 const void *func_data)
2064 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2065 Widget_Data *wd = elm_widget_data_get(obj);
2066 if (!wd) return NULL;
2068 it = _item_new(wd, itc, data, func, func_data);
2069 if (!it) return NULL;
2070 wd->items = eina_inlist_prepend(wd->items, EINA_INLIST_GET(it));
2072 wd->group_items = eina_list_append(wd->group_items, it);
2074 if (wd->calc_job) ecore_job_del(wd->calc_job);
2075 wd->calc_job = ecore_job_add(_calc_job, wd);
2081 elm_gengrid_item_insert_before(Evas_Object *obj,
2082 const Elm_Gengrid_Item_Class *itc,
2084 Elm_Gen_Item *relative,
2086 const void *func_data)
2089 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2090 EINA_SAFETY_ON_NULL_RETURN_VAL(relative, NULL);
2091 Widget_Data *wd = elm_widget_data_get(obj);
2092 if (!wd) return NULL;
2094 it = _item_new(wd, itc, data, func, func_data);
2095 if (!it) return NULL;
2096 wd->items = eina_inlist_prepend_relative
2097 (wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(relative));
2099 wd->group_items = eina_list_append_relative(wd->group_items, it, relative->parent);
2101 if (wd->calc_job) ecore_job_del(wd->calc_job);
2102 wd->calc_job = ecore_job_add(_calc_job, wd);
2108 elm_gengrid_item_insert_after(Evas_Object *obj,
2109 const Elm_Gengrid_Item_Class *itc,
2111 Elm_Gen_Item *relative,
2113 const void *func_data)
2116 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2117 EINA_SAFETY_ON_NULL_RETURN_VAL(relative, NULL);
2118 Widget_Data *wd = elm_widget_data_get(obj);
2119 if (!wd) return NULL;
2121 it = _item_new(wd, itc, data, func, func_data);
2122 if (!it) return NULL;
2123 wd->items = eina_inlist_append_relative
2124 (wd->items, EINA_INLIST_GET(it), EINA_INLIST_GET(relative));
2126 wd->group_items = eina_list_prepend_relative(wd->group_items, it, relative->parent);
2128 if (wd->calc_job) ecore_job_del(wd->calc_job);
2129 wd->calc_job = ecore_job_add(_calc_job, wd);
2135 elm_gengrid_item_direct_sorted_insert(Evas_Object *obj,
2136 const Elm_Gengrid_Item_Class *itc,
2138 Eina_Compare_Cb comp,
2140 const void *func_data)
2143 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2144 Widget_Data *wd = elm_widget_data_get(obj);
2145 if (!wd) return NULL;
2147 it = _item_new(wd, itc, data, func, func_data);
2148 if (!it) return NULL;
2151 wd->state = eina_inlist_sorted_state_new();
2153 _elm_gengrid_item_compare_cb = comp;
2154 wd->items = eina_inlist_sorted_state_insert(wd->items, EINA_INLIST_GET(it),
2155 _elm_gengrid_item_compare, wd->state);
2156 if (wd->calc_job) ecore_job_del(wd->calc_job);
2157 wd->calc_job = ecore_job_add(_calc_job, wd);
2163 elm_gengrid_item_sorted_insert(Evas_Object *obj,
2164 const Elm_Gengrid_Item_Class *itc,
2166 Eina_Compare_Cb comp,
2168 const void *func_data)
2170 _elm_gengrid_item_compare_data_cb = comp;
2172 return elm_gengrid_item_direct_sorted_insert(obj, itc, data, _elm_gengrid_item_compare_data, func, func_data);
2176 elm_gengrid_item_del(Elm_Gen_Item *it)
2178 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2179 if ((it->relcount > 0) || (it->walking > 0))
2181 elm_gen_item_del_notserious(it);
2189 elm_gengrid_horizontal_set(Evas_Object *obj,
2192 ELM_CHECK_WIDTYPE(obj, widtype);
2193 Widget_Data *wd = elm_widget_data_get(obj);
2195 if (setting == wd->horizontal) return;
2196 wd->horizontal = setting;
2198 /* Update the items to conform to the new layout */
2199 if (wd->calc_job) ecore_job_del(wd->calc_job);
2200 wd->calc_job = ecore_job_add(_calc_job, wd);
2204 elm_gengrid_horizontal_get(const Evas_Object *obj)
2206 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2207 Widget_Data *wd = elm_widget_data_get(obj);
2208 if (!wd) return EINA_FALSE;
2209 return wd->horizontal;
2213 elm_gengrid_clear(Evas_Object *obj)
2215 elm_genlist_clear(obj);
2218 EAPI const Evas_Object *
2219 elm_gengrid_item_object_get(const Elm_Gen_Item *it)
2221 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
2226 elm_gengrid_item_update(Elm_Gen_Item *it)
2228 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2229 if (!it->realized) return;
2230 if (it->want_unrealize) return;
2231 elm_gen_item_unrealize(it, EINA_FALSE);
2233 _item_place(it, it->x, it->y);
2237 elm_gengrid_item_data_get(const Elm_Gen_Item *it)
2239 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
2240 return elm_widget_item_data_get(it);
2244 elm_gengrid_item_data_set(Elm_Gen_Item *it,
2247 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2248 elm_widget_item_data_set(it, data);
2251 EAPI const Elm_Gengrid_Item_Class *
2252 elm_gengrid_item_item_class_get(const Elm_Gen_Item *it)
2254 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
2255 if (it->delete_me) return NULL;
2260 elm_gengrid_item_item_class_set(Elm_Gen_Item *it,
2261 const Elm_Gengrid_Item_Class *itc)
2263 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2264 EINA_SAFETY_ON_NULL_RETURN(itc);
2265 if (it->delete_me) return;
2267 elm_gengrid_item_update(it);
2271 elm_gengrid_item_pos_get(const Elm_Gen_Item *it,
2275 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2281 elm_gengrid_multi_select_set(Evas_Object *obj,
2284 ELM_CHECK_WIDTYPE(obj, widtype);
2285 Widget_Data *wd = elm_widget_data_get(obj);
2291 elm_gengrid_multi_select_get(const Evas_Object *obj)
2293 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2294 Widget_Data *wd = elm_widget_data_get(obj);
2295 if (!wd) return EINA_FALSE;
2300 elm_gengrid_selected_item_get(const Evas_Object *obj)
2302 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2303 Widget_Data *wd = elm_widget_data_get(obj);
2304 if (!wd) return NULL;
2305 if (wd->selected) return wd->selected->data;
2309 EAPI const Eina_List *
2310 elm_gengrid_selected_items_get(const Evas_Object *obj)
2312 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2313 Widget_Data *wd = elm_widget_data_get(obj);
2314 if (!wd) return NULL;
2315 return wd->selected;
2319 elm_gengrid_item_selected_set(Elm_Gen_Item *it,
2322 elm_genlist_item_selected_set(it, selected);
2326 elm_gengrid_item_selected_get(const Elm_Gen_Item *it)
2328 return elm_genlist_item_selected_get(it);
2332 elm_gengrid_item_disabled_set(Elm_Gen_Item *it,
2335 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2336 if (it->disabled == disabled) return;
2337 if (it->delete_me) return;
2338 it->disabled = !!disabled;
2342 edje_object_signal_emit(VIEW(it), "elm,state,disabled", "elm");
2344 edje_object_signal_emit(VIEW(it), "elm,state,enabled", "elm");
2349 elm_gengrid_item_disabled_get(const Elm_Gen_Item *it)
2351 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
2352 if (it->delete_me) return EINA_FALSE;
2353 return it->disabled;
2356 static Evas_Object *
2357 _elm_gengrid_item_label_create(void *data,
2358 Evas_Object *obj __UNUSED__,
2359 Evas_Object *tooltip,
2360 void *it __UNUSED__)
2362 Evas_Object *label = elm_label_add(tooltip);
2365 elm_object_style_set(label, "tooltip");
2366 elm_object_text_set(label, data);
2371 _elm_gengrid_item_label_del_cb(void *data,
2372 Evas_Object *obj __UNUSED__,
2373 void *event_info __UNUSED__)
2375 eina_stringshare_del(data);
2379 elm_gengrid_item_tooltip_text_set(Elm_Gen_Item *it,
2382 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2383 text = eina_stringshare_add(text);
2384 elm_gengrid_item_tooltip_content_cb_set(it, _elm_gengrid_item_label_create,
2386 _elm_gengrid_item_label_del_cb);
2390 elm_gengrid_item_tooltip_content_cb_set(Elm_Gen_Item *it,
2391 Elm_Tooltip_Item_Content_Cb func,
2393 Evas_Smart_Cb del_cb)
2395 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_GOTO(it, error);
2397 if ((it->tooltip.content_cb == func) && (it->tooltip.data == data))
2400 if (it->tooltip.del_cb)
2401 it->tooltip.del_cb((void *)it->tooltip.data,
2403 it->tooltip.content_cb = func;
2404 it->tooltip.data = data;
2405 it->tooltip.del_cb = del_cb;
2408 elm_widget_item_tooltip_content_cb_set(it,
2409 it->tooltip.content_cb,
2410 it->tooltip.data, NULL);
2411 elm_widget_item_tooltip_style_set(it, it->tooltip.style);
2412 elm_widget_item_tooltip_size_restrict_disable(it, it->tooltip.free_size);
2418 if (del_cb) del_cb((void *)data, NULL, NULL);
2422 elm_gengrid_item_tooltip_unset(Elm_Gen_Item *it)
2424 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2425 if ((VIEW(it)) && (it->tooltip.content_cb))
2426 elm_widget_item_tooltip_unset(it);
2428 if (it->tooltip.del_cb)
2429 it->tooltip.del_cb((void *)it->tooltip.data, WIDGET(it), it);
2430 it->tooltip.del_cb = NULL;
2431 it->tooltip.content_cb = NULL;
2432 it->tooltip.data = NULL;
2433 it->tooltip.free_size = EINA_FALSE;
2434 if (it->tooltip.style)
2435 elm_gengrid_item_tooltip_style_set(it, NULL);
2439 elm_gengrid_item_tooltip_style_set(Elm_Gen_Item *it,
2442 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2443 eina_stringshare_replace(&it->tooltip.style, style);
2444 if (VIEW(it)) elm_widget_item_tooltip_style_set(it, style);
2448 elm_gengrid_item_tooltip_style_get(const Elm_Gen_Item *it)
2450 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
2451 return it->tooltip.style;
2455 elm_gengrid_item_tooltip_size_restrict_disable(Elm_Gen_Item *it, Eina_Bool disable)
2457 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
2458 it->tooltip.free_size = disable;
2459 if (VIEW(it)) return elm_widget_item_tooltip_size_restrict_disable(it, disable);
2464 elm_gengrid_item_tooltip_size_restrict_disabled_get(const Elm_Gen_Item *it)
2466 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
2467 return it->tooltip.free_size;
2471 elm_gengrid_item_cursor_set(Elm_Gen_Item *it,
2474 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2475 eina_stringshare_replace(&it->mouse_cursor, cursor);
2476 if (VIEW(it)) elm_widget_item_cursor_set(it, cursor);
2480 elm_gengrid_item_cursor_get(const Elm_Gen_Item *it)
2482 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
2483 return elm_widget_item_cursor_get(it);
2487 elm_gengrid_item_cursor_unset(Elm_Gen_Item *it)
2489 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2490 if (!it->mouse_cursor)
2494 elm_widget_item_cursor_unset(it);
2496 eina_stringshare_del(it->mouse_cursor);
2497 it->mouse_cursor = NULL;
2501 elm_gengrid_item_cursor_style_set(Elm_Gen_Item *it,
2504 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2505 elm_widget_item_cursor_style_set(it, style);
2509 elm_gengrid_item_cursor_style_get(const Elm_Gen_Item *it)
2511 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, NULL);
2512 return elm_widget_item_cursor_style_get(it);
2516 elm_gengrid_item_cursor_engine_only_set(Elm_Gen_Item *it,
2517 Eina_Bool engine_only)
2519 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2520 elm_widget_item_cursor_engine_only_set(it, engine_only);
2524 elm_gengrid_item_cursor_engine_only_get(const Elm_Gen_Item *it)
2526 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it, EINA_FALSE);
2527 return elm_widget_item_cursor_engine_only_get(it);
2531 elm_gengrid_reorder_mode_set(Evas_Object *obj,
2532 Eina_Bool reorder_mode)
2534 ELM_CHECK_WIDTYPE(obj, widtype);
2535 Widget_Data *wd = elm_widget_data_get(obj);
2537 wd->reorder_mode = reorder_mode;
2541 elm_gengrid_reorder_mode_get(const Evas_Object *obj)
2543 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2544 Widget_Data *wd = elm_widget_data_get(obj);
2545 if (!wd) return EINA_FALSE;
2546 return wd->reorder_mode;
2550 elm_gengrid_always_select_mode_set(Evas_Object *obj,
2551 Eina_Bool always_select)
2553 elm_genlist_always_select_mode_set(obj, always_select);
2557 elm_gengrid_always_select_mode_get(const Evas_Object *obj)
2559 return elm_genlist_always_select_mode_get(obj);
2563 elm_gengrid_no_select_mode_set(Evas_Object *obj,
2564 Eina_Bool no_select)
2566 elm_genlist_no_select_mode_set(obj, no_select);
2570 elm_gengrid_no_select_mode_get(const Evas_Object *obj)
2572 return elm_genlist_no_select_mode_get(obj);
2576 elm_gengrid_bounce_set(Evas_Object *obj,
2580 elm_genlist_bounce_set(obj, h_bounce, v_bounce);
2584 elm_gengrid_bounce_get(const Evas_Object *obj,
2585 Eina_Bool *h_bounce,
2586 Eina_Bool *v_bounce)
2588 elm_genlist_bounce_get(obj, h_bounce, v_bounce);
2592 elm_gengrid_page_relative_set(Evas_Object *obj,
2596 _elm_genlist_page_relative_set(obj, h_pagerel, v_pagerel);
2600 elm_gengrid_page_relative_get(const Evas_Object *obj, double *h_pagerel, double *v_pagerel)
2602 _elm_genlist_page_relative_get(obj, h_pagerel, v_pagerel);
2606 elm_gengrid_page_size_set(Evas_Object *obj,
2607 Evas_Coord h_pagesize,
2608 Evas_Coord v_pagesize)
2610 _elm_genlist_page_size_set(obj, h_pagesize, v_pagesize);
2614 elm_gengrid_current_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber)
2616 _elm_genlist_current_page_get(obj, h_pagenumber, v_pagenumber);
2620 elm_gengrid_last_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber)
2622 _elm_genlist_last_page_get(obj, h_pagenumber, v_pagenumber);
2626 elm_gengrid_page_show(const Evas_Object *obj, int h_pagenumber, int v_pagenumber)
2628 _elm_genlist_page_show(obj, h_pagenumber, v_pagenumber);
2632 elm_gengrid_page_bring_in(const Evas_Object *obj, int h_pagenumber, int v_pagenumber)
2634 _elm_genlist_page_bring_in(obj, h_pagenumber, v_pagenumber);
2638 elm_gengrid_first_item_get(const Evas_Object *obj)
2640 return elm_genlist_first_item_get(obj);
2644 elm_gengrid_last_item_get(const Evas_Object *obj)
2646 return elm_genlist_last_item_get(obj);
2650 elm_gengrid_item_next_get(const Elm_Gen_Item *it)
2652 return elm_genlist_item_next_get(it);
2656 elm_gengrid_item_prev_get(const Elm_Gen_Item *it)
2658 return elm_genlist_item_prev_get(it);
2662 elm_gengrid_item_gengrid_get(const Elm_Gen_Item *it)
2664 return _elm_genlist_item_widget_get(it);
2668 elm_gengrid_item_show(Elm_Gen_Item *it)
2670 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2671 Widget_Data *wd = it->wd;
2672 Evas_Coord minx = 0, miny = 0;
2675 if ((!it) || (it->delete_me)) return;
2676 _pan_min_get(wd->pan_smart, &minx, &miny);
2679 elm_smart_scroller_region_bring_in(it->wd->scr,
2680 ((it->x - it->item->prev_group) * wd->item_width) + (it->item->prev_group * it->wd->group_item_width) + minx,
2681 it->y * wd->item_height + miny,
2683 it->wd->item_height);
2685 elm_smart_scroller_region_bring_in(it->wd->scr,
2686 it->x * wd->item_width + minx,
2687 ((it->y - it->item->prev_group)* wd->item_height) + (it->item->prev_group * it->wd->group_item_height) + miny,
2689 it->wd->item_height);
2693 elm_gengrid_item_bring_in(Elm_Gen_Item *it)
2695 ELM_WIDGET_ITEM_WIDTYPE_CHECK_OR_RETURN(it);
2696 if (it->delete_me) return;
2698 Evas_Coord minx = 0, miny = 0;
2699 Widget_Data *wd = it->wd;
2701 _pan_min_get(wd->pan_smart, &minx, &miny);
2704 elm_smart_scroller_region_bring_in(it->wd->scr,
2705 ((it->x - it->item->prev_group) * wd->item_width) + (it->item->prev_group * it->wd->group_item_width) + minx,
2706 it->y * wd->item_height + miny,
2708 it->wd->item_height);
2710 elm_smart_scroller_region_bring_in(it->wd->scr,
2711 it->x * wd->item_width + minx,
2712 ((it->y - it->item->prev_group)* wd->item_height) + (it->item->prev_group * it->wd->group_item_height) + miny,
2714 it->wd->item_height);