1 #include <Elementary.h>
5 * @defgroup Scroller Scroller
8 * A scroller holds a single object and "scrolls it around". This means that
9 * it allows the user to use a scrollbar (or a finger) to drag the viewable
10 * region around, allowing to move through a much larger object that is
11 * contained in the scroller. The scroiller will always have a small minimum
12 * size by default as it won't be limited by the contents of the scroller.
14 * Signals that you can add callbacks for are:
16 * edge,left - the left edge of the content has been reached
18 * edge,right - the right edge of the content has been reached
20 * edge,top - the top edge of the content has been reached
22 * edge,bottom - the bottom edge of the content has been reached
24 * scroll - the content has been scrolled (moved)
26 * scroll,anim,start - scrolling animation has started
28 * scroll,anim,stop - scrolling animation has stopped
30 * scroll,drag,start - dragging the contents around has started
32 * scroll,drag,stop - dragging the contents around has stopped
34 typedef struct _Widget_Data Widget_Data;
38 Evas_Coord wx, wy, ww, wh; /* Last "wanted" geometry */
41 const char *widget_name, *widget_base;
44 double pagerel_h, pagerel_v;
45 Evas_Coord pagesize_h, pagesize_v;
48 static const char *widtype = NULL;
49 static void _del_hook(Evas_Object *obj);
50 static void _theme_hook(Evas_Object *obj);
51 static void _show_region_hook(void *data, Evas_Object *obj);
52 static void _sizing_eval(Evas_Object *obj);
53 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
54 static void _on_focus_hook(void *data, Evas_Object *obj);
55 static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
56 Evas_Callback_Type type, void *event_info);
59 static const char SIG_SCROLL[] = "scroll";
60 static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
61 static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
62 static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
63 static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
64 static const char SIG_EDGE_LEFT[] = "edge,left";
65 static const char SIG_EDGE_RIGHT[] = "edge,right";
66 static const char SIG_EDGE_TOP[] = "edge,top";
67 static const char SIG_EDGE_BOTTOM[] = "edge,bottom";
68 static const Evas_Smart_Cb_Description _signals[] = {
70 {SIG_SCROLL_ANIM_START, ""},
71 {SIG_SCROLL_ANIM_STOP, ""},
72 {SIG_SCROLL_DRAG_START, ""},
73 {SIG_SCROLL_DRAG_STOP, ""},
77 {SIG_EDGE_BOTTOM, ""},
82 _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
84 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
85 Evas_Event_Key_Down *ev = event_info;
86 Widget_Data *wd = elm_widget_data_get(obj);
87 if (!wd) return EINA_FALSE;
88 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
89 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
93 Evas_Coord step_x = 0;
94 Evas_Coord step_y = 0;
99 Evas_Coord page_x = 0;
100 Evas_Coord page_y = 0;
102 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
103 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
104 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
105 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
106 elm_scroller_child_size_get(obj, &max_x, &max_y);
108 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
112 else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")))
116 else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
120 else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
124 else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
128 else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
132 else if ((!strcmp(ev->keyname, "Prior")) || (!strcmp(ev->keyname, "KP_Prior")))
135 y -= -(page_y * v_h) / 100;
139 else if ((!strcmp(ev->keyname, "Next")) || (!strcmp(ev->keyname, "KP_Next")))
142 y += -(page_y * v_h) / 100;
146 else return EINA_FALSE;
148 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
149 elm_smart_scroller_child_pos_set(wd->scr, x, y);
154 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
156 Widget_Data *wd = elm_widget_data_get(obj);
158 if (elm_widget_focus_get(obj))
160 edje_object_signal_emit(wd->scr, "elm,action,focus", "elm");
161 evas_object_focus_set(wd->scr, EINA_TRUE);
165 edje_object_signal_emit(wd->scr, "elm,action,unfocus", "elm");
166 evas_object_focus_set(wd->scr, EINA_FALSE);
171 _del_hook(Evas_Object *obj)
173 Widget_Data *wd = elm_widget_data_get(obj);
179 _theme_hook(Evas_Object *obj)
181 Widget_Data *wd = elm_widget_data_get(obj);
188 elm_smart_scroller_object_theme_set(obj, wd->scr,
189 wd->widget_name, wd->widget_base,
190 elm_widget_style_get(obj));
191 // edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
192 edj = elm_smart_scroller_edje_object_get(wd->scr);
193 str = edje_object_data_get(edj, "focus_highlight");
194 if ((str) && (!strcmp(str, "on")))
195 elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
197 elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
203 _elm_scroller_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
205 Widget_Data *wd = elm_widget_data_get(obj);
208 if ((!wd) || (!wd->content))
213 /* Try Focus cycle in subitem */
214 if ((elm_widget_can_focus_get(cur)) || (elm_widget_child_can_focus_get(cur)))
215 return elm_widget_focus_next_get(cur, dir, next);
218 *next = (Evas_Object *)obj;
219 return !elm_widget_focus_get(obj);
223 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
225 Widget_Data *wd = elm_widget_data_get(obj);
227 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
232 _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, void (*func_cb) (void *data, Evas_Object *o, const char *emission, const char *source), void *data)
234 Widget_Data *wd = elm_widget_data_get(obj);
236 edje_object_signal_callback_add(elm_smart_scroller_edje_object_get(wd->scr),
237 emission, source, func_cb, data);
241 _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, void (*func_cb) (void *data, Evas_Object *o, const char *emission, const char *source), void *data)
243 Widget_Data *wd = elm_widget_data_get(obj);
244 edje_object_signal_callback_del_full(
245 elm_smart_scroller_edje_object_get(wd->scr), emission, source,
250 _show_region_hook(void *data, Evas_Object *obj)
252 Evas_Coord x, y, w, h;
253 elm_widget_show_region_get(obj, &x, &y, &w, &h);
254 elm_scroller_region_show(data, x, y, w, h);
258 _focus_region_hook(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
260 elm_scroller_region_show(obj, x, y, w, h);
264 _sizing_eval(Evas_Object *obj)
266 Widget_Data *wd = elm_widget_data_get(obj);
267 Evas_Coord vw, vh, minw, minh, maxw, maxh, w, h, vmw, vmh;
271 evas_object_size_hint_min_get(wd->content, &minw, &minh);
272 evas_object_size_hint_max_get(wd->content, &maxw, &maxh);
273 evas_object_size_hint_weight_get(wd->content, &xw, &yw);
276 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
279 if ((minw > 0) && (vw < minw)) vw = minw;
280 else if ((maxw > 0) && (vw > maxw)) vw = maxw;
282 else if (minw > 0) vw = minw;
285 if ((minh > 0) && (vh < minh)) vh = minh;
286 else if ((maxh > 0) && (vh > maxh)) vh = maxh;
288 else if (minh > 0) vh = minh;
289 evas_object_resize(wd->content, vw, vh);
292 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
293 if (wd->min_w) w = vmw + minw;
294 if (wd->min_h) h = vmh + minh;
295 evas_object_size_hint_max_get(obj, &maxw, &maxh);
296 if ((maxw > 0) && (w > maxw)) w = maxw;
297 if ((maxh > 0) && (h > maxh)) h = maxh;
298 evas_object_size_hint_min_set(obj, w, h);
299 elm_smart_scroller_child_region_show(wd->scr, wd->wx, wd->wy, wd->ww, wd->wh);
304 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
310 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
312 Widget_Data *wd = elm_widget_data_get(obj);
313 Evas_Object *sub = event_info;
316 if (sub == wd->content)
318 elm_widget_on_show_region_hook_set(wd->content, NULL, NULL);
319 evas_object_event_callback_del_full (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
320 _changed_size_hints, obj);
324 else if (sub == wd->scr)
329 _hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
331 Widget_Data *wd = elm_widget_data_get(obj);
335 elm_smart_scroller_hold_set(wd->scr, 1);
339 _hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
341 Widget_Data *wd = elm_widget_data_get(obj);
345 elm_smart_scroller_hold_set(wd->scr, 0);
349 _freeze_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
351 Widget_Data *wd = elm_widget_data_get(obj);
355 elm_smart_scroller_freeze_set(wd->scr, 1);
359 _freeze_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
361 Widget_Data *wd = elm_widget_data_get(obj);
365 elm_smart_scroller_freeze_set(wd->scr, 0);
369 _resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
375 _edge_left(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
377 evas_object_smart_callback_call(data, SIG_EDGE_LEFT, NULL);
381 _edge_right(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
383 evas_object_smart_callback_call(data, SIG_EDGE_RIGHT, NULL);
387 _edge_top(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
389 evas_object_smart_callback_call(data, SIG_EDGE_TOP, NULL);
393 _edge_bottom(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
395 evas_object_smart_callback_call(data, SIG_EDGE_BOTTOM, NULL);
399 _scroll(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
401 evas_object_smart_callback_call(data, SIG_SCROLL, NULL);
405 _scroll_anim_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
407 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL);
411 _scroll_anim_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
413 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
417 _scroll_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
419 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
423 _scroll_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
425 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
429 * Add a new scroller to the parent
431 * @param parent The parent object
432 * @return The new object or NULL if it cannot be created
437 elm_scroller_add(Evas_Object *parent)
442 Evas_Coord minw, minh;
444 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
446 wd = ELM_NEW(Widget_Data);
447 e = evas_object_evas_get(parent);
449 obj = elm_widget_add(e);
450 ELM_SET_WIDTYPE(widtype, "scroller");
451 elm_widget_type_set(obj, "scroller");
452 elm_widget_sub_object_add(parent, obj);
453 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
454 elm_widget_data_set(obj, wd);
455 elm_widget_del_hook_set(obj, _del_hook);
456 elm_widget_theme_hook_set(obj, _theme_hook);
457 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
458 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
459 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
460 elm_widget_focus_next_hook_set(obj, _elm_scroller_focus_next_hook);
461 elm_widget_can_focus_set(obj, EINA_TRUE);
462 elm_widget_event_hook_set(obj, _event_hook);
463 elm_widget_focus_region_hook_set(obj, _focus_region_hook);
465 wd->widget_name = eina_stringshare_add("scroller");
466 wd->widget_base = eina_stringshare_add("base");
468 wd->scr = elm_smart_scroller_add(e);
469 elm_smart_scroller_widget_set(wd->scr, obj);
471 elm_widget_resize_object_set(obj, wd->scr);
472 evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
473 _changed_size_hints, obj);
475 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &minw, &minh);
476 evas_object_size_hint_min_set(obj, minw, minh);
477 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
479 evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
480 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
481 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
482 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
483 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
485 evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj);
486 evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj);
487 evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj);
488 evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom, obj);
489 evas_object_smart_callback_add(wd->scr, "scroll", _scroll, obj);
490 evas_object_smart_callback_add(wd->scr, "animate,start", _scroll_anim_start, obj);
491 evas_object_smart_callback_add(wd->scr, "animate,stop", _scroll_anim_stop, obj);
492 evas_object_smart_callback_add(wd->scr, "drag,start", _scroll_drag_start, obj);
493 evas_object_smart_callback_add(wd->scr, "drag,stop", _scroll_drag_stop, obj);
497 // TODO: convert Elementary to subclassing of Evas_Smart_Class
498 // TODO: and save some bytes, making descriptions per-class and not instance!
499 evas_object_smart_callbacks_descriptions_set(obj, _signals);
504 _elm_scroller_edje_object_get(Evas_Object *obj)
506 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
507 Widget_Data *wd = elm_widget_data_get(obj);
508 if (!wd) return NULL;
509 return elm_smart_scroller_edje_object_get(wd->scr);
513 * Set the content of the scroller widget (the object to be scrolled around).
515 * Once the content object is set, a previously set one will be deleted.
516 * If you want to keep that old content object, use the
517 * elm_scroller_content_unset() function.
519 * @param obj The scroller object
520 * @param content The new content object
525 elm_scroller_content_set(Evas_Object *obj, Evas_Object *content)
527 ELM_CHECK_WIDTYPE(obj, widtype);
528 Widget_Data *wd = elm_widget_data_get(obj);
530 if (wd->content == content) return;
531 if (wd->content) evas_object_del(wd->content);
532 wd->wx = wd->wh = wd->ww = wd->wy = 0;
534 wd->content = content;
537 elm_widget_on_show_region_hook_set(content, _show_region_hook, obj);
538 elm_widget_sub_object_add(obj, content);
540 elm_smart_scroller_child_set(wd->scr, content);
541 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
542 _changed_size_hints, obj);
548 * Get the content of the scroller widget
550 * Return the content object which is set for this widget
552 * @param obj The slider object
553 * @return The content that is being used
558 elm_scroller_content_get(const Evas_Object *obj)
560 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
561 Widget_Data *wd = elm_widget_data_get(obj);
562 if (!wd) return NULL;
567 * Unset the content of the scroller widget
569 * Unparent and return the content object which was set for this widget
571 * @param obj The slider object
572 * @return The content that was being used
577 elm_scroller_content_unset(Evas_Object *obj)
579 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
580 Widget_Data *wd = elm_widget_data_get(obj);
581 Evas_Object *content;
582 if (!wd) return NULL;
583 if (!wd->content) return NULL;
584 content = wd->content;
585 elm_widget_sub_object_del(obj, wd->content);
586 edje_object_part_unswallow(wd->scr, wd->content);
592 * Set custom theme elements for the scroller
594 * @param obj The scroller object
595 * @param widget The widget name to use (default is "scroller")
596 * @param base The base name to use (default is "base")
601 elm_scroller_custom_widget_base_theme_set(Evas_Object *obj, const char *widget, const char *base)
603 ELM_CHECK_WIDTYPE(obj, widtype);
604 Widget_Data *wd = elm_widget_data_get(obj);
606 EINA_SAFETY_ON_NULL_RETURN(widget);
607 EINA_SAFETY_ON_NULL_RETURN(base);
608 if (eina_stringshare_replace(&wd->widget_name, widget) |
609 eina_stringshare_replace(&wd->widget_base, base))
614 * Make the scroller minimum size limited to the minimum size of the content
616 * By default the scroller will be as small as its design allows, irrespective
617 * of its content. This will make the scroller minimum size the right size
618 * horizontally and/or vertically to perfectly fit its content.
620 * @param obj The scroller object
621 * @param w Enable limiting minimum size horizontally
622 * @param h Enable limiting minimum size vertically
627 elm_scroller_content_min_limit(Evas_Object *obj, Eina_Bool w, Eina_Bool h)
629 ELM_CHECK_WIDTYPE(obj, widtype);
630 Widget_Data *wd = elm_widget_data_get(obj);
638 * Show a specific virtual region within the scroller content object
640 * This will ensure all (or part if it does not fit) of the designated
641 * region in the virtual content object (0, 0 starting at the top-left of the
642 * virtual content object) is shown within the scroller.
644 * @param obj The scroller object
645 * @param x X coordinate of the region
646 * @param y Y coordinate of the region
647 * @param w Width of the region
648 * @param h Height of the region
653 elm_scroller_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
655 ELM_CHECK_WIDTYPE(obj, widtype);
656 Widget_Data *wd = elm_widget_data_get(obj);
657 if ((!wd) || (!wd->scr)) return;
663 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
667 * Set the scroller scrollbar policy
669 * This sets the scrollbar visibility policy for the given scroller.
670 * ELM_SMART_SCROLLER_POLICY_AUTO means the scrollber is made visible if it
671 * is needed, and otherwise kept hidden. ELM_SMART_SCROLLER_POLICY_ON turns
672 * it on all the time, and ELM_SMART_SCROLLER_POLICY_OFF always keeps it off.
673 * This applies respectively for the horizontal and vertical scrollbars.
675 * @param obj The scroller object
676 * @param policy_h Horizontal scrollbar policy
677 * @param policy_v Vertical scrollbar policy
682 elm_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v)
684 ELM_CHECK_WIDTYPE(obj, widtype);
685 Widget_Data *wd = elm_widget_data_get(obj);
686 const Elm_Scroller_Policy map[3] =
688 ELM_SMART_SCROLLER_POLICY_AUTO,
689 ELM_SMART_SCROLLER_POLICY_ON,
690 ELM_SMART_SCROLLER_POLICY_OFF
692 if ((!wd) || (!wd->scr)) return;
693 if ((policy_h >= 3) || (policy_v >= 3)) return;
694 elm_smart_scroller_policy_set(wd->scr, map[policy_h], map[policy_v]);
698 elm_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v)
700 ELM_CHECK_WIDTYPE(obj, widtype);
701 Widget_Data *wd = elm_widget_data_get(obj);
702 if ((!wd) || (!wd->scr)) return;
703 elm_smart_scroller_policy_get(wd->scr,
704 (Elm_Smart_Scroller_Policy *) policy_h,
705 (Elm_Smart_Scroller_Policy *) policy_v);
709 * Get the currently visible content region
711 * This gets the current region in the content object that is visible through
712 * the scroller. Also see elm_scroller_region_show(). The region co-ordinates
713 * are returned in the @p x, @p y, @p w, @p h values pointed to.
715 * @param obj The scroller object
716 * @param x X coordinate of the region
717 * @param y Y coordinate of the region
718 * @param w Width of the region
719 * @param h Height of the region
724 elm_scroller_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
726 ELM_CHECK_WIDTYPE(obj, widtype);
727 Widget_Data *wd = elm_widget_data_get(obj);
728 if ((!wd) || (!wd->scr)) return;
729 if ((x) || (y)) elm_smart_scroller_child_pos_get(wd->scr, x, y);
730 if ((w) || (h)) elm_smart_scroller_child_viewport_size_get(wd->scr, w, h);
734 * Get the size of the content child object
736 * This gets the size of the child object of the scroller. Actually the
737 * content of a scroller doesn't specifically need to be an actual object
738 * as it can be virtual and defined purely by callbacks.
740 * @param obj The scroller object
741 * @param w Width return
742 * @param h Height return
747 elm_scroller_child_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
749 ELM_CHECK_WIDTYPE(obj, widtype);
750 Widget_Data *wd = elm_widget_data_get(obj);
752 evas_object_geometry_get(wd->content, NULL, NULL, w, h);
756 * Set bouncing behavior
758 * When scrolling, the scroller may "bounce" when reaching an edge of the child
759 * object. This is a visual way to indicate the end has been reached. This is
760 * enabled by default for both axes. This will set if it is enabled for that
761 * axis with the boolean parameters for each axis.
763 * @param obj The scroller object
764 * @param h_bounce Will the scroller bounce horizontally or not
765 * @param v_bounce Will the scroller bounce vertically or not
770 elm_scroller_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
772 ELM_CHECK_WIDTYPE(obj, widtype);
773 Widget_Data *wd = elm_widget_data_get(obj);
774 if ((!wd) || (!wd->scr)) return;
775 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
779 * Get the bounce mode
781 * @param obj The Scroller object
782 * @param h_bounce Allow bounce horizontally
783 * @param v_bounce Allow bounce vertically
788 elm_scroller_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
790 ELM_CHECK_WIDTYPE(obj, widtype);
791 Widget_Data *wd = elm_widget_data_get(obj);
793 elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);
797 * Set scroll page size relative to viewport size.
799 * The scroller is capable of limiting scrolling by the user to "pages". That
800 * is to jump by and only show a "whole page" at a time as if the continuous
801 * area of the scroller content is split into page sized pieces. This sets
802 * the size of a page relative to the viewport of the scroller. 1.0 is "1
803 * viewport" is size (horizontally or vertically). 0.0 turns it off in that
804 * axis. This is mutually exclusive with page size
805 * (see elm_scroller_page_size_set() for more information). Likewise 0.5
806 * is "half a viewport". Sane usable valus are normally between 0.0 and 1.0
807 * including 1.0. If you only want 1 axis to be page "limited", use 0.0 for
810 * @param obj The scroller object
811 * @param h_pagerel The horizontal page relative size
812 * @param v_pagerel The vertical page relative size
817 elm_scroller_page_relative_set(Evas_Object *obj, double h_pagerel, double v_pagerel)
819 ELM_CHECK_WIDTYPE(obj, widtype);
820 Widget_Data *wd = elm_widget_data_get(obj);
822 wd->pagerel_h = h_pagerel;
823 wd->pagerel_v = v_pagerel;
825 elm_smart_scroller_paging_set(wd->scr, wd->pagerel_h, wd->pagerel_v,
826 wd->pagesize_h, wd->pagesize_v);
830 * Set scroll page size.
832 * See also elm_scroller_page_relative_set(). This, instead of a page size
833 * being relative to the viewport, sets it to an absolute fixed value, with
834 * 0 turning it off for that axis.
836 * @param obj The scroller object
837 * @param h_pagesize The horizontal page size
838 * @param v_pagesize The vertical page size
843 elm_scroller_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize)
845 ELM_CHECK_WIDTYPE(obj, widtype);
846 Widget_Data *wd = elm_widget_data_get(obj);
848 wd->pagesize_h = h_pagesize;
849 wd->pagesize_v = v_pagesize;
851 elm_smart_scroller_paging_set(wd->scr, wd->pagerel_h, wd->pagerel_v,
852 wd->pagesize_h, wd->pagesize_v);
856 * Show a specific virtual region within the scroller content object.
858 * This will ensure all (or part if it does not fit) of the designated
859 * region in the virtual content object (0, 0 starting at the top-left of the
860 * virtual content object) is shown within the scroller. Unlike
861 * elm_scroller_region_show(), this allow the scroller to "smoothly slide"
862 * to this location (if configuration in general calls for transitions). It
863 * may not jump immediately to the new location and make take a while and
864 * show other content along the way.
866 * @param obj The scroller object
867 * @param x X coordinate of the region
868 * @param y Y coordinate of the region
869 * @param w Width of the region
870 * @param h Height of the region
875 elm_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
877 ELM_CHECK_WIDTYPE(obj, widtype);
878 Widget_Data *wd = elm_widget_data_get(obj);
879 if ((!wd) || (!wd->scr)) return;
884 elm_smart_scroller_region_bring_in(wd->scr, x, y, w, h);
889 * Set event propagation on a scroller
891 * This enables or disabled event propagation from the scroller content to
892 * the scroller and its parent. By default event propagation is disabled.
894 * @param obj The scroller object
895 * @param propagation If propagation is enabled or not
900 elm_scroller_propagate_events_set(Evas_Object *obj, Eina_Bool propagation)
902 ELM_CHECK_WIDTYPE(obj, widtype);
903 Widget_Data *wd = elm_widget_data_get(obj);
906 elm_smart_scroller_propagate_events_set(wd->scr, propagation);
910 * Get event propagation for a scroller
912 * This gets the event propagation for a scroller. See
913 * elm_scroller_propagate_events_set() for more information
915 * @param obj The scroller object
916 * @return The propagation state
921 elm_scroller_propagate_events_get(const Evas_Object *obj)
923 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
924 Widget_Data *wd = elm_widget_data_get(obj);
925 if (!wd) return EINA_FALSE;
927 return elm_smart_scroller_propagate_events_get(wd->scr);
933 elm_scroller_page_move_set(Evas_Object *obj, Eina_Bool set)