1 #include <Elementary.h>
3 #include "els_scroller.h"
6 #define SMART_NAME "els_scroller"
7 #define API_ENTRY Smart_Data *sd; sd = evas_object_smart_data_get(obj); if ((!obj) || (!sd) || (evas_object_type_get(obj) && strcmp(evas_object_type_get(obj), SMART_NAME)))
8 #define INTERNAL_ENTRY Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (!sd) return;
9 typedef struct _Smart_Data Smart_Data;
16 Evas_Coord x, y, w, h;
17 Evas_Coord wx, wy, ww, wh; /* Last "wanted" geometry */
19 Evas_Object *smart_obj;
20 Evas_Object *child_obj;
22 Evas_Object *edje_obj;
23 Evas_Object *event_obj;
27 Elm_Smart_Scroller_Policy hbar_flags, vbar_flags;
41 double timestamp, localtimestamp;
44 double tadd, dxsum, dysum;
45 double est_timestamp_diff;
50 double onhold_vx, onhold_vy, onhold_tlast, onhold_vxe, onhold_vye;
52 Evas_Coord hold_x, hold_y;
53 Ecore_Animator *hold_animator;
54 Ecore_Animator *onhold_animator;
55 Ecore_Animator *momentum_animator;
56 Ecore_Animator *bounce_x_animator;
57 Ecore_Animator *bounce_y_animator;
58 Evas_Coord locked_x, locked_y;
61 Eina_Bool cancelled : 1;
63 Eina_Bool hold_parent : 1;
64 Eina_Bool want_dragged : 1;
65 Eina_Bool dragged : 1;
66 Eina_Bool dragged_began : 1;
70 Eina_Bool bounce_x_hold : 1;
71 Eina_Bool bounce_y_hold : 1;
77 Eina_Bool resized : 1;
84 void (*set) (Evas_Object *obj, Evas_Coord x, Evas_Coord y);
85 void (*get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
86 void (*max_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
87 void (*min_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
88 void (*child_size_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
89 void (*gravity_set) (Evas_Object *obj, double x, double y);
90 void (*gravity_get) (Evas_Object *obj, double *x, double *y);
95 Evas_Coord start, end;
96 double t_start, t_end;
97 Ecore_Animator *animator;
101 double pagerel_h, pagerel_v;
102 Evas_Coord pagesize_h, pagesize_v;
104 Eina_Bool hbar_visible : 1;
105 Eina_Bool vbar_visible : 1;
106 Eina_Bool extern_pan : 1;
107 Eina_Bool one_dir_at_a_time : 1;
109 Eina_Bool freeze : 1;
110 Eina_Bool bouncemex : 1;
111 Eina_Bool bouncemey : 1;
112 Eina_Bool bounce_horiz : 1;
113 Eina_Bool bounce_vert : 1;
114 Eina_Bool momentum_animator_disabled :1;
115 Eina_Bool bounce_animator_disabled :1;
116 Eina_Bool is_mirrored : 1;
117 Eina_Bool wheel_disabled : 1;
120 /* local subsystem functions */
121 static void _smart_child_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info);
122 static void _smart_pan_changed_hook(void *data, Evas_Object *obj, void *event_info);
123 static void _smart_event_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info);
124 static void _smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
125 static Eina_Bool _smart_hold_animator(void *data);
126 static Eina_Bool _smart_momentum_animator(void *data);
127 static void _smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
128 static Eina_Bool _smart_onhold_animator(void *data);
129 static void _smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
130 static void _smart_edje_drag_v_start(void *data, Evas_Object *obj, const char *emission, const char *source);
131 static void _smart_edje_drag_v_stop(void *data, Evas_Object *obj, const char *emission, const char *source);
132 static void _smart_edje_drag_v(void *data, Evas_Object *obj, const char *emission, const char *source);
133 static void _smart_edje_drag_h_start(void *data, Evas_Object *obj, const char *emission, const char *source);
134 static void _smart_edje_drag_h_stop(void *data, Evas_Object *obj, const char *emission, const char *source);
135 static void _smart_edje_drag_h(void *data, Evas_Object *obj, const char *emission, const char *source);
136 static void _smart_scrollbar_read(Smart_Data *sd);
137 static void _smart_scrollbar_reset(Smart_Data *sd);
138 static int _smart_scrollbar_bar_h_visibility_adjust(Smart_Data *sd);
139 static int _smart_scrollbar_bar_v_visibility_adjust(Smart_Data *sd);
140 static void _smart_scrollbar_bar_visibility_adjust(Smart_Data *sd);
141 static void _smart_scrollbar_size_adjust(Smart_Data *sd);
142 static void _smart_reconfigure(Smart_Data *sd);
143 static void _smart_add(Evas_Object *obj);
144 static void _smart_del(Evas_Object *obj);
145 static void _smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
146 static void _smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
147 static void _smart_show(Evas_Object *obj);
148 static void _smart_hide(Evas_Object *obj);
149 static void _smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
150 static void _smart_clip_set(Evas_Object *obj, Evas_Object *clip);
151 static void _smart_clip_unset(Evas_Object *obj);
152 static void _smart_init(void);
154 static void _elm_smart_scroller_wanted_region_set(Evas_Object *obj);
156 /* local subsystem globals */
157 static Evas_Smart *_smart = NULL;
159 /* externally accessible functions */
161 elm_smart_scroller_add(Evas *evas)
164 return evas_object_smart_add(evas, _smart);
168 _elm_smart_scroller_x_mirrored_get(Evas_Object *obj, Evas_Coord x)
172 Evas_Coord cw, ch, w, ret;
173 elm_smart_scroller_child_viewport_size_get(obj, &w, NULL);
174 sd->pan_func.child_size_get(sd->pan_obj, &cw, &ch);
175 ret = (cw - (x + w));
176 return (ret >= 0) ? ret : 0;
180 elm_smart_scroller_mirrored_set(Evas_Object *obj, Eina_Bool mirrored)
184 if (sd->is_mirrored == mirrored)
187 sd->is_mirrored = mirrored;
188 edje_object_mirrored_set(sd->edje_obj, mirrored);
191 wx = _elm_smart_scroller_x_mirrored_get(sd->smart_obj, sd->wx);
195 elm_smart_scroller_child_pos_set(sd->smart_obj, wx, sd->wy);
199 elm_smart_scroller_child_set(Evas_Object *obj, Evas_Object *child)
207 _elm_smart_pan_child_set(sd->pan_obj, NULL);
208 evas_object_event_callback_del_full(sd->child_obj, EVAS_CALLBACK_DEL, _smart_child_del_hook, sd);
211 sd->child_obj = child;
213 /* (-1) means want viewports size */
214 sd->ww = sd->wh = -1;
219 o = _elm_smart_pan_add(evas_object_evas_get(obj));
221 evas_object_smart_callback_add(o, "changed", _smart_pan_changed_hook, sd);
222 edje_object_part_swallow(sd->edje_obj, "elm.swallow.content", o);
225 sd->pan_func.set = _elm_smart_pan_set;
226 sd->pan_func.get = _elm_smart_pan_get;
227 sd->pan_func.max_get = _elm_smart_pan_max_get;
228 sd->pan_func.min_get = _elm_smart_pan_min_get;
229 sd->pan_func.child_size_get = _elm_smart_pan_child_size_get;
230 sd->pan_func.gravity_set = _elm_smart_pan_gravity_set;
231 sd->pan_func.gravity_get = _elm_smart_pan_gravity_get;
233 evas_object_event_callback_add(child, EVAS_CALLBACK_DEL, _smart_child_del_hook, sd);
234 _elm_smart_pan_child_set(sd->pan_obj, child);
235 sd->pan_func.child_size_get(sd->pan_obj, &w, &h);
238 _smart_scrollbar_size_adjust(sd);
239 _smart_scrollbar_reset(sd);
243 elm_smart_scroller_extern_pan_set(Evas_Object *obj, Evas_Object *pan,
244 void (*pan_set) (Evas_Object *obj, Evas_Coord x, Evas_Coord y),
245 void (*pan_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y),
246 void (*pan_max_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y),
247 void (*pan_min_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y),
248 void (*pan_child_size_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y))
252 elm_smart_scroller_child_set(obj, NULL);
256 evas_object_smart_callback_del(sd->pan_obj, "changed", _smart_pan_changed_hook);
263 edje_object_part_unswallow(sd->edje_obj, sd->pan_obj);
271 evas_object_del(sd->pan_obj);
277 sd->extern_pan = EINA_FALSE;
282 sd->pan_func.set = pan_set;
283 sd->pan_func.get = pan_get;
284 sd->pan_func.max_get = pan_max_get;
285 sd->pan_func.min_get = pan_min_get;
286 sd->pan_func.child_size_get = pan_child_size_get;
287 sd->pan_func.gravity_set = _elm_smart_pan_gravity_set;
288 sd->pan_func.gravity_get = _elm_smart_pan_gravity_get;
289 sd->extern_pan = EINA_TRUE;
290 evas_object_smart_callback_add(sd->pan_obj, "changed", _smart_pan_changed_hook, sd);
291 edje_object_part_swallow(sd->edje_obj, "elm.swallow.content", sd->pan_obj);
292 evas_object_show(sd->pan_obj);
296 elm_smart_scroller_custom_edje_file_set(Evas_Object *obj, char *file, char *group)
300 edje_object_file_set(sd->edje_obj, file, group);
302 edje_object_part_swallow(sd->edje_obj, "elm.swallow.content", sd->pan_obj);
303 sd->vbar_visible = !sd->vbar_visible;
304 sd->hbar_visible = !sd->hbar_visible;
305 _smart_scrollbar_bar_visibility_adjust(sd);
306 if (sd->hbar_flags == ELM_SMART_SCROLLER_POLICY_ON)
307 edje_object_signal_emit(sd->edje_obj, "elm,action,show_always,hbar", "elm");
308 else if (sd->hbar_flags == ELM_SMART_SCROLLER_POLICY_OFF)
309 edje_object_signal_emit(sd->edje_obj, "elm,action,hide,hbar", "elm");
311 edje_object_signal_emit(sd->edje_obj, "elm,action,show_notalways,hbar", "elm");
312 if (sd->vbar_flags == ELM_SMART_SCROLLER_POLICY_ON)
313 edje_object_signal_emit(sd->edje_obj, "elm,action,show_always,vbar", "elm");
314 else if (sd->vbar_flags == ELM_SMART_SCROLLER_POLICY_OFF)
315 edje_object_signal_emit(sd->edje_obj, "elm,action,hide,vbar", "elm");
317 edje_object_signal_emit(sd->edje_obj, "elm,action,show_notalways,vbar", "elm");
321 elm_smart_scroller_momentum_animator_disabled_get(Evas_Object *obj)
323 API_ENTRY return EINA_FALSE;
324 return sd->momentum_animator_disabled;
328 elm_smart_scroller_momentum_animator_disabled_set(Evas_Object *obj, Eina_Bool disabled)
331 sd->momentum_animator_disabled = disabled;
332 if (sd->momentum_animator_disabled)
334 if (sd->down.momentum_animator)
336 ecore_animator_del(sd->down.momentum_animator);
337 sd->down.momentum_animator = NULL;
338 if (sd->child.resized)
339 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
345 elm_smart_scroller_bounce_animator_disabled_get(Evas_Object *obj)
347 API_ENTRY return EINA_FALSE;
348 return sd->bounce_animator_disabled;
352 elm_smart_scroller_bounce_animator_disabled_set(Evas_Object *obj, Eina_Bool disabled)
355 sd->bounce_animator_disabled = disabled;
356 if (sd->bounce_animator_disabled)
358 if (sd->scrollto.x.animator)
360 ecore_animator_del(sd->scrollto.x.animator);
361 sd->scrollto.x.animator = NULL;
364 if (sd->scrollto.y.animator)
366 ecore_animator_del(sd->scrollto.y.animator);
367 sd->scrollto.y.animator = NULL;
373 elm_smart_scroller_wheel_disabled_get(Evas_Object *obj)
375 API_ENTRY return EINA_FALSE;
376 return sd->wheel_disabled;
380 elm_smart_scroller_wheel_disabled_set(Evas_Object *obj, Eina_Bool disabled)
383 if ((!sd->wheel_disabled) && (disabled))
384 evas_object_event_callback_del_full(sd->event_obj, EVAS_CALLBACK_MOUSE_WHEEL, _smart_event_wheel, sd);
385 else if ((sd->wheel_disabled) && (!disabled))
386 evas_object_event_callback_add(sd->event_obj, EVAS_CALLBACK_MOUSE_WHEEL, _smart_event_wheel, sd);
387 sd->wheel_disabled = disabled;
390 /* Update the wanted coordinates according to the x, y passed
391 * widget directionality, child size and etc. */
393 _update_wanted_coordinates(Smart_Data *sd, Evas_Coord x, Evas_Coord y)
397 sd->pan_func.child_size_get(sd->pan_obj, &cw, &ch);
399 /* Update wx/y/w/h - and if the requested positions aren't legal
401 elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &sd->ww, &sd->wh);
404 else if ((x + sd->ww) > cw)
405 sd->wx = cw - sd->ww;
406 else if (sd->is_mirrored)
407 sd->wx = _elm_smart_scroller_x_mirrored_get(sd->smart_obj, x);
410 if (y < 0) sd->wy = 0;
411 else if ((y + sd->wh) > ch) sd->wy = ch - sd->wh;
416 _smart_anim_start(Evas_Object *obj)
418 evas_object_smart_callback_call(obj, "animate,start", NULL);
422 _smart_anim_stop(Evas_Object *obj)
424 evas_object_smart_callback_call(obj, "animate,stop", NULL);
428 _smart_drag_start(Evas_Object *obj)
430 evas_object_smart_callback_call(obj, "drag,start", NULL);
434 _smart_drag_stop(Evas_Object *obj)
436 evas_object_smart_callback_call(obj, "drag,stop", NULL);
440 _smart_scrollto_x_animator(void *data)
442 Smart_Data *sd = data;
446 t = ecore_loop_time_get();
447 tt = (t - sd->scrollto.x.t_start) / (sd->scrollto.x.t_end - sd->scrollto.x.t_start);
449 tt = 1.0 - (tt * tt);
450 sd->pan_func.get(sd->pan_obj, &px, &py);
451 px = (sd->scrollto.x.start * (1.0 - tt)) +
452 (sd->scrollto.x.end * tt);
453 if (t >= sd->scrollto.x.t_end)
455 px = sd->scrollto.x.end;
456 elm_smart_scroller_child_pos_set(sd->smart_obj, px, py);
458 sd->down.x = sd->down.history[0].x;
459 _update_wanted_coordinates(sd, px, py);
460 sd->scrollto.x.animator = NULL;
461 if ((!sd->scrollto.y.animator) && (!sd->down.bounce_y_animator))
462 _smart_anim_stop(sd->smart_obj);
463 return ECORE_CALLBACK_CANCEL;
465 elm_smart_scroller_child_pos_set(sd->smart_obj, px, py);
466 _update_wanted_coordinates(sd, px, py);
467 return ECORE_CALLBACK_RENEW;
471 _smart_momentum_end(Smart_Data *sd)
473 if ((sd->down.bounce_x_animator) || (sd->down.bounce_y_animator)) return;
474 if (sd->down.momentum_animator)
477 elm_smart_scroller_child_pos_get(sd->smart_obj, &px, &py);
478 _update_wanted_coordinates(sd, px, py);
480 ecore_animator_del(sd->down.momentum_animator);
481 sd->down.momentum_animator = NULL;
482 sd->down.bounce_x_hold = EINA_FALSE;
483 sd->down.bounce_y_hold = EINA_FALSE;
490 if (sd->child.resized)
491 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
496 _smart_scrollto_x(Smart_Data *sd, double t_in, Evas_Coord pos_x)
498 Evas_Coord px, py, x, y, w, h;
501 if (sd->freeze) return;
504 elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y);
505 elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &w, &h);
507 elm_smart_scroller_child_region_set(sd->smart_obj, x, y, w, h);
510 t = ecore_loop_time_get();
511 sd->pan_func.get(sd->pan_obj, &px, &py);
512 sd->scrollto.x.start = px;
513 sd->scrollto.x.end = pos_x;
514 sd->scrollto.x.t_start = t;
515 sd->scrollto.x.t_end = t + t_in;
516 if (!sd->scrollto.x.animator)
518 sd->scrollto.x.animator = ecore_animator_add(_smart_scrollto_x_animator, sd);
519 if (!sd->scrollto.y.animator)
520 _smart_anim_start(sd->smart_obj);
522 if (sd->down.bounce_x_animator)
524 ecore_animator_del(sd->down.bounce_x_animator);
525 sd->down.bounce_x_animator = NULL;
526 _smart_momentum_end(sd);
527 if (sd->child.resized)
528 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
530 sd->bouncemex = EINA_FALSE;
534 _smart_scrollto_y_animator(void *data)
536 Smart_Data *sd = data;
540 t = ecore_loop_time_get();
541 tt = (t - sd->scrollto.y.t_start) / (sd->scrollto.y.t_end - sd->scrollto.y.t_start);
543 tt = 1.0 - (tt * tt);
544 sd->pan_func.get(sd->pan_obj, &px, &py);
545 py = (sd->scrollto.y.start * (1.0 - tt)) +
546 (sd->scrollto.y.end * tt);
547 if (t >= sd->scrollto.y.t_end)
549 py = sd->scrollto.y.end;
550 elm_smart_scroller_child_pos_set(sd->smart_obj, px, py);
552 sd->down.y = sd->down.history[0].y;
553 _update_wanted_coordinates(sd, px, py);
554 sd->scrollto.y.animator = NULL;
555 if ((!sd->scrollto.x.animator) && (!sd->down.bounce_x_animator))
556 _smart_anim_stop(sd->smart_obj);
557 return ECORE_CALLBACK_CANCEL;
559 elm_smart_scroller_child_pos_set(sd->smart_obj, px, py);
560 _update_wanted_coordinates(sd, px, py);
562 return ECORE_CALLBACK_RENEW;
566 _smart_scrollto_y(Smart_Data *sd, double t_in, Evas_Coord pos_y)
568 Evas_Coord px, py, x, y, w, h;
571 if (sd->freeze) return;
574 elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y);
575 elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &w, &h);
577 elm_smart_scroller_child_region_set(sd->smart_obj, x, y, w, h);
580 t = ecore_loop_time_get();
581 sd->pan_func.get(sd->pan_obj, &px, &py);
582 sd->scrollto.y.start = py;
583 sd->scrollto.y.end = pos_y;
584 sd->scrollto.y.t_start = t;
585 sd->scrollto.y.t_end = t + t_in;
586 if (!sd->scrollto.y.animator)
588 sd->scrollto.y.animator = ecore_animator_add(_smart_scrollto_y_animator, sd);
589 if (!sd->scrollto.x.animator)
590 _smart_anim_start(sd->smart_obj);
592 if (sd->down.bounce_y_animator)
594 ecore_animator_del(sd->down.bounce_y_animator);
595 sd->down.bounce_y_animator = NULL;
596 _smart_momentum_end(sd);
597 if (sd->child.resized)
598 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
600 sd->bouncemey = EINA_FALSE;
604 _smart_do_page(Smart_Data *sd)
606 if ((sd->pagerel_h == 0.0) && (!sd->pagesize_h) &&
607 (sd->pagerel_v == 0.0) && (!sd->pagesize_v))
613 _smart_page_x_get(Smart_Data *sd, int offset)
615 Evas_Coord x, y, w, h, cw, ch, minx = 0;
617 elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y);
618 elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &w, &h);
619 sd->pan_func.child_size_get(sd->pan_obj, &cw, &ch);
620 sd->pan_func.min_get(sd->pan_obj, &minx, NULL);
624 if (sd->pagerel_h > 0.0)
625 sd->pagesize_h = w * sd->pagerel_h;
626 if (sd->pagesize_h > 0)
628 x = x + (sd->pagesize_h * 0.5);
629 x = x / (sd->pagesize_h);
630 x = x * (sd->pagesize_h);
632 if ((x + w) > cw) x = cw - w;
633 if (x < minx) x = minx;
638 _smart_page_y_get(Smart_Data *sd, int offset)
640 Evas_Coord x, y, w, h, cw, ch, miny = 0;
642 elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y);
643 elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &w, &h);
644 sd->pan_func.child_size_get(sd->pan_obj, &cw, &ch);
645 sd->pan_func.min_get(sd->pan_obj, NULL, &miny);
649 if (sd->pagerel_v > 0.0)
650 sd->pagesize_v = h * sd->pagerel_v;
651 if (sd->pagesize_v > 0)
653 y = y + (sd->pagesize_v * 0.5);
654 y = y / (sd->pagesize_v);
655 y = y * (sd->pagesize_v);
657 if ((y + h) > ch) y = ch - h;
658 if (y < miny) y = miny;
663 _smart_page_adjust(Smart_Data *sd)
665 Evas_Coord x, y, w, h;
667 if (!_smart_do_page(sd)) return;
669 elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &w, &h);
671 x = _smart_page_x_get(sd, 0);
672 y = _smart_page_y_get(sd, 0);
674 elm_smart_scroller_child_region_set(sd->smart_obj, x, y, w, h);
678 _smart_bounce_x_animator(void *data)
681 Evas_Coord x, y, dx, w, odx, ed, md;
682 double t, p, dt, pd, r;
685 t = ecore_loop_time_get();
686 dt = t - sd->down.anim_start2;
689 dt = dt / _elm_config->thumbscroll_bounce_friction;
690 odx = sd->down.b2x - sd->down.bx;
691 elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &w, NULL);
692 if (!sd->down.momentum_animator && (w > abs(odx)))
694 pd = (double)odx / (double)w;
695 pd = (pd > 0) ? pd : -pd;
696 pd = 1.0 - ((1.0 - pd) * (1.0 - pd));
699 if (dt > 1.0) dt = 1.0;
700 p = 1.0 - ((1.0 - dt) * (1.0 - dt));
701 elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y);
704 if (sd->down.momentum_animator)
706 ed = abs(sd->down.dx * (_elm_config->thumbscroll_friction + sd->down.extra_time) - sd->down.b0x);
707 md = abs(_elm_config->thumbscroll_friction * 5 * w);
708 if (ed > md) r = (double)(md)/(double)ed;
710 x = sd->down.b2x + (int)((double)(dx - odx) * r);
711 if (!sd->down.cancelled)
712 elm_smart_scroller_child_pos_set(sd->smart_obj, x, y);
715 if (sd->down.momentum_animator)
716 sd->down.bounce_x_hold = EINA_TRUE;
717 if ((!sd->down.bounce_y_animator) &&
718 (!sd->scrollto.y.animator))
719 _smart_anim_stop(sd->smart_obj);
720 sd->down.bounce_x_animator = NULL;
722 sd->bouncemex = EINA_FALSE;
723 _smart_momentum_end(sd);
724 if (sd->child.resized)
725 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
726 return ECORE_CALLBACK_CANCEL;
729 return ECORE_CALLBACK_RENEW;
733 _smart_bounce_y_animator(void *data)
736 Evas_Coord x, y, dy, h, ody, ed, md;
737 double t, p, dt, pd, r;
740 t = ecore_loop_time_get();
741 dt = t - sd->down.anim_start3;
744 dt = dt / _elm_config->thumbscroll_bounce_friction;
745 ody = sd->down.b2y - sd->down.by;
746 elm_smart_scroller_child_viewport_size_get(sd->smart_obj, NULL, &h);
747 if (!sd->down.momentum_animator && (h > abs(ody)))
749 pd = (double)ody / (double)h;
750 pd = (pd > 0) ? pd : -pd;
751 pd = 1.0 - ((1.0 - pd) * (1.0 - pd));
754 if (dt > 1.0) dt = 1.0;
755 p = 1.0 - ((1.0 - dt) * (1.0 - dt));
756 elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y);
759 if (sd->down.momentum_animator)
761 ed = abs(sd->down.dy * (_elm_config->thumbscroll_friction + sd->down.extra_time) - sd->down.b0y);
762 md = abs(_elm_config->thumbscroll_friction * 5 * h);
763 if (ed > md) r = (double)(md)/(double)ed;
765 y = sd->down.b2y + (int)((double)(dy - ody) * r);
766 if (!sd->down.cancelled)
767 elm_smart_scroller_child_pos_set(sd->smart_obj, x, y);
770 if (sd->down.momentum_animator)
771 sd->down.bounce_y_hold = EINA_TRUE;
772 if ((!sd->down.bounce_x_animator) &&
773 (!sd->scrollto.y.animator))
774 _smart_anim_stop(sd->smart_obj);
775 sd->down.bounce_y_animator = NULL;
777 sd->bouncemey = EINA_FALSE;
778 _smart_momentum_end(sd);
779 if (sd->child.resized)
780 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
781 return ECORE_CALLBACK_CANCEL;
784 return ECORE_CALLBACK_RENEW;
792 can_scroll(Smart_Data *sd, int dir)
794 Evas_Coord mx = 0, my = 0, px = 0, py = 0, minx = 0, miny = 0;
796 sd->pan_func.max_get(sd->pan_obj, &mx, &my);
797 sd->pan_func.min_get(sd->pan_obj, &minx, &miny);
798 sd->pan_func.get(sd->pan_obj, &px, &py);
802 if (px > minx) return EINA_TRUE;
805 if ((px - minx) < mx) return EINA_TRUE;
808 if (py > miny) return EINA_TRUE;
811 if ((py - miny) < my) return EINA_TRUE;
820 _smart_momentum_animator(void *data)
824 Evas_Coord x, y, dx, dy, px, py, maxx, maxy, minx, miny;
825 Eina_Bool no_bounce_x_end = EINA_FALSE, no_bounce_y_end = EINA_FALSE;
828 t = ecore_loop_time_get();
829 dt = t - sd->down.anim_start;
833 if (sd->down.hold_parent)
835 if ((sd->down.dir_x) && !can_scroll(sd, sd->down.hdir))
839 if ((sd->down.dir_y) && !can_scroll(sd, sd->down.vdir))
844 if ((!sd->down.dir_x) && (!sd->down.dir_y))
846 sd->down.cancelled = 1;
849 dt = dt / (_elm_config->thumbscroll_friction + sd->down.extra_time);
850 if (dt > 1.0) dt = 1.0;
851 p = 1.0 - ((1.0 - dt) * (1.0 - dt));
852 dx = (sd->down.dx * (_elm_config->thumbscroll_friction + sd->down.extra_time) * p);
853 dy = (sd->down.dy * (_elm_config->thumbscroll_friction + sd->down.extra_time) * p);
856 x = sd->down.sx - dx;
857 y = sd->down.sy - dy;
858 elm_smart_scroller_child_pos_get(sd->smart_obj, &px, &py);
859 if ((sd->down.bounce_x_animator) ||
860 (sd->down.bounce_x_hold))
862 sd->down.bx = sd->down.bx0 - dx + sd->down.b0x;
865 if ((sd->down.bounce_y_animator) ||
866 (sd->down.bounce_y_hold))
868 sd->down.by = sd->down.by0 - dy + sd->down.b0y;
871 elm_smart_scroller_child_pos_set(sd->smart_obj, x, y);
872 _update_wanted_coordinates(sd, x, y);
873 sd->pan_func.max_get(sd->pan_obj, &maxx, &maxy);
874 sd->pan_func.min_get(sd->pan_obj, &minx, &miny);
875 if (!sd->bounce_horiz)
877 if (x <= minx) no_bounce_x_end = EINA_TRUE;
878 if ((x - minx) >= maxx) no_bounce_x_end = EINA_TRUE;
880 if (!sd->bounce_vert)
882 if (y <= miny) no_bounce_y_end = EINA_TRUE;
883 if ((y - miny) >= maxy) no_bounce_y_end = EINA_TRUE;
886 ((sd->down.bounce_x_hold) && (sd->down.bounce_y_hold)) ||
887 (no_bounce_x_end && no_bounce_y_end))
889 _smart_anim_stop(sd->smart_obj);
891 sd->down.momentum_animator = NULL;
892 sd->down.bounce_x_hold = EINA_FALSE;
893 sd->down.bounce_y_hold = EINA_FALSE;
898 if (sd->child.resized)
899 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
900 return ECORE_CALLBACK_CANCEL;
903 return ECORE_CALLBACK_RENEW;
907 bounce_eval(Smart_Data *sd)
909 Evas_Coord mx, my, px, py, bx, by, b2x, b2y, minx = 0, miny = 0;
911 if (sd->freeze) return;
912 if ((!sd->bouncemex) && (!sd->bouncemey)) return;
913 if (sd->down.now) return; // down bounce while still held down
914 if (sd->down.onhold_animator)
916 ecore_animator_del(sd->down.onhold_animator);
917 sd->down.onhold_animator = NULL;
918 if (sd->child.resized)
919 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
921 if (sd->down.hold_animator)
923 ecore_animator_del(sd->down.hold_animator);
924 sd->down.hold_animator = NULL;
925 if (sd->child.resized)
926 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
928 sd->pan_func.max_get(sd->pan_obj, &mx, &my);
929 sd->pan_func.min_get(sd->pan_obj, &minx, &miny);
930 sd->pan_func.get(sd->pan_obj, &px, &py);
933 if (px < minx) px = minx;
934 if ((px - minx) > mx) px = mx + minx;
935 if (py < miny) py = miny;
936 if ((py - miny) > my) py = my + miny;
940 (!elm_widget_drag_child_locked_x_get(sd->widget)))
942 if ((!sd->down.bounce_x_animator) && (!sd->bounce_animator_disabled))
946 if (sd->scrollto.x.animator)
948 ecore_animator_del(sd->scrollto.x.animator);
949 sd->scrollto.x.animator = NULL;
951 sd->down.bounce_x_animator = ecore_animator_add(_smart_bounce_x_animator, sd);
952 sd->down.anim_start2 = ecore_loop_time_get();
956 if (sd->down.momentum_animator) sd->down.b0x = sd->down.ax;
957 else sd->down.b0x = 0;
962 (!elm_widget_drag_child_locked_y_get(sd->widget)))
964 if ((!sd->down.bounce_y_animator) && (!sd->bounce_animator_disabled))
968 if (sd->scrollto.y.animator)
970 ecore_animator_del(sd->scrollto.y.animator);
971 sd->scrollto.y.animator = NULL;
973 sd->down.bounce_y_animator = ecore_animator_add(_smart_bounce_y_animator, sd);
974 sd->down.anim_start3 = ecore_loop_time_get();
978 if (sd->down.momentum_animator) sd->down.b0y = sd->down.ay;
979 else sd->down.b0y = 0;
986 elm_smart_scroller_child_pos_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
988 Evas_Coord mx = 0, my = 0, px = 0, py = 0, minx = 0, miny = 0;
992 // FIXME: allow for bounce outside of range
993 sd->pan_func.max_get(sd->pan_obj, &mx, &my);
994 sd->pan_func.min_get(sd->pan_obj, &minx, &miny);
995 if (mx > 0) vx = (double)(x - minx) / (double)mx;
997 if (vx < 0.0) vx = 0.0;
998 else if (vx > 1.0) vx = 1.0;
999 if (my > 0) vy = (double)(y - miny) / (double)my;
1001 if (vy < 0.0) vy = 0.0;
1002 else if (vy > 1.0) vy = 1.0;
1003 edje_object_part_drag_value_set(sd->edje_obj, "elm.dragable.vbar", 0.0, vy);
1004 edje_object_part_drag_value_set(sd->edje_obj, "elm.dragable.hbar", vx, 0.0);
1005 sd->pan_func.get(sd->pan_obj, &px, &py);
1006 if (!_elm_config->thumbscroll_bounce_enable)
1008 if (x < minx) x = minx;
1009 if ((x - minx) > mx) x = mx + minx;
1010 if (y < miny) y = miny;
1011 if ((y - miny) > my) y = my + miny;
1014 if (!sd->bounce_horiz)
1016 if (x < minx) x = minx;
1017 if ((x - minx) > mx) x = mx + minx;
1019 if (!sd->bounce_vert)
1021 if (y < miny) y = miny;
1022 if (y - miny > my) y = my + miny;
1025 sd->pan_func.set(sd->pan_obj, x, y);
1026 if ((px != x) || (py != y))
1027 edje_object_signal_emit(sd->edje_obj, "elm,action,scroll", "elm");
1028 if (!sd->down.bounce_x_animator)
1030 if (((x < minx) && (0 <= sd->down.dx)) ||
1031 ((x > (mx + minx)) && (0 >= sd->down.dx)))
1033 sd->bouncemex = EINA_TRUE;
1037 sd->bouncemex = EINA_FALSE;
1039 if (!sd->down.bounce_y_animator)
1041 if (((y < miny) && (0 <= sd->down.dy)) ||
1042 ((y > (my + miny)) && (0 >= sd->down.dy)))
1044 sd->bouncemey = EINA_TRUE;
1048 sd->bouncemey = EINA_FALSE;
1050 if ((x != px) || (y != py))
1052 evas_object_smart_callback_call(obj, "scroll", NULL);
1054 if ((x != px)/* && (!sd->bouncemex)*/)
1057 evas_object_smart_callback_call(obj, "edge,left", NULL);
1058 if (x == (mx + minx))
1059 evas_object_smart_callback_call(obj, "edge,right", NULL);
1061 if ((y != py)/* && (!sd->bouncemey)*/)
1064 evas_object_smart_callback_call(obj, "edge,top", NULL);
1066 evas_object_smart_callback_call(obj, "edge,bottom", NULL);
1071 elm_smart_scroller_child_pos_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
1074 sd->pan_func.get(sd->pan_obj, x, y);
1077 /* returns TRUE when we need to move the scroller, FALSE otherwise.
1078 * Updates w and h either way, so save them if you need them. */
1080 _elm_smart_scroller_child_region_show_internal(Evas_Object *obj, Evas_Coord *_x, Evas_Coord *_y, Evas_Coord w, Evas_Coord h)
1082 Evas_Coord mx = 0, my = 0, cw = 0, ch = 0, px = 0, py = 0, nx, ny, minx = 0, miny = 0, pw = 0, ph = 0, x = *_x, y = *_y;
1084 API_ENTRY return EINA_FALSE;
1085 sd->pan_func.max_get(sd->pan_obj, &mx, &my);
1086 sd->pan_func.min_get(sd->pan_obj, &minx, &miny);
1087 sd->pan_func.child_size_get(sd->pan_obj, &cw, &ch);
1088 sd->pan_func.get(sd->pan_obj, &px, &py);
1089 evas_object_geometry_get(sd->pan_obj, NULL, NULL, &pw, &ph);
1092 if ((x < px) && ((x + w) < (px + (cw - mx)))) nx = x;
1093 else if ((x > px) && ((x + w) > (px + (cw - mx)))) nx = x + w - (cw - mx);
1095 if ((y < py) && ((y + h) < (py + (ch - my)))) ny = y;
1096 else if ((y > py) && ((y + h) > (py + (ch - my)))) ny = y + h - (ch - my);
1098 if ((sd->down.bounce_x_animator) || (sd->down.bounce_y_animator) ||
1099 (sd->scrollto.x.animator) || (sd->scrollto.y.animator))
1101 _smart_anim_stop(sd->smart_obj);
1103 if (sd->scrollto.x.animator)
1105 ecore_animator_del(sd->scrollto.x.animator);
1106 sd->scrollto.x.animator = NULL;
1108 if (sd->scrollto.y.animator)
1110 ecore_animator_del(sd->scrollto.y.animator);
1111 sd->scrollto.y.animator = NULL;
1113 if (sd->down.bounce_x_animator)
1115 ecore_animator_del(sd->down.bounce_x_animator);
1116 sd->down.bounce_x_animator = NULL;
1117 sd->bouncemex = EINA_FALSE;
1118 if (sd->child.resized)
1119 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
1121 if (sd->down.bounce_y_animator)
1123 ecore_animator_del(sd->down.bounce_y_animator);
1124 sd->down.bounce_y_animator = NULL;
1125 sd->bouncemey = EINA_FALSE;
1126 if (sd->child.resized)
1127 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
1129 if (sd->down.hold_animator)
1131 ecore_animator_del(sd->down.hold_animator);
1132 sd->down.hold_animator = NULL;
1133 _smart_drag_stop(sd->smart_obj);
1134 if (sd->child.resized)
1135 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
1137 if (sd->down.momentum_animator)
1139 ecore_animator_del(sd->down.momentum_animator);
1140 sd->down.momentum_animator = NULL;
1141 sd->down.bounce_x_hold = EINA_FALSE;
1142 sd->down.bounce_y_hold = EINA_FALSE;
1147 if (sd->child.resized)
1148 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
1152 if ((x + pw) > cw) x = cw - pw;
1153 if (x < minx) x = minx;
1155 if ((y + ph) > ch) y = ch - ph;
1156 if (y < miny) y = miny;
1158 if ((x == px) && (y == py)) return EINA_FALSE;
1164 /* Set should be used for calculated positions, for example, when we move
1165 * because of an animation or because this is the correct position after
1168 elm_smart_scroller_child_region_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
1171 if (_elm_smart_scroller_child_region_show_internal(obj, &x, &y, w, h))
1173 elm_smart_scroller_child_pos_set(obj, x, y);
1176 sd->down.x = sd->down.history[0].x;
1177 sd->down.y = sd->down.history[0].y;
1181 /* Set should be used for setting the wanted position, for example a user scroll
1182 * or moving the cursor in an entry. */
1184 elm_smart_scroller_child_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
1191 if (_elm_smart_scroller_child_region_show_internal(obj, &x, &y, w, h))
1193 elm_smart_scroller_child_pos_set(obj, x, y);
1196 sd->down.x = sd->down.history[0].x;
1197 sd->down.y = sd->down.history[0].y;
1202 elm_smart_scroller_child_viewport_size_get(Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
1205 if (!sd->pan_obj) return;
1206 edje_object_calc_force(sd->edje_obj);
1207 evas_object_geometry_get(sd->pan_obj, NULL, NULL, w, h);
1211 elm_smart_scroller_step_size_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
1218 _smart_scrollbar_size_adjust(sd);
1222 elm_smart_scroller_step_size_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
1225 if (x) *x = sd->step.x;
1226 if (y) *y = sd->step.y;
1230 elm_smart_scroller_page_size_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
1235 _smart_scrollbar_size_adjust(sd);
1239 elm_smart_scroller_page_size_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
1242 if (x) *x = sd->page.x;
1243 if (y) *y = sd->page.y;
1247 elm_smart_scroller_policy_set(Evas_Object *obj, Elm_Smart_Scroller_Policy hbar, Elm_Smart_Scroller_Policy vbar)
1250 if ((sd->hbar_flags == hbar) && (sd->vbar_flags == vbar)) return;
1251 sd->hbar_flags = hbar;
1252 sd->vbar_flags = vbar;
1253 if (sd->hbar_flags == ELM_SMART_SCROLLER_POLICY_ON)
1254 edje_object_signal_emit(sd->edje_obj, "elm,action,show_always,hbar", "elm");
1255 else if (sd->hbar_flags == ELM_SMART_SCROLLER_POLICY_OFF)
1256 edje_object_signal_emit(sd->edje_obj, "elm,action,hide,hbar", "elm");
1258 edje_object_signal_emit(sd->edje_obj, "elm,action,show_notalways,hbar", "elm");
1259 if (sd->vbar_flags == ELM_SMART_SCROLLER_POLICY_ON)
1260 edje_object_signal_emit(sd->edje_obj, "elm,action,show_always,vbar", "elm");
1261 else if (sd->vbar_flags == ELM_SMART_SCROLLER_POLICY_OFF)
1262 edje_object_signal_emit(sd->edje_obj, "elm,action,hide,vbar", "elm");
1264 edje_object_signal_emit(sd->edje_obj, "elm,action,show_notalways,vbar", "elm");
1265 _smart_scrollbar_size_adjust(sd);
1269 elm_smart_scroller_policy_get(Evas_Object *obj, Elm_Smart_Scroller_Policy *hbar, Elm_Smart_Scroller_Policy *vbar)
1272 if (hbar) *hbar = sd->hbar_flags;
1273 if (vbar) *vbar = sd->vbar_flags;
1277 elm_smart_scroller_edje_object_get(Evas_Object *obj)
1279 API_ENTRY return NULL;
1280 return sd->edje_obj;
1284 elm_smart_scroller_single_dir_set(Evas_Object *obj, Eina_Bool single_dir)
1287 sd->one_dir_at_a_time = single_dir;
1291 elm_smart_scroller_single_dir_get(Evas_Object *obj)
1293 API_ENTRY return EINA_FALSE;
1294 return sd->one_dir_at_a_time;
1298 elm_smart_scroller_object_theme_set(Evas_Object *parent, Evas_Object *obj, const char *clas, const char *group, const char *style)
1302 //Does this API require parent object absolutely? if then remove this exception.
1303 double parent_scale = parent ? elm_widget_scale_get(parent) : 1;
1304 _elm_theme_object_set(parent, sd->edje_obj, clas, group, style);
1305 edje_object_scale_set(sd->edje_obj, parent_scale * _elm_config->scale);
1307 edje_object_part_swallow(sd->edje_obj, "elm.swallow.content", sd->pan_obj);
1309 elm_coords_finger_size_adjust(1, &mw, 1, &mh);
1310 if (edje_object_part_exists(sd->edje_obj, "elm.scrollbar.base"))
1313 base = edje_object_part_swallow_get(sd->edje_obj, "elm.scrollbar.base");
1316 base = evas_object_rectangle_add(evas_object_evas_get(sd->edje_obj));
1317 evas_object_color_set(base, 0, 0, 0, 0);
1318 edje_object_part_swallow(sd->edje_obj, "elm.scrollbar.base", base);
1320 if (!_elm_config->thumbscroll_enable)
1321 evas_object_size_hint_min_set(base, mw, mh);
1323 sd->vbar_visible = !sd->vbar_visible;
1324 sd->hbar_visible = !sd->hbar_visible;
1325 _smart_scrollbar_bar_visibility_adjust(sd);
1329 elm_smart_scroller_hold_set(Evas_Object *obj, Eina_Bool hold)
1336 elm_smart_scroller_freeze_set(Evas_Object *obj, Eina_Bool freeze)
1339 sd->freeze = freeze;
1342 if (sd->down.onhold_animator)
1344 ecore_animator_del(sd->down.onhold_animator);
1345 sd->down.onhold_animator = NULL;
1346 if (sd->child.resized)
1347 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
1355 elm_smart_scroller_bounce_allow_set(Evas_Object *obj, Eina_Bool horiz, Eina_Bool vert)
1358 sd->bounce_horiz = !!horiz;
1359 sd->bounce_vert = !!vert;
1363 elm_smart_scroller_bounce_allow_get(const Evas_Object *obj, Eina_Bool *horiz, Eina_Bool *vert)
1366 if (horiz) *horiz = sd->bounce_horiz;
1367 if (vert) *vert = sd->bounce_vert;
1371 elm_smart_scroller_paging_set(Evas_Object *obj, double pagerel_h, double pagerel_v, Evas_Coord pagesize_h, Evas_Coord pagesize_v)
1374 sd->pagerel_h = pagerel_h;
1375 sd->pagerel_v = pagerel_v;
1376 sd->pagesize_h = pagesize_h;
1377 sd->pagesize_v = pagesize_v;
1378 _smart_page_adjust(sd);
1382 elm_smart_scroller_paging_get(Evas_Object *obj, double *pagerel_h, double *pagerel_v, Evas_Coord *pagesize_h, Evas_Coord *pagesize_v)
1385 if (pagerel_h) *pagerel_h = sd->pagerel_h;
1386 if (pagerel_v) *pagerel_v = sd->pagerel_v;
1387 if (pagesize_h) *pagesize_h = sd->pagesize_h;
1388 if (pagesize_v) *pagesize_v = sd->pagesize_v;
1392 elm_smart_scroller_current_page_get(Evas_Object *obj, int *pagenumber_h, int *pagenumber_v)
1396 elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y);
1399 if (sd->pagesize_h > 0)
1400 *pagenumber_h = (x + sd->pagesize_h - 1) / sd->pagesize_h;
1406 if (sd->pagesize_v > 0)
1407 *pagenumber_v = (y + sd->pagesize_v - 1) / sd->pagesize_v;
1414 elm_smart_scroller_last_page_get(Evas_Object *obj, int *pagenumber_h, int *pagenumber_v)
1418 sd->pan_func.child_size_get(sd->pan_obj, &cw, &ch);
1421 if (sd->pagesize_h > 0)
1422 *pagenumber_h = cw / sd->pagesize_h + 1;
1428 if (sd->pagesize_v > 0)
1429 *pagenumber_v = ch / sd->pagesize_v + 1;
1436 elm_smart_scroller_page_show(Evas_Object *obj, int pagenumber_h, int pagenumber_v)
1439 Evas_Coord x, y, w, h;
1440 elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &w, &h);
1441 if (pagenumber_h >= 0) x = sd->pagesize_h * pagenumber_h;
1442 if (pagenumber_v >= 0) y = sd->pagesize_v * pagenumber_v;
1443 if (_elm_smart_scroller_child_region_show_internal(obj, &x, &y, w, h))
1444 elm_smart_scroller_child_pos_set(obj, x, y);
1448 elm_smart_scroller_page_bring_in(Evas_Object *obj, int pagenumber_h, int pagenumber_v)
1451 Evas_Coord x, y, w, h;
1452 elm_smart_scroller_child_viewport_size_get(sd->smart_obj, &w, &h);
1453 if (pagenumber_h >= 0) x = sd->pagesize_h * pagenumber_h;
1454 if (pagenumber_v >= 0) y = sd->pagesize_v * pagenumber_v;
1455 if (_elm_smart_scroller_child_region_show_internal(obj, &x, &y, w, h))
1457 _smart_scrollto_x(sd, _elm_config->bring_in_scroll_friction, x);
1458 _smart_scrollto_y(sd, _elm_config->bring_in_scroll_friction, y);
1463 elm_smart_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
1466 if (_elm_smart_scroller_child_region_show_internal(obj, &x, &y, w, h))
1468 _smart_scrollto_x(sd, _elm_config->bring_in_scroll_friction, x);
1469 _smart_scrollto_y(sd, _elm_config->bring_in_scroll_friction, y);
1474 elm_smart_scroller_widget_set(Evas_Object *obj, Evas_Object *wid)
1481 _elm_smart_scroller_wanted_region_set(Evas_Object *obj)
1484 Evas_Coord ww, wh, wx = sd->wx;
1486 if (sd->down.now || sd->down.momentum_animator ||
1487 sd->down.bounce_x_animator || sd->down.bounce_y_animator ||
1488 sd->down.hold_animator || sd->down.onhold_animator ||
1489 sd->scrollto.x.animator || sd->scrollto.y.animator) return;
1491 sd->child.resized = EINA_FALSE;
1493 /* Flip to RTL cords only if init in RTL mode */
1494 if (sd->is_mirrored)
1495 wx = _elm_smart_scroller_x_mirrored_get(obj, sd->wx);
1499 elm_smart_scroller_child_viewport_size_get(obj, &ww, &wh);
1507 elm_smart_scroller_child_region_set(obj, wx, sd->wy, ww, wh);
1510 /* local subsystem functions */
1512 _smart_edje_drag_v_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1517 _smart_scrollbar_read(sd);
1518 _smart_drag_start(sd->smart_obj);
1519 sd->freeze = EINA_TRUE;
1523 _smart_edje_drag_v_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1528 _smart_scrollbar_read(sd);
1529 _smart_drag_stop(sd->smart_obj);
1530 sd->freeze = EINA_FALSE;
1534 _smart_edje_drag_v(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1539 _smart_scrollbar_read(sd);
1543 _smart_edje_drag_h_start(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1548 _smart_scrollbar_read(sd);
1549 _smart_drag_start(sd->smart_obj);
1550 sd->freeze = EINA_TRUE;
1554 _smart_edje_drag_h_stop(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1559 _smart_scrollbar_read(sd);
1560 _smart_drag_stop(sd->smart_obj);
1561 sd->freeze = EINA_FALSE;
1565 _smart_edje_drag_h(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
1570 _smart_scrollbar_read(sd);
1574 _smart_child_del_hook(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1579 sd->child_obj = NULL;
1580 _smart_scrollbar_size_adjust(sd);
1581 _smart_scrollbar_reset(sd);
1585 _smart_pan_changed_hook(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1591 sd->pan_func.child_size_get(sd->pan_obj, &w, &h);
1592 if ((w != sd->child.w) || (h != sd->child.h))
1596 _smart_scrollbar_size_adjust(sd);
1597 evas_object_size_hint_min_set(sd->smart_obj, sd->child.w, sd->child.h);
1598 sd->child.resized = EINA_TRUE;
1599 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
1604 elm_smart_scroller_gravity_set(Evas_Object *obj, double x, double y)
1608 sd->pan_func.gravity_set(sd->pan_obj, x, y);
1612 elm_smart_scroller_gravity_get(Evas_Object *obj, double *x, double *y)
1616 sd->pan_func.gravity_get(sd->pan_obj, x, y);
1620 _smart_event_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1622 Evas_Event_Mouse_Wheel *ev;
1624 Evas_Coord x = 0, y = 0;
1628 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return ;
1629 if ((evas_key_modifier_is_set(ev->modifiers, "Control")) ||
1630 (evas_key_modifier_is_set(ev->modifiers, "Alt")) ||
1631 (evas_key_modifier_is_set(ev->modifiers, "Shift")) ||
1632 (evas_key_modifier_is_set(ev->modifiers, "Meta")) ||
1633 (evas_key_modifier_is_set(ev->modifiers, "Hyper")) ||
1634 (evas_key_modifier_is_set(ev->modifiers, "Super")))
1636 elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y);
1637 if ((sd->down.bounce_x_animator) || (sd->down.bounce_y_animator) ||
1638 (sd->scrollto.x.animator) || (sd->scrollto.y.animator))
1640 _smart_anim_stop(sd->smart_obj);
1642 if (sd->scrollto.x.animator)
1644 ecore_animator_del(sd->scrollto.x.animator);
1645 sd->scrollto.x.animator = NULL;
1647 if (sd->scrollto.y.animator)
1649 ecore_animator_del(sd->scrollto.y.animator);
1650 sd->scrollto.y.animator = NULL;
1652 if (sd->down.bounce_x_animator)
1654 ecore_animator_del(sd->down.bounce_x_animator);
1655 sd->down.bounce_x_animator = NULL;
1656 sd->bouncemex = EINA_FALSE;
1657 if (sd->child.resized)
1658 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
1660 if (sd->down.bounce_y_animator)
1662 ecore_animator_del(sd->down.bounce_y_animator);
1663 sd->down.bounce_y_animator = NULL;
1664 sd->bouncemey = EINA_FALSE;
1665 if (sd->child.resized)
1666 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
1669 y += ev->z * sd->step.y;
1670 else if (ev->direction == 1)
1671 x += ev->z * sd->step.x;
1673 if ((!sd->hold) && (!sd->freeze))
1675 _update_wanted_coordinates(sd, x, y);
1676 elm_smart_scroller_child_pos_set(sd->smart_obj, x, y);
1681 _smart_event_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1683 Evas_Event_Mouse_Down *ev;
1685 Evas_Coord x = 0, y = 0;
1689 // if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return ;
1690 if (_elm_config->thumbscroll_enable)
1692 sd->down.hold = EINA_FALSE;
1693 if ((sd->down.bounce_x_animator) || (sd->down.bounce_y_animator) ||
1694 (sd->down.momentum_animator) || (sd->scrollto.x.animator) ||
1695 (sd->scrollto.y.animator))
1697 ev->event_flags |= EVAS_EVENT_FLAG_ON_SCROLL | EVAS_EVENT_FLAG_ON_HOLD;
1698 sd->down.scroll = EINA_TRUE;
1699 sd->down.hold = EINA_TRUE;
1700 _smart_anim_stop(sd->smart_obj);
1702 if (sd->scrollto.x.animator)
1704 ecore_animator_del(sd->scrollto.x.animator);
1705 sd->scrollto.x.animator = NULL;
1707 if (sd->scrollto.y.animator)
1709 ecore_animator_del(sd->scrollto.y.animator);
1710 sd->scrollto.y.animator = NULL;
1712 if (sd->down.bounce_x_animator)
1714 ecore_animator_del(sd->down.bounce_x_animator);
1715 sd->down.bounce_x_animator = NULL;
1716 sd->bouncemex = EINA_FALSE;
1717 if (sd->child.resized)
1718 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
1720 if (sd->down.bounce_y_animator)
1722 ecore_animator_del(sd->down.bounce_y_animator);
1723 sd->down.bounce_y_animator = NULL;
1724 sd->bouncemey = EINA_FALSE;
1725 if (sd->child.resized)
1726 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
1728 if (sd->down.hold_animator)
1730 ecore_animator_del(sd->down.hold_animator);
1731 sd->down.hold_animator = NULL;
1732 _smart_drag_stop(sd->smart_obj);
1733 if (sd->child.resized)
1734 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
1736 if (sd->down.momentum_animator)
1738 ecore_animator_del(sd->down.momentum_animator);
1739 sd->down.momentum_animator = NULL;
1740 sd->down.bounce_x_hold = EINA_FALSE;
1741 sd->down.bounce_y_hold = EINA_FALSE;
1744 if (sd->child.resized)
1745 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
1747 if (ev->button == 1)
1749 sd->down.hist.est_timestamp_diff =
1750 ecore_loop_time_get() - ((double)ev->timestamp / 1000.0);
1751 sd->down.hist.tadd = 0.0;
1752 sd->down.hist.dxsum = 0.0;
1753 sd->down.hist.dysum = 0.0;
1754 sd->down.now = EINA_TRUE;
1755 sd->down.dragged = EINA_FALSE;
1756 sd->down.dir_x = EINA_FALSE;
1757 sd->down.dir_y = EINA_FALSE;
1758 sd->down.x = ev->canvas.x;
1759 sd->down.y = ev->canvas.y;
1760 elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y);
1763 sd->down.locked = EINA_FALSE;
1764 memset(&(sd->down.history[0]), 0, sizeof(sd->down.history[0]) * 60);
1766 sd->down.history[0].timestamp = ev->timestamp / 1000.0;
1767 sd->down.history[0].localtimestamp = ecore_loop_time_get();
1769 sd->down.history[0].timestamp = ecore_loop_time_get();
1771 sd->down.history[0].x = ev->canvas.x;
1772 sd->down.history[0].y = ev->canvas.y;
1774 sd->down.dragged_began = EINA_FALSE;
1775 sd->down.hold_parent = EINA_FALSE;
1776 sd->down.cancelled = EINA_FALSE;
1781 _down_coord_eval(Smart_Data *sd, Evas_Coord *x, Evas_Coord *y)
1783 Evas_Coord minx, miny;
1785 if (sd->down.dir_x) *x = sd->down.sx - (*x - sd->down.x);
1786 else *x = sd->down.sx;
1787 if (sd->down.dir_y) *y = sd->down.sy - (*y - sd->down.y);
1788 else *y = sd->down.sy;
1790 if ((sd->down.dir_x) || (sd->down.dir_y))
1792 if (!((sd->down.dir_x) && (sd->down.dir_y)))
1794 if (sd->down.dir_x) *y = sd->down.locked_y;
1795 else *x = sd->down.locked_x;
1799 sd->pan_func.min_get(sd->pan_obj, &minx, &miny);
1802 *x += (minx - *x) * _elm_config->thumbscroll_border_friction;
1803 else if (sd->child.w <= sd->w)
1804 *x += (sd->down.sx - *x) * _elm_config->thumbscroll_border_friction;
1805 else if ((sd->child.w - sd->w + minx) < *x)
1806 *x += (sd->child.w - sd->w + minx - *x) *
1807 _elm_config->thumbscroll_border_friction;
1810 *y += (miny - *y) * _elm_config->thumbscroll_border_friction;
1811 else if (sd->child.h <= sd->h)
1812 *y += (sd->down.sy - *y) * _elm_config->thumbscroll_border_friction;
1813 else if ((sd->child.h - sd->h + miny) < *y)
1814 *y += (sd->child.h - sd->h + miny - *y) *
1815 _elm_config->thumbscroll_border_friction;
1819 _smart_hold_animator(void *data)
1821 Smart_Data *sd = data;
1822 Evas_Coord ox = 0, oy = 0, fx = 0, fy= 0;
1824 fx = sd->down.hold_x;
1825 fy = sd->down.hold_y;
1826 if (_elm_config->scroll_smooth_amount > 0.0)
1829 Evas_Coord basex = 0, basey = 0, x, y;
1830 double dt, t, tdiff, tnow, twin;
1832 Evas_Coord x, y, dx, dy;
1836 tdiff = sd->down.hist.est_timestamp_diff;
1837 tnow = ecore_time_get() - tdiff;
1839 twin = _elm_config->scroll_smooth_time_window;
1840 for (i = 0; i < 60; i++)
1842 // oldest point is sd->down.history[i]
1843 // newset is sd->down.history[0]
1844 dt = t - sd->down.history[i].timestamp;
1850 x = sd->down.history[i].x;
1851 y = sd->down.history[i].y;
1852 _down_coord_eval(sd, &x, &y);
1858 pos[i].x = x - basex;
1859 pos[i].y = y - basey;
1861 sd->down.history[i].timestamp - sd->down.history[0].timestamp;
1867 double dtsum = 0.0, tadd, maxdt;
1868 double dxsum = 0.0, dysum = 0.0, xsum = 0.0, ysum = 0.0;
1870 for (i = 0; i < (count - 1); i++)
1872 pos[i].dx = pos[i].x - pos[i + 1].x;
1873 pos[i].dy = pos[i].y - pos[i + 1].y;
1874 pos[i].dt = pos[i].t - pos[i + 1].t;
1887 tadd = tnow - sd->down.history[0].timestamp + _elm_config->scroll_smooth_future_time;
1888 tadd = tadd - (maxdt / 2);
1889 #define WEIGHT(n, o, v) n = (((double)o * (1.0 - v)) + ((double)n * v))
1890 WEIGHT(tadd, sd->down.hist.tadd, _elm_config->scroll_smooth_history_weight);
1891 WEIGHT(dxsum, sd->down.hist.dxsum, _elm_config->scroll_smooth_history_weight);
1892 WEIGHT(dysum, sd->down.hist.dysum, _elm_config->scroll_smooth_history_weight);
1893 fx = basex + xsum + ((dxsum * tadd) / dtsum);
1894 fy = basey + ysum + ((dysum * tadd) / dtsum);
1895 sd->down.hist.tadd = tadd;
1896 sd->down.hist.dxsum = dxsum;
1897 sd->down.hist.dysum = dysum;
1898 WEIGHT(fx, sd->down.hold_x, _elm_config->scroll_smooth_amount);
1899 WEIGHT(fy, sd->down.hold_y, _elm_config->scroll_smooth_amount);
1901 // printf("%3.5f %i %i\n", ecore_time_get(), sd->down.hold_y, fy);
1904 elm_smart_scroller_child_pos_get(sd->smart_obj, &ox, &oy);
1907 if ((!sd->widget) ||
1908 (!elm_widget_drag_child_locked_x_get(sd->widget)))
1913 if ((!sd->widget) ||
1914 (!elm_widget_drag_child_locked_y_get(sd->widget)))
1918 elm_smart_scroller_child_pos_set(sd->smart_obj, ox, oy);
1919 return ECORE_CALLBACK_RENEW;
1923 _smart_event_post_up(void *data, Evas *e __UNUSED__)
1925 Smart_Data *sd = data;
1928 if (sd->down.dragged)
1930 elm_widget_drag_lock_x_set(sd->widget, 0);
1931 elm_widget_drag_lock_y_set(sd->widget, 0);
1938 _smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
1940 Evas_Event_Mouse_Down *ev;
1942 Evas_Coord x = 0, y = 0, ox = 0, oy = 0;
1946 sd->down.hold_parent = EINA_FALSE;
1949 // if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return ;
1950 evas_post_event_callback_push(e, _smart_event_post_up, sd);
1951 // FIXME: respect elm_widget_scroll_hold_get of parent container
1952 if (_elm_config->thumbscroll_enable)
1954 if (ev->button == 1)
1956 if (sd->down.onhold_animator)
1958 ecore_animator_del(sd->down.onhold_animator);
1959 sd->down.onhold_animator = NULL;
1960 if (sd->child.resized)
1961 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
1963 x = ev->canvas.x - sd->down.x;
1964 y = ev->canvas.y - sd->down.y;
1965 if (sd->down.dragged)
1967 _smart_drag_stop(sd->smart_obj);
1968 if ((!sd->hold) && (!sd->freeze))
1972 Evas_Coord ax, ay, dx, dy, vel;
1975 t = ev->timestamp / 1000.0;
1977 t = ecore_loop_time_get();
1979 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1984 printf("------ %i %i\n", ev->canvas.x, ev->canvas.y);
1986 for (i = 0; i < 60; i++)
1988 dt = t - sd->down.history[i].timestamp;
1989 if (dt > 0.2) break;
1991 printf("H: %i %i @ %1.3f\n",
1992 sd->down.history[i].x,
1993 sd->down.history[i].y, dt);
1996 ax += sd->down.history[i].x;
1997 ay += sd->down.history[i].y;
2002 at /= _elm_config->thumbscroll_sensitivity_friction;
2003 dx = ev->canvas.x - ax;
2004 dy = ev->canvas.y - ay;
2007 vel = sqrt((dx * dx) + (dy * dy)) / at;
2008 if ((_elm_config->thumbscroll_friction > 0.0) &&
2009 (vel > _elm_config->thumbscroll_momentum_threshold))
2011 int minx, miny, mx, my, px, py;
2012 sd->pan_func.min_get(sd->pan_obj, &minx, &miny);
2013 sd->pan_func.max_get(sd->pan_obj, &mx, &my);
2014 sd->pan_func.get(sd->pan_obj, &px, &py);
2015 sd->down.dx = ((double)dx / at);
2016 sd->down.dy = ((double)dy / at);
2017 if (((sd->down.dx > 0) && (sd->down.pdx > 0)) ||
2018 ((sd->down.dx < 0) && (sd->down.pdx < 0)))
2019 if (px > minx && px < mx)
2020 sd->down.dx += (double)sd->down.pdx * 1.5; // FIXME: * 1.5 - probably should be config
2021 if (((sd->down.dy > 0) && (sd->down.pdy > 0)) ||
2022 ((sd->down.dy < 0) && (sd->down.pdy < 0)))
2023 if (py > miny && py < my)
2024 sd->down.dy += (double)sd->down.pdy * 1.5; // FIXME: * 1.5 - probably should be config
2025 if (((sd->down.dx > 0) && (sd->down.pdx > 0)) ||
2026 ((sd->down.dx < 0) && (sd->down.pdx < 0)) ||
2027 ((sd->down.dy > 0) && (sd->down.pdy > 0)) ||
2028 ((sd->down.dy < 0) && (sd->down.pdy < 0)))
2030 double t = ecore_loop_time_get();
2031 double dt = t - sd->down.anim_start;
2033 if (dt < 0.0) dt = 0.0;
2034 else if (dt > _elm_config->thumbscroll_friction)
2035 dt = _elm_config->thumbscroll_friction;
2036 sd->down.extra_time = _elm_config->thumbscroll_friction - dt;
2039 sd->down.extra_time = 0.0;
2040 sd->down.pdx = sd->down.dx;
2041 sd->down.pdy = sd->down.dy;
2044 if (!_smart_do_page(sd))
2046 if ((!sd->down.momentum_animator) && (!sd->momentum_animator_disabled))
2048 sd->down.momentum_animator = ecore_animator_add(_smart_momentum_animator, sd);
2049 ev->event_flags |= EVAS_EVENT_FLAG_ON_SCROLL;
2050 _smart_anim_start(sd->smart_obj);
2052 sd->down.anim_start = ecore_loop_time_get();
2053 elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y);
2067 evas_event_feed_hold(e, 0, ev->timestamp, ev->data);
2068 if (_smart_do_page(sd))
2070 Evas_Coord pgx, pgy;
2072 elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y);
2073 if ((!sd->widget) ||
2074 (!elm_widget_drag_child_locked_x_get(sd->widget)))
2076 pgx = _smart_page_x_get(sd, ox);
2079 ev->event_flags |= EVAS_EVENT_FLAG_ON_SCROLL;
2080 _smart_scrollto_x(sd, _elm_config->page_scroll_friction, pgx);
2083 if ((!sd->widget) ||
2084 (!elm_widget_drag_child_locked_y_get(sd->widget)))
2086 pgy = _smart_page_y_get(sd, oy);
2089 ev->event_flags |= EVAS_EVENT_FLAG_ON_SCROLL;
2090 _smart_scrollto_y(sd, _elm_config->page_scroll_friction, pgy);
2099 if (_smart_do_page(sd))
2101 Evas_Coord pgx, pgy;
2103 elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y);
2104 if ((!sd->widget) ||
2105 (!elm_widget_drag_child_locked_x_get(sd->widget)))
2107 pgx = _smart_page_x_get(sd, ox);
2108 if (pgx != x) _smart_scrollto_x(sd, _elm_config->page_scroll_friction, pgx);
2110 if ((!sd->widget) ||
2111 (!elm_widget_drag_child_locked_y_get(sd->widget)))
2113 pgy = _smart_page_y_get(sd, oy);
2114 if (pgy != y) _smart_scrollto_y(sd, _elm_config->page_scroll_friction, pgy);
2118 if (sd->down.hold_animator)
2120 ecore_animator_del(sd->down.hold_animator);
2121 sd->down.hold_animator = NULL;
2122 if (sd->child.resized)
2123 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
2125 if (sd->down.scroll)
2127 ev->event_flags |= EVAS_EVENT_FLAG_ON_SCROLL;
2128 sd->down.scroll = EINA_FALSE;
2132 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
2133 sd->down.hold = EINA_FALSE;
2135 sd->down.dragged_began = EINA_FALSE;
2136 sd->down.dir_x = EINA_FALSE;
2137 sd->down.dir_y = EINA_FALSE;
2138 sd->down.want_dragged = EINA_FALSE;
2139 sd->down.dragged = EINA_FALSE;
2140 sd->down.now = EINA_FALSE;
2141 elm_smart_scroller_child_pos_get(sd->smart_obj, &x, &y);
2142 elm_smart_scroller_child_pos_set(sd->smart_obj, x, y);
2143 _update_wanted_coordinates(sd, x, y);
2145 if (sd->child.resized)
2146 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
2148 if (!_smart_do_page(sd))
2155 _smart_onhold_animator(void *data)
2160 Evas_Coord x, y, ox, oy;
2163 t = ecore_loop_time_get();
2164 if (sd->down.onhold_tlast > 0.0)
2166 td = t - sd->down.onhold_tlast;
2167 vx = sd->down.onhold_vx * td * (double)_elm_config->thumbscroll_threshold * 2.0;
2168 vy = sd->down.onhold_vy * td * (double)_elm_config->thumbscroll_threshold * 2.0;
2169 elm_smart_scroller_child_pos_get(sd->smart_obj, &ox, &oy);
2175 if ((!sd->widget) ||
2176 (!elm_widget_drag_child_locked_x_get(sd->widget)))
2178 sd->down.onhold_vxe += vx;
2179 x = ox + (int)sd->down.onhold_vxe;
2180 sd->down.onhold_vxe -= (int)sd->down.onhold_vxe;
2186 if ((!sd->widget) ||
2187 (!elm_widget_drag_child_locked_y_get(sd->widget)))
2189 sd->down.onhold_vye += vy;
2190 y = oy + (int)sd->down.onhold_vye;
2191 sd->down.onhold_vye -= (int)sd->down.onhold_vye;
2195 elm_smart_scroller_child_pos_set(sd->smart_obj, x, y);
2197 sd->down.onhold_tlast = t;
2198 return ECORE_CALLBACK_RENEW;
2202 _smart_event_post_move(void *data, Evas *e __UNUSED__)
2204 Smart_Data *sd = data;
2206 if (sd->down.want_dragged)
2210 if (sd->down.hold_parent)
2212 if ((sd->down.dir_x) && !can_scroll(sd, sd->down.hdir))
2214 sd->down.dir_x = EINA_FALSE;
2216 if ((sd->down.dir_y) && !can_scroll(sd, sd->down.vdir))
2218 sd->down.dir_y = EINA_FALSE;
2223 if ((!sd->widget) ||
2224 (!elm_widget_drag_child_locked_x_get(sd->widget)))
2226 sd->down.want_dragged = EINA_FALSE;
2227 sd->down.dragged = EINA_TRUE;
2230 elm_widget_drag_lock_x_set(sd->widget, 1);
2235 sd->down.dir_x = EINA_FALSE;
2239 if ((!sd->widget) ||
2240 (!elm_widget_drag_child_locked_y_get(sd->widget)))
2242 sd->down.want_dragged = EINA_FALSE;
2243 sd->down.dragged = EINA_TRUE;
2246 elm_widget_drag_lock_y_set(sd->widget, 1);
2251 sd->down.dir_y = EINA_FALSE;
2253 if ((!sd->down.dir_x) && (!sd->down.dir_y))
2255 sd->down.cancelled = EINA_TRUE;
2257 if (start) _smart_drag_start(sd->smart_obj);
2263 _smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info)
2265 Evas_Event_Mouse_Move *ev;
2267 Evas_Coord x = 0, y = 0;
2271 // if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return ;
2272 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
2273 sd->down.hold_parent = EINA_TRUE;
2274 evas_post_event_callback_push(e, _smart_event_post_move, sd);
2276 // FIXME: respect elm_widget_scroll_hold_get of parent container
2277 if (_elm_config->thumbscroll_enable)
2283 if (sd->scrollto.x.animator)
2286 ecore_animator_del(sd->scrollto.x.animator);
2287 sd->scrollto.x.animator = NULL;
2288 sd->pan_func.get(sd->pan_obj, &px, NULL);
2290 sd->down.x = sd->down.history[0].x;
2293 if (sd->scrollto.y.animator)
2296 ecore_animator_del(sd->scrollto.y.animator);
2297 sd->scrollto.y.animator = NULL;
2298 sd->pan_func.get(sd->pan_obj, NULL, &py);
2300 sd->down.y = sd->down.history[0].y;
2304 printf("::: %i %i\n", ev->cur.canvas.x, ev->cur.canvas.y);
2306 memmove(&(sd->down.history[1]), &(sd->down.history[0]),
2307 sizeof(sd->down.history[0]) * (60 - 1));
2309 sd->down.history[0].timestamp = ev->timestamp / 1000.0;
2310 sd->down.history[0].localtimestamp = ecore_loop_time_get();
2312 sd->down.history[0].timestamp = ecore_loop_time_get();
2314 sd->down.history[0].x = ev->cur.canvas.x;
2315 sd->down.history[0].y = ev->cur.canvas.y;
2317 if (!sd->down.dragged_began)
2319 x = ev->cur.canvas.x - sd->down.x;
2320 y = ev->cur.canvas.y - sd->down.y;
2325 if (x > 0) sd->down.hdir = LEFT;
2326 else if (x < 0) sd->down.hdir = RIGHT;
2327 if (y > 0) sd->down.vdir = UP;
2328 else if (y < 0) sd->down.vdir = DOWN;
2333 if ((sd->one_dir_at_a_time) &&
2334 (!((sd->down.dir_x) || (sd->down.dir_y))))
2336 if (x > _elm_config->thumbscroll_threshold)
2340 sd->down.dir_x = EINA_TRUE;
2341 sd->down.dir_y = EINA_FALSE;
2345 if (y > _elm_config->thumbscroll_threshold)
2349 sd->down.dir_x = EINA_FALSE;
2350 sd->down.dir_y = EINA_TRUE;
2356 sd->down.dir_x = EINA_TRUE;
2357 sd->down.dir_y = EINA_TRUE;
2362 sd->down.dir_x = EINA_TRUE;
2363 sd->down.dir_y = EINA_TRUE;
2366 if ((!sd->hold) && (!sd->freeze))
2368 if ((sd->down.dragged) ||
2369 (((x * x) + (y * y)) >
2370 (_elm_config->thumbscroll_threshold *
2371 _elm_config->thumbscroll_threshold)))
2373 sd->down.dragged_began = EINA_TRUE;
2374 if (!sd->down.dragged)
2376 sd->down.want_dragged = EINA_TRUE;
2377 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
2378 // evas_event_feed_hold(e, 1, ev->timestamp, ev->data);
2379 // _smart_drag_start(sd->smart_obj);
2381 if (sd->down.dragged)
2383 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
2385 // ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
2386 // sd->down.dragged = 1;
2388 x = sd->down.sx - (ev->cur.canvas.x - sd->down.x);
2392 y = sd->down.sy - (ev->cur.canvas.y - sd->down.y);
2395 if ((sd->down.dir_x) || (sd->down.dir_y))
2397 if (!sd->down.locked)
2399 sd->down.locked_x = x;
2400 sd->down.locked_y = y;
2401 sd->down.locked = EINA_TRUE;
2403 if (!((sd->down.dir_x) && (sd->down.dir_y)))
2405 if (sd->down.dir_x) y = sd->down.locked_y;
2406 else x = sd->down.locked_x;
2410 Evas_Coord minx, miny;
2411 sd->pan_func.min_get(sd->pan_obj, &minx, &miny);
2414 _elm_config->thumbscroll_border_friction;
2415 else if (sd->child.h <= sd->h)
2416 y += (sd->down.sy - y) *
2417 _elm_config->thumbscroll_border_friction;
2418 else if ((sd->child.h - sd->h + miny) < y)
2419 y += (sd->child.h - sd->h + miny - y) *
2420 _elm_config->thumbscroll_border_friction;
2423 _elm_config->thumbscroll_border_friction;
2424 else if (sd->child.w <= sd->w)
2425 x += (sd->down.sx - x) *
2426 _elm_config->thumbscroll_border_friction;
2427 else if ((sd->child.w - sd->w + minx) < x)
2428 x += (sd->child.w - sd->w + minx - x) *
2429 _elm_config->thumbscroll_border_friction;
2432 sd->down.hold_x = x;
2433 sd->down.hold_y = y;
2434 if (!sd->down.hold_animator)
2435 sd->down.hold_animator =
2436 ecore_animator_add(_smart_hold_animator, sd);
2437 // printf("a %i %i\n", sd->down.hold_x, sd->down.hold_y);
2438 // _smart_onhold_animator(sd);
2439 // elm_smart_scroller_child_pos_set(sd->smart_obj, x, y);
2443 if (sd->down.dragged_began)
2445 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
2448 sd->down.hold = EINA_TRUE;
2449 evas_event_feed_hold(e, 1, ev->timestamp, ev->data);
2454 else if (!sd->freeze)
2456 Evas_Coord ex, ey, ew, eh;
2457 double vx = 0.0, vy = 0.0;
2459 evas_object_geometry_get(sd->event_obj, &ex, &ey, &ew, &eh);
2460 x = ev->cur.canvas.x - ex;
2461 y = ev->cur.canvas.y - ey;
2462 if (x < _elm_config->thumbscroll_threshold)
2464 if (_elm_config->thumbscroll_threshold > 0.0)
2465 vx = -(double)(_elm_config->thumbscroll_threshold - x) /
2466 _elm_config->thumbscroll_threshold;
2470 else if (x > (ew - _elm_config->thumbscroll_threshold))
2472 if (_elm_config->thumbscroll_threshold > 0.0)
2473 vx = (double)(_elm_config->thumbscroll_threshold - (ew - x)) /
2474 _elm_config->thumbscroll_threshold;
2478 if (y < _elm_config->thumbscroll_threshold)
2480 if (_elm_config->thumbscroll_threshold > 0.0)
2481 vy = -(double)(_elm_config->thumbscroll_threshold - y) /
2482 _elm_config->thumbscroll_threshold;
2486 else if (y > (eh - _elm_config->thumbscroll_threshold))
2488 if (_elm_config->thumbscroll_threshold > 0.0)
2489 vy = (double)(_elm_config->thumbscroll_threshold - (eh - y)) /
2490 _elm_config->thumbscroll_threshold;
2494 if ((vx != 0.0) || (vy != 0.0))
2496 sd->down.onhold_vx = vx;
2497 sd->down.onhold_vy = vy;
2498 if (!sd->down.onhold_animator)
2500 sd->down.onhold_vxe = 0.0;
2501 sd->down.onhold_vye = 0.0;
2502 sd->down.onhold_tlast = 0.0;
2503 sd->down.onhold_animator = ecore_animator_add(_smart_onhold_animator, sd);
2505 // printf("b %i %i\n", sd->down.hold_x, sd->down.hold_y);
2509 if (sd->down.onhold_animator)
2511 ecore_animator_del(sd->down.onhold_animator);
2512 sd->down.onhold_animator = NULL;
2513 if (sd->child.resized)
2514 _elm_smart_scroller_wanted_region_set(sd->smart_obj);
2523 _smart_scrollbar_read(Smart_Data *sd)
2525 Evas_Coord x, y, mx = 0, my = 0, px, py, minx = 0, miny = 0;
2528 if ((sd->down.dragged) || (sd->down.bounce_x_animator)
2529 || (sd->down.bounce_y_animator) || (sd->down.momentum_animator)
2530 || (sd->scrollto.x.animator) || (sd->scrollto.y.animator))
2532 edje_object_part_drag_value_get(sd->edje_obj, "elm.dragable.vbar", NULL, &vy);
2533 edje_object_part_drag_value_get(sd->edje_obj, "elm.dragable.hbar", &vx, NULL);
2534 sd->pan_func.max_get(sd->pan_obj, &mx, &my);
2535 sd->pan_func.min_get(sd->pan_obj, &minx, &miny);
2536 x = vx * (double)mx + minx;
2537 y = vy * (double)my + miny;
2538 sd->pan_func.get(sd->pan_obj, &px, &py);
2539 sd->pan_func.set(sd->pan_obj, x, y);
2540 if ((px != x) || (py != y))
2541 edje_object_signal_emit(sd->edje_obj, "elm,action,scroll", "elm");
2545 _smart_scrollbar_reset(Smart_Data *sd)
2547 Evas_Coord px = 0, py = 0, minx = 0, miny = 0;
2549 edje_object_part_drag_value_set(sd->edje_obj, "elm.dragable.vbar", 0.0, 0.0);
2550 edje_object_part_drag_value_set(sd->edje_obj, "elm.dragable.hbar", 0.0, 0.0);
2551 if ((!sd->child_obj) && (!sd->extern_pan))
2553 edje_object_part_drag_size_set(sd->edje_obj, "elm.dragable.vbar", 1.0, 1.0);
2554 edje_object_part_drag_size_set(sd->edje_obj, "elm.dragable.hbar", 1.0, 1.0);
2558 sd->pan_func.min_get(sd->pan_obj, &minx, &miny);
2559 sd->pan_func.get(sd->pan_obj, &px, &py);
2560 sd->pan_func.set(sd->pan_obj, minx, miny);
2562 if ((px != minx) || (py != miny))
2563 edje_object_signal_emit(sd->edje_obj, "elm,action,scroll", "elm");
2567 _smart_scrollbar_bar_v_visibility_adjust(Smart_Data *sd)
2569 int scroll_v_vis_change = 0;
2570 Evas_Coord h, vw = 0, vh = 0;
2574 evas_object_geometry_get(sd->pan_obj, NULL, NULL, &vw, &vh);
2575 if (sd->vbar_visible)
2577 if (sd->vbar_flags == ELM_SMART_SCROLLER_POLICY_AUTO)
2579 if ((sd->child_obj) || (sd->extern_pan))
2583 scroll_v_vis_change = 1;
2584 sd->vbar_visible = EINA_FALSE;
2589 scroll_v_vis_change = 1;
2590 sd->vbar_visible = EINA_FALSE;
2593 else if (sd->vbar_flags == ELM_SMART_SCROLLER_POLICY_OFF)
2595 scroll_v_vis_change = 1;
2596 sd->vbar_visible = EINA_FALSE;
2601 if (sd->vbar_flags == ELM_SMART_SCROLLER_POLICY_AUTO)
2603 if ((sd->child_obj) || (sd->extern_pan))
2607 scroll_v_vis_change = 1;
2608 sd->vbar_visible = EINA_TRUE;
2612 else if (sd->vbar_flags == ELM_SMART_SCROLLER_POLICY_ON)
2614 scroll_v_vis_change = 1;
2615 sd->vbar_visible = EINA_TRUE;
2618 if (scroll_v_vis_change)
2620 if (sd->vbar_flags != ELM_SMART_SCROLLER_POLICY_OFF)
2622 if (sd->vbar_visible)
2623 edje_object_signal_emit(sd->edje_obj, "elm,action,show,vbar", "elm");
2625 edje_object_signal_emit(sd->edje_obj, "elm,action,hide,vbar", "elm");
2626 edje_object_message_signal_process(sd->edje_obj);
2627 _smart_scrollbar_size_adjust(sd);
2630 edje_object_signal_emit(sd->edje_obj, "elm,action,hide,vbar", "elm");
2632 return scroll_v_vis_change;
2636 _smart_scrollbar_bar_h_visibility_adjust(Smart_Data *sd)
2638 int scroll_h_vis_change = 0;
2639 Evas_Coord w, vw = 0, vh = 0;
2643 evas_object_geometry_get(sd->pan_obj, NULL, NULL, &vw, &vh);
2644 if (sd->hbar_visible)
2646 if (sd->hbar_flags == ELM_SMART_SCROLLER_POLICY_AUTO)
2648 if ((sd->child_obj) || (sd->extern_pan))
2652 scroll_h_vis_change = 1;
2653 sd->hbar_visible = EINA_FALSE;
2658 scroll_h_vis_change = 1;
2659 sd->hbar_visible = EINA_FALSE;
2662 else if (sd->hbar_flags == ELM_SMART_SCROLLER_POLICY_OFF)
2664 scroll_h_vis_change = 1;
2665 sd->hbar_visible = EINA_FALSE;
2670 if (sd->hbar_flags == ELM_SMART_SCROLLER_POLICY_AUTO)
2672 if ((sd->child_obj) || (sd->extern_pan))
2676 scroll_h_vis_change = 1;
2677 sd->hbar_visible = EINA_TRUE;
2681 else if (sd->hbar_flags == ELM_SMART_SCROLLER_POLICY_ON)
2683 scroll_h_vis_change = 1;
2684 sd->hbar_visible = EINA_TRUE;
2687 if (scroll_h_vis_change)
2689 if (sd->hbar_flags != ELM_SMART_SCROLLER_POLICY_OFF)
2691 if (sd->hbar_visible)
2692 edje_object_signal_emit(sd->edje_obj, "elm,action,show,hbar", "elm");
2694 edje_object_signal_emit(sd->edje_obj, "elm,action,hide,hbar", "elm");
2695 edje_object_message_signal_process(sd->edje_obj);
2696 _smart_scrollbar_size_adjust(sd);
2699 edje_object_signal_emit(sd->edje_obj, "elm,action,hide,hbar", "elm");
2700 _smart_scrollbar_size_adjust(sd);
2702 return scroll_h_vis_change;
2706 _smart_scrollbar_bar_visibility_adjust(Smart_Data *sd)
2710 changed |= _smart_scrollbar_bar_h_visibility_adjust(sd);
2711 changed |= _smart_scrollbar_bar_v_visibility_adjust(sd);
2714 _smart_scrollbar_bar_h_visibility_adjust(sd);
2715 _smart_scrollbar_bar_v_visibility_adjust(sd);
2720 _smart_scrollbar_size_adjust(Smart_Data *sd)
2722 if ((sd->child_obj) || (sd->extern_pan))
2724 Evas_Coord x, y, w, h, mx = 0, my = 0, vw = 0, vh = 0, px, py, minx = 0, miny = 0;
2725 double vx, vy, size;
2727 edje_object_part_geometry_get(sd->edje_obj, "elm.swallow.content",
2728 NULL, NULL, &vw, &vh);
2731 size = (double)vw / (double)w;
2735 edje_object_part_drag_value_set(sd->edje_obj, "elm.dragable.hbar", 0.0, 0.0);
2737 edje_object_part_drag_size_set(sd->edje_obj, "elm.dragable.hbar", size, 1.0);
2741 size = (double)vh / (double)h;
2745 edje_object_part_drag_value_set(sd->edje_obj, "elm.dragable.vbar", 0.0, 0.0);
2747 edje_object_part_drag_size_set(sd->edje_obj, "elm.dragable.vbar", 1.0, size);
2749 edje_object_part_drag_value_get(sd->edje_obj, "elm.dragable.hbar", &vx, NULL);
2750 edje_object_part_drag_value_get(sd->edje_obj, "elm.dragable.vbar", NULL, &vy);
2751 sd->pan_func.max_get(sd->pan_obj, &mx, &my);
2752 sd->pan_func.min_get(sd->pan_obj, &minx, &miny);
2756 edje_object_part_drag_step_set(sd->edje_obj, "elm.dragable.hbar", (double)sd->step.x / (double)w, 0.0);
2757 edje_object_part_drag_step_set(sd->edje_obj, "elm.dragable.vbar", 0.0, (double)sd->step.y / (double)h);
2759 edje_object_part_drag_page_set(sd->edje_obj, "elm.dragable.hbar", (double)sd->page.x / (double)w, 0.0);
2761 edje_object_part_drag_page_set(sd->edje_obj, "elm.dragable.hbar", -((double)sd->page.x * ((double)vw / (double)w)) / 100.0, 0.0);
2763 edje_object_part_drag_page_set(sd->edje_obj, "elm.dragable.vbar", 0.0, (double)sd->page.y / (double)h);
2765 edje_object_part_drag_page_set(sd->edje_obj, "elm.dragable.vbar", 0.0, -((double)sd->page.y * ((double)vh / (double)h)) / 100.0);
2767 sd->pan_func.get(sd->pan_obj, &px, &py);
2768 if (vx != mx) x = px;
2769 if (vy != my) y = py;
2770 sd->pan_func.set(sd->pan_obj, x, y);
2771 // if ((px != 0) || (py != 0))
2772 // edje_object_signal_emit(sd->edje_obj, "elm,action,scroll", "elm");
2776 Evas_Coord px = 0, py = 0, minx = 0, miny = 0;
2778 edje_object_part_drag_size_set(sd->edje_obj, "elm.dragable.vbar", 1.0, 1.0);
2779 edje_object_part_drag_size_set(sd->edje_obj, "elm.dragable.hbar", 1.0, 1.0);
2780 sd->pan_func.min_get(sd->pan_obj, &minx, &miny);
2781 sd->pan_func.get(sd->pan_obj, &px, &py);
2782 sd->pan_func.set(sd->pan_obj, minx, miny);
2783 if ((px != minx) || (py != miny))
2784 edje_object_signal_emit(sd->edje_obj, "elm,action,scroll", "elm");
2786 _smart_scrollbar_bar_visibility_adjust(sd);
2790 _smart_reconfigure(Smart_Data *sd)
2792 evas_object_move(sd->edje_obj, sd->x, sd->y);
2793 evas_object_resize(sd->edje_obj, sd->w, sd->h);
2794 evas_object_move(sd->event_obj, sd->x, sd->y);
2795 evas_object_resize(sd->event_obj, sd->w, sd->h);
2796 _smart_scrollbar_size_adjust(sd);
2797 _smart_page_adjust(sd);
2801 _smart_add(Evas_Object *obj)
2806 sd = calloc(1, sizeof(Smart_Data));
2808 evas_object_smart_data_set(obj, sd);
2810 sd->smart_obj = obj;
2819 sd->hbar_flags = ELM_SMART_SCROLLER_POLICY_AUTO;
2820 sd->vbar_flags = ELM_SMART_SCROLLER_POLICY_AUTO;
2821 sd->hbar_visible = EINA_TRUE;
2822 sd->vbar_visible = EINA_TRUE;
2824 sd->bounce_horiz = EINA_TRUE;
2825 sd->bounce_vert = EINA_TRUE;
2827 sd->one_dir_at_a_time = EINA_TRUE;
2828 sd->momentum_animator_disabled = EINA_FALSE;
2829 sd->bounce_animator_disabled = EINA_FALSE;
2831 o = edje_object_add(evas_object_evas_get(obj));
2832 evas_object_propagate_events_set(o, 0);
2834 elm_smart_scroller_object_theme_set(NULL, obj, "scroller", "base", "default");
2835 edje_object_signal_callback_add(o, "drag", "elm.dragable.vbar", _smart_edje_drag_v, sd);
2836 edje_object_signal_callback_add(o, "drag,set", "elm.dragable.vbar", _smart_edje_drag_v, sd);
2837 edje_object_signal_callback_add(o, "drag,start", "elm.dragable.vbar", _smart_edje_drag_v_start, sd);
2838 edje_object_signal_callback_add(o, "drag,stop", "elm.dragable.vbar", _smart_edje_drag_v_stop, sd);
2839 edje_object_signal_callback_add(o, "drag,step", "elm.dragable.vbar", _smart_edje_drag_v, sd);
2840 edje_object_signal_callback_add(o, "drag,page", "elm.dragable.vbar", _smart_edje_drag_v, sd);
2841 edje_object_signal_callback_add(o, "drag", "elm.dragable.hbar", _smart_edje_drag_h, sd);
2842 edje_object_signal_callback_add(o, "drag,set", "elm.dragable.hbar", _smart_edje_drag_h, sd);
2843 edje_object_signal_callback_add(o, "drag,start", "elm.dragable.hbar", _smart_edje_drag_h_start, sd);
2844 edje_object_signal_callback_add(o, "drag,stop", "elm.dragable.hbar", _smart_edje_drag_h_stop, sd);
2845 edje_object_signal_callback_add(o, "drag,step", "elm.dragable.hbar", _smart_edje_drag_h, sd);
2846 edje_object_signal_callback_add(o, "drag,page", "elm.dragable.hbar", _smart_edje_drag_h, sd);
2847 evas_object_smart_member_add(o, obj);
2849 o = evas_object_rectangle_add(evas_object_evas_get(obj));
2851 evas_object_color_set(o, 0, 0, 0, 0);
2852 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL, _smart_event_wheel, sd);
2853 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _smart_event_mouse_down, sd);
2854 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _smart_event_mouse_up, sd);
2855 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _smart_event_mouse_move, sd);
2856 evas_object_smart_member_add(o, obj);
2857 evas_object_repeat_events_set(o, 1);
2859 sd->pan_func.set = _elm_smart_pan_set;
2860 sd->pan_func.get = _elm_smart_pan_get;
2861 sd->pan_func.max_get = _elm_smart_pan_max_get;
2862 sd->pan_func.min_get = _elm_smart_pan_min_get;
2863 sd->pan_func.child_size_get = _elm_smart_pan_child_size_get;
2865 _smart_scrollbar_reset(sd);
2869 _smart_del(Evas_Object *obj)
2872 elm_smart_scroller_child_set(obj, NULL);
2873 if (!sd->extern_pan) evas_object_del(sd->pan_obj);
2874 evas_object_del(sd->edje_obj);
2875 evas_object_del(sd->event_obj);
2876 if (sd->down.hold_animator) ecore_animator_del(sd->down.hold_animator);
2877 if (sd->down.onhold_animator) ecore_animator_del(sd->down.onhold_animator);
2878 if (sd->down.momentum_animator) ecore_animator_del(sd->down.momentum_animator);
2879 if (sd->down.bounce_x_animator) ecore_animator_del(sd->down.bounce_x_animator);
2880 if (sd->down.bounce_y_animator) ecore_animator_del(sd->down.bounce_y_animator);
2881 if (sd->scrollto.x.animator) ecore_animator_del(sd->scrollto.x.animator);
2882 if (sd->scrollto.y.animator) ecore_animator_del(sd->scrollto.y.animator);
2884 evas_object_smart_data_set(obj, NULL);
2888 _smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
2893 _smart_reconfigure(sd);
2897 _smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
2902 _smart_reconfigure(sd);
2903 _elm_smart_scroller_wanted_region_set(obj);
2907 _smart_show(Evas_Object *obj)
2910 evas_object_show(sd->edje_obj);
2911 evas_object_show(sd->event_obj);
2915 _smart_hide(Evas_Object *obj)
2918 evas_object_hide(sd->edje_obj);
2919 evas_object_hide(sd->event_obj);
2923 _smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
2926 evas_object_color_set(sd->edje_obj, r, g, b, a);
2930 _smart_clip_set(Evas_Object *obj, Evas_Object *clip)
2933 evas_object_clip_set(sd->edje_obj, clip);
2934 evas_object_clip_set(sd->event_obj, clip);
2938 _smart_clip_unset(Evas_Object *obj)
2941 evas_object_clip_unset(sd->edje_obj);
2942 evas_object_clip_unset(sd->event_obj);
2945 /* never need to touch this */
2952 static const Evas_Smart_Class sc =
2955 EVAS_SMART_CLASS_VERSION,
2973 _smart = evas_smart_class_new(&sc);