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
17 * "edge,right" - the right edge of the content has been reached
18 * "edge,top" - the top edge of the content has been reached
19 * "edge,bottom" - the bottom edge of the content has been reached
20 * "scroll" - the content has been scrolled (moved)
21 * "scroll,anim,start" - scrolling animation has started
22 * "scroll,anim,stop" - scrolling animation has stopped
23 * "scroll,drag,start" - dragging the contents around has started
24 * "scroll,drag,stop" - dragging the contents around has stopped
26 typedef struct _Widget_Data Widget_Data;
32 const char *widget_name, *widget_base;
35 double pagerel_h, pagerel_v;
36 Evas_Coord pagesize_h, pagesize_v;
39 static const char *widtype = NULL;
40 static void _del_hook(Evas_Object *obj);
41 static void _theme_hook(Evas_Object *obj);
42 static void _show_region_hook(void *data, Evas_Object *obj);
43 static void _sizing_eval(Evas_Object *obj);
44 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
45 static void _on_focus_hook(void *data, Evas_Object *obj);
46 static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
47 Evas_Callback_Type type, void *event_info);
50 static const char SIG_SCROLL[] = "scroll";
51 static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
52 static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
53 static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
54 static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
55 static const char SIG_EDGE_LEFT[] = "edge,left";
56 static const char SIG_EDGE_RIGHT[] = "edge,right";
57 static const char SIG_EDGE_TOP[] = "edge,top";
58 static const char SIG_EDGE_BOTTOM[] = "edge,bottom";
59 static const Evas_Smart_Cb_Description _signals[] = {
61 {SIG_SCROLL_ANIM_START, ""},
62 {SIG_SCROLL_ANIM_STOP, ""},
63 {SIG_SCROLL_DRAG_START, ""},
64 {SIG_SCROLL_DRAG_STOP, ""},
68 {SIG_EDGE_BOTTOM, ""},
73 _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
75 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
76 Evas_Event_Key_Down *ev = event_info;
77 Widget_Data *wd = elm_widget_data_get(obj);
78 if (!wd) return EINA_FALSE;
79 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
80 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
84 Evas_Coord step_x = 0;
85 Evas_Coord step_y = 0;
90 Evas_Coord page_x = 0;
91 Evas_Coord page_y = 0;
93 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
94 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
95 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
96 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
97 elm_scroller_child_size_get(obj, &max_x, &max_y);
99 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
103 else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")))
107 else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
111 else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
115 else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
119 else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
123 else if ((!strcmp(ev->keyname, "Prior")) || (!strcmp(ev->keyname, "KP_Prior")))
126 y -= -(page_y * v_h) / 100;
130 else if ((!strcmp(ev->keyname, "Next")) || (!strcmp(ev->keyname, "KP_Next")))
133 y += -(page_y * v_h) / 100;
137 else return EINA_FALSE;
139 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
140 elm_smart_scroller_child_pos_set(wd->scr, x, y);
145 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
147 Widget_Data *wd = elm_widget_data_get(obj);
149 if (elm_widget_focus_get(obj))
151 edje_object_signal_emit(wd->scr, "elm,action,focus", "elm");
152 evas_object_focus_set(wd->scr, EINA_TRUE);
156 edje_object_signal_emit(wd->scr, "elm,action,unfocus", "elm");
157 evas_object_focus_set(wd->scr, EINA_FALSE);
162 _del_hook(Evas_Object *obj)
164 Widget_Data *wd = elm_widget_data_get(obj);
170 _mirrored_set(Evas_Object *obj, Eina_Bool mirrored)
172 Widget_Data *wd = elm_widget_data_get(obj);
175 elm_smart_scroller_mirrored_set(wd->scr, mirrored);
179 _theme_hook(Evas_Object *obj)
181 Widget_Data *wd = elm_widget_data_get(obj);
183 _elm_widget_mirrored_reload(obj);
189 _mirrored_set(obj, elm_widget_mirrored_get(obj));
190 elm_smart_scroller_object_theme_set(obj, wd->scr,
191 wd->widget_name, wd->widget_base,
192 elm_widget_style_get(obj));
193 // edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
194 edj = elm_smart_scroller_edje_object_get(wd->scr);
195 str = edje_object_data_get(edj, "focus_highlight");
196 if ((str) && (!strcmp(str, "on")))
197 elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
199 elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
205 _elm_scroller_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
207 Widget_Data *wd = elm_widget_data_get(obj);
210 if ((!wd) || (!wd->content))
215 /* Try Focus cycle in subitem */
216 if ((elm_widget_can_focus_get(cur)) || (elm_widget_child_can_focus_get(cur)))
217 return elm_widget_focus_next_get(cur, dir, next);
220 *next = (Evas_Object *)obj;
221 return !elm_widget_focus_get(obj);
225 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
227 Widget_Data *wd = elm_widget_data_get(obj);
229 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
234 _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
236 Widget_Data *wd = elm_widget_data_get(obj);
238 edje_object_signal_callback_add(elm_smart_scroller_edje_object_get(wd->scr),
239 emission, source, func_cb, data);
243 _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
245 Widget_Data *wd = elm_widget_data_get(obj);
246 edje_object_signal_callback_del_full(
247 elm_smart_scroller_edje_object_get(wd->scr), emission, source,
252 _show_region_hook(void *data, Evas_Object *obj)
254 Widget_Data *wd = elm_widget_data_get(data);
255 Evas_Coord x, y, w, h;
257 elm_widget_show_region_get(obj, &x, &y, &w, &h);
259 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
263 _focus_region_hook(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
265 Widget_Data *wd = elm_widget_data_get(obj);
267 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
271 _sizing_eval(Evas_Object *obj)
273 Widget_Data *wd = elm_widget_data_get(obj);
274 Evas_Coord vw, vh, minw = 0, minh = 0, maxw = 0, maxh = 0, w, h, vmw, vmh;
275 double xw = 0.0, yw = 0.0;
280 evas_object_size_hint_min_get(wd->content, &minw, &minh);
281 evas_object_size_hint_max_get(wd->content, &maxw, &maxh);
282 evas_object_size_hint_weight_get(wd->content, &xw, &yw);
286 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
289 if ((minw > 0) && (vw < minw)) vw = minw;
290 else if ((maxw > 0) && (vw > maxw)) vw = maxw;
292 else if (minw > 0) vw = minw;
295 if ((minh > 0) && (vh < minh)) vh = minh;
296 else if ((maxh > 0) && (vh > maxh)) vh = maxh;
298 else if (minh > 0) vh = minh;
299 if (wd->content) evas_object_resize(wd->content, vw, vh);
302 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
303 if (wd->min_w) w = vmw + minw;
304 if (wd->min_h) h = vmh + minh;
305 evas_object_size_hint_max_get(obj, &maxw, &maxh);
306 if ((maxw > 0) && (w > maxw)) w = maxw;
307 if ((maxh > 0) && (h > maxh)) h = maxh;
308 evas_object_size_hint_min_set(obj, w, h);
313 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
319 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
321 Widget_Data *wd = elm_widget_data_get(obj);
322 Evas_Object *sub = event_info;
325 if (sub == wd->content)
327 elm_widget_on_show_region_hook_set(wd->content, NULL, NULL);
328 evas_object_event_callback_del_full (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
329 _changed_size_hints, obj);
333 else if (sub == wd->scr)
338 _hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
340 Widget_Data *wd = elm_widget_data_get(obj);
344 elm_smart_scroller_hold_set(wd->scr, 1);
348 _hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
350 Widget_Data *wd = elm_widget_data_get(obj);
354 elm_smart_scroller_hold_set(wd->scr, 0);
358 _freeze_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
360 Widget_Data *wd = elm_widget_data_get(obj);
364 elm_smart_scroller_freeze_set(wd->scr, 1);
368 _freeze_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
370 Widget_Data *wd = elm_widget_data_get(obj);
374 elm_smart_scroller_freeze_set(wd->scr, 0);
378 _resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
384 _edge_left(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
386 evas_object_smart_callback_call(data, SIG_EDGE_LEFT, NULL);
390 _edge_right(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
392 evas_object_smart_callback_call(data, SIG_EDGE_RIGHT, NULL);
396 _edge_top(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
398 evas_object_smart_callback_call(data, SIG_EDGE_TOP, NULL);
402 _edge_bottom(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
404 evas_object_smart_callback_call(data, SIG_EDGE_BOTTOM, NULL);
408 _scroll(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
410 evas_object_smart_callback_call(data, SIG_SCROLL, NULL);
414 _scroll_anim_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
416 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL);
420 _scroll_anim_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
422 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
426 _scroll_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
428 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
432 _scroll_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
434 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
438 * Add a new scroller to the parent
440 * @param parent The parent object
441 * @return The new object or NULL if it cannot be created
446 elm_scroller_add(Evas_Object *parent)
451 Evas_Coord minw, minh;
453 ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
455 ELM_SET_WIDTYPE(widtype, "scroller");
456 elm_widget_type_set(obj, "scroller");
457 elm_widget_sub_object_add(parent, obj);
458 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
459 elm_widget_data_set(obj, wd);
460 elm_widget_del_hook_set(obj, _del_hook);
461 elm_widget_theme_hook_set(obj, _theme_hook);
462 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
463 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
464 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
465 elm_widget_focus_next_hook_set(obj, _elm_scroller_focus_next_hook);
466 elm_widget_can_focus_set(obj, EINA_TRUE);
467 elm_widget_event_hook_set(obj, _event_hook);
468 elm_widget_focus_region_hook_set(obj, _focus_region_hook);
470 wd->widget_name = eina_stringshare_add("scroller");
471 wd->widget_base = eina_stringshare_add("base");
473 wd->scr = elm_smart_scroller_add(e);
474 elm_smart_scroller_widget_set(wd->scr, obj);
476 elm_widget_resize_object_set(obj, wd->scr);
477 evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
478 _changed_size_hints, obj);
480 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &minw, &minh);
481 evas_object_size_hint_min_set(obj, minw, minh);
482 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
484 evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
485 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
486 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
487 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
488 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
490 evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj);
491 evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj);
492 evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj);
493 evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom, obj);
494 evas_object_smart_callback_add(wd->scr, "scroll", _scroll, obj);
495 evas_object_smart_callback_add(wd->scr, "animate,start", _scroll_anim_start, obj);
496 evas_object_smart_callback_add(wd->scr, "animate,stop", _scroll_anim_stop, obj);
497 evas_object_smart_callback_add(wd->scr, "drag,start", _scroll_drag_start, obj);
498 evas_object_smart_callback_add(wd->scr, "drag,stop", _scroll_drag_stop, obj);
502 // TODO: convert Elementary to subclassing of Evas_Smart_Class
503 // TODO: and save some bytes, making descriptions per-class and not instance!
504 evas_object_smart_callbacks_descriptions_set(obj, _signals);
505 _mirrored_set(obj, elm_widget_mirrored_get(obj));
510 _elm_scroller_edje_object_get(Evas_Object *obj)
512 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
513 Widget_Data *wd = elm_widget_data_get(obj);
514 if (!wd) return NULL;
515 return elm_smart_scroller_edje_object_get(wd->scr);
519 * Set the content of the scroller widget (the object to be scrolled around).
521 * Once the content object is set, a previously set one will be deleted.
522 * If you want to keep that old content object, use the
523 * elm_scroller_content_unset() function.
525 * @param obj The scroller object
526 * @param content The new content object
531 elm_scroller_content_set(Evas_Object *obj, Evas_Object *content)
533 ELM_CHECK_WIDTYPE(obj, widtype);
534 Widget_Data *wd = elm_widget_data_get(obj);
536 if (wd->content == content) return;
537 if (wd->content) evas_object_del(wd->content);
538 wd->content = content;
541 elm_widget_on_show_region_hook_set(content, _show_region_hook, obj);
542 elm_widget_sub_object_add(obj, content);
544 elm_smart_scroller_child_set(wd->scr, content);
545 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
546 _changed_size_hints, obj);
552 * Get the content of the scroller widget
554 * Return the content object which is set for this widget
556 * @param obj The slider object
557 * @return The content that is being used
562 elm_scroller_content_get(const Evas_Object *obj)
564 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
565 Widget_Data *wd = elm_widget_data_get(obj);
566 if (!wd) return NULL;
571 * Unset the content of the scroller widget
573 * Unparent and return the content object which was set for this widget
575 * @param obj The slider object
576 * @return The content that was being used
581 elm_scroller_content_unset(Evas_Object *obj)
583 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
584 Widget_Data *wd = elm_widget_data_get(obj);
585 Evas_Object *content;
586 if (!wd) return NULL;
587 if (!wd->content) return NULL;
588 content = wd->content;
589 elm_widget_sub_object_del(obj, wd->content);
590 edje_object_part_unswallow(wd->scr, wd->content);
596 * Set custom theme elements for the scroller
598 * @param obj The scroller object
599 * @param widget The widget name to use (default is "scroller")
600 * @param base The base name to use (default is "base")
605 elm_scroller_custom_widget_base_theme_set(Evas_Object *obj, const char *widget, const char *base)
607 ELM_CHECK_WIDTYPE(obj, widtype);
608 Widget_Data *wd = elm_widget_data_get(obj);
610 EINA_SAFETY_ON_NULL_RETURN(widget);
611 EINA_SAFETY_ON_NULL_RETURN(base);
612 if (eina_stringshare_replace(&wd->widget_name, widget) |
613 eina_stringshare_replace(&wd->widget_base, base))
618 * Make the scroller minimum size limited to the minimum size of the content
620 * By default the scroller will be as small as its design allows, irrespective
621 * of its content. This will make the scroller minimum size the right size
622 * horizontally and/or vertically to perfectly fit its content.
624 * @param obj The scroller object
625 * @param w Enable limiting minimum size horizontally
626 * @param h Enable limiting minimum size vertically
631 elm_scroller_content_min_limit(Evas_Object *obj, Eina_Bool w, Eina_Bool h)
633 ELM_CHECK_WIDTYPE(obj, widtype);
634 Widget_Data *wd = elm_widget_data_get(obj);
642 * Show a specific virtual region within the scroller content object
644 * This will ensure all (or part if it does not fit) of the designated
645 * region in the virtual content object (0, 0 starting at the top-left of the
646 * virtual content object) is shown within the scroller.
648 * @param obj The scroller object
649 * @param x X coordinate of the region
650 * @param y Y coordinate of the region
651 * @param w Width of the region
652 * @param h Height of the region
657 elm_scroller_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
659 ELM_CHECK_WIDTYPE(obj, widtype);
660 Widget_Data *wd = elm_widget_data_get(obj);
661 if ((!wd) || (!wd->scr)) return;
662 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
666 * Set the scroller scrollbar policy
668 * This sets the scrollbar visibility policy for the given scroller.
669 * ELM_SMART_SCROLLER_POLICY_AUTO means the scrollber is made visible if it
670 * is needed, and otherwise kept hidden. ELM_SMART_SCROLLER_POLICY_ON turns
671 * it on all the time, and ELM_SMART_SCROLLER_POLICY_OFF always keeps it off.
672 * This applies respectively for the horizontal and vertical scrollbars.
674 * @param obj The scroller object
675 * @param policy_h Horizontal scrollbar policy
676 * @param policy_v Vertical scrollbar policy
681 elm_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v)
683 ELM_CHECK_WIDTYPE(obj, widtype);
684 Widget_Data *wd = elm_widget_data_get(obj);
685 const Elm_Scroller_Policy map[3] =
687 ELM_SMART_SCROLLER_POLICY_AUTO,
688 ELM_SMART_SCROLLER_POLICY_ON,
689 ELM_SMART_SCROLLER_POLICY_OFF
691 if ((!wd) || (!wd->scr)) return;
692 if ((policy_h >= 3) || (policy_v >= 3)) return;
693 elm_smart_scroller_policy_set(wd->scr, map[policy_h], map[policy_v]);
697 elm_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v)
699 ELM_CHECK_WIDTYPE(obj, widtype);
700 Widget_Data *wd = elm_widget_data_get(obj);
701 if ((!wd) || (!wd->scr)) return;
702 elm_smart_scroller_policy_get(wd->scr,
703 (Elm_Smart_Scroller_Policy *) policy_h,
704 (Elm_Smart_Scroller_Policy *) policy_v);
708 * Get the currently visible content region
710 * This gets the current region in the content object that is visible through
711 * the scroller. Also see elm_scroller_region_show(). The region co-ordinates
712 * are returned in the @p x, @p y, @p w, @p h values pointed to.
714 * @param obj The scroller object
715 * @param x X coordinate of the region
716 * @param y Y coordinate of the region
717 * @param w Width of the region
718 * @param h Height of the region
723 elm_scroller_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
725 ELM_CHECK_WIDTYPE(obj, widtype);
726 Widget_Data *wd = elm_widget_data_get(obj);
727 if ((!wd) || (!wd->scr)) return;
728 if ((x) || (y)) elm_smart_scroller_child_pos_get(wd->scr, x, y);
729 if ((w) || (h)) elm_smart_scroller_child_viewport_size_get(wd->scr, w, h);
733 * Get the size of the content child object
735 * This gets the size of the child object of the scroller. Actually the
736 * content of a scroller doesn't specifically need to be an actual object
737 * as it can be virtual and defined purely by callbacks.
739 * @param obj The scroller object
740 * @param w Width return
741 * @param h Height return
746 elm_scroller_child_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
748 ELM_CHECK_WIDTYPE(obj, widtype);
749 Widget_Data *wd = elm_widget_data_get(obj);
751 evas_object_geometry_get(wd->content, NULL, NULL, w, h);
755 * Set bouncing behavior
757 * When scrolling, the scroller may "bounce" when reaching an edge of the child
758 * object. This is a visual way to indicate the end has been reached. This is
759 * enabled by default for both axes. This will set if it is enabled for that
760 * axis with the boolean parameters for each axis.
762 * @param obj The scroller object
763 * @param h_bounce Will the scroller bounce horizontally or not
764 * @param v_bounce Will the scroller bounce vertically or not
769 elm_scroller_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
771 ELM_CHECK_WIDTYPE(obj, widtype);
772 Widget_Data *wd = elm_widget_data_get(obj);
773 if ((!wd) || (!wd->scr)) return;
774 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
778 * Get the bounce mode
780 * @param obj The Scroller object
781 * @param h_bounce Allow bounce horizontally
782 * @param v_bounce Allow bounce vertically
787 elm_scroller_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
789 ELM_CHECK_WIDTYPE(obj, widtype);
790 Widget_Data *wd = elm_widget_data_get(obj);
792 elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);
796 * Set scroll page size relative to viewport size.
798 * The scroller is capable of limiting scrolling by the user to "pages". That
799 * is to jump by and only show a "whole page" at a time as if the continuous
800 * area of the scroller content is split into page sized pieces. This sets
801 * the size of a page relative to the viewport of the scroller. 1.0 is "1
802 * viewport" is size (horizontally or vertically). 0.0 turns it off in that
803 * axis. This is mutually exclusive with page size
804 * (see elm_scroller_page_size_set() for more information). Likewise 0.5
805 * is "half a viewport". Sane usable valus are normally between 0.0 and 1.0
806 * including 1.0. If you only want 1 axis to be page "limited", use 0.0 for
809 * @param obj The scroller object
810 * @param h_pagerel The horizontal page relative size
811 * @param v_pagerel The vertical page relative size
816 elm_scroller_page_relative_set(Evas_Object *obj, double h_pagerel, double v_pagerel)
818 ELM_CHECK_WIDTYPE(obj, widtype);
819 Widget_Data *wd = elm_widget_data_get(obj);
821 wd->pagerel_h = h_pagerel;
822 wd->pagerel_v = v_pagerel;
824 elm_smart_scroller_paging_set(wd->scr, wd->pagerel_h, wd->pagerel_v,
825 wd->pagesize_h, wd->pagesize_v);
829 * Set scroll page size.
831 * See also elm_scroller_page_relative_set(). This, instead of a page size
832 * being relative to the viewport, sets it to an absolute fixed value, with
833 * 0 turning it off for that axis.
835 * @param obj The scroller object
836 * @param h_pagesize The horizontal page size
837 * @param v_pagesize The vertical page size
842 elm_scroller_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize)
844 ELM_CHECK_WIDTYPE(obj, widtype);
845 Widget_Data *wd = elm_widget_data_get(obj);
847 wd->pagesize_h = h_pagesize;
848 wd->pagesize_v = v_pagesize;
850 elm_smart_scroller_paging_set(wd->scr, wd->pagerel_h, wd->pagerel_v,
851 wd->pagesize_h, wd->pagesize_v);
855 * Show a specific virtual region within the scroller content object.
857 * This will ensure all (or part if it does not fit) of the designated
858 * region in the virtual content object (0, 0 starting at the top-left of the
859 * virtual content object) is shown within the scroller. Unlike
860 * elm_scroller_region_show(), this allow the scroller to "smoothly slide"
861 * to this location (if configuration in general calls for transitions). It
862 * may not jump immediately to the new location and make take a while and
863 * show other content along the way.
865 * @param obj The scroller object
866 * @param x X coordinate of the region
867 * @param y Y coordinate of the region
868 * @param w Width of the region
869 * @param h Height of the region
874 elm_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
876 ELM_CHECK_WIDTYPE(obj, widtype);
877 Widget_Data *wd = elm_widget_data_get(obj);
878 if ((!wd) || (!wd->scr)) return;
879 elm_smart_scroller_region_bring_in(wd->scr, x, y, w, h);
884 * Set event propagation on a scroller
886 * This enables or disabled event propagation from the scroller content to
887 * the scroller and its parent. By default event propagation is disabled.
889 * @param obj The scroller object
890 * @param propagation If propagation is enabled or not
895 elm_scroller_propagate_events_set(Evas_Object *obj, Eina_Bool propagation)
897 ELM_CHECK_WIDTYPE(obj, widtype);
898 Widget_Data *wd = elm_widget_data_get(obj);
901 elm_smart_scroller_propagate_events_set(wd->scr, propagation);
905 * Get event propagation for a scroller
907 * This gets the event propagation for a scroller. See
908 * elm_scroller_propagate_events_set() for more information
910 * @param obj The scroller object
911 * @return The propagation state
916 elm_scroller_propagate_events_get(const Evas_Object *obj)
918 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
919 Widget_Data *wd = elm_widget_data_get(obj);
920 if (!wd) return EINA_FALSE;
922 return elm_smart_scroller_propagate_events_get(wd->scr);
926 elm_scroller_page_move_set(Evas_Object *obj, Eina_Bool set)