1 #include <Elementary.h>
5 * @defgroup Scroller Scroller
7 * A scroller holds a single object and "scrolls it around". This means that
8 * it allows the user to use a scrollbar (or a finger) to drag the viewable
9 * region around, allowing to move through a much larger object that is
10 * contained in the scroller. The scroiller will always have a small minimum
11 * size by default as it won't be limited by the contents of the scroller.
13 * Signals that you can add callbacks for are:
15 * edge,left - the left edge of the content has been reached
17 * edge,right - the right edge of the content has been reached
19 * edge,top - the top edge of the content has been reached
21 * edge,bottom - the bottom edge of the content has been reached
23 * scroll - the content has been scrolled (moved)
25 * scroll,anim,start - scrolling animation has started
27 * scroll,anim,stop - scrolling animation has stopped
29 * scroll,drag,start - dragging the contents around has started
31 * scroll,drag,stop - dragging the contents around has stopped
33 typedef struct _Widget_Data Widget_Data;
39 const char *widget_name, *widget_base;
42 double pagerel_h, pagerel_v;
43 Evas_Coord pagesize_h, pagesize_v;
46 static const char *widtype = NULL;
47 static void _del_hook(Evas_Object *obj);
48 static void _theme_hook(Evas_Object *obj);
49 static void _show_region_hook(void *data, Evas_Object *obj);
50 static void _sizing_eval(Evas_Object *obj);
51 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
52 static void _on_focus_hook(void *data, Evas_Object *obj);
53 static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
54 Evas_Callback_Type type, void *event_info);
57 static const char SIG_SCROLL[] = "scroll";
58 static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
59 static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
60 static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
61 static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
62 static const char SIG_EDGE_LEFT[] = "edge,left";
63 static const char SIG_EDGE_RIGHT[] = "edge,right";
64 static const char SIG_EDGE_TOP[] = "edge,top";
65 static const char SIG_EDGE_BOTTOM[] = "edge,bottom";
66 static const Evas_Smart_Cb_Description _signals[] = {
68 {SIG_SCROLL_ANIM_START, ""},
69 {SIG_SCROLL_ANIM_STOP, ""},
70 {SIG_SCROLL_DRAG_START, ""},
71 {SIG_SCROLL_DRAG_STOP, ""},
75 {SIG_EDGE_BOTTOM, ""},
80 _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
82 if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
83 Evas_Event_Key_Down *ev = event_info;
84 Widget_Data *wd = elm_widget_data_get(obj);
85 if (!wd) return EINA_FALSE;
86 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
87 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
91 Evas_Coord step_x = 0;
92 Evas_Coord step_y = 0;
97 Evas_Coord page_x = 0;
98 Evas_Coord page_y = 0;
100 elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
101 elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
102 elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
103 elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
104 elm_scroller_child_size_get(obj, &max_x, &max_y);
106 if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
110 else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")))
114 else if ((!strcmp(ev->keyname, "Up")) || (!strcmp(ev->keyname, "KP_Up")))
118 else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
122 else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
126 else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
130 else if ((!strcmp(ev->keyname, "Prior")) || (!strcmp(ev->keyname, "KP_Prior")))
133 y -= -(page_y * v_h) / 100;
137 else if ((!strcmp(ev->keyname, "Next")) || (!strcmp(ev->keyname, "KP_Next")))
140 y += -(page_y * v_h) / 100;
144 else return EINA_FALSE;
146 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
147 elm_smart_scroller_child_pos_set(wd->scr, x, y);
152 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
154 Widget_Data *wd = elm_widget_data_get(obj);
156 if (elm_widget_focus_get(obj))
158 edje_object_signal_emit(wd->scr, "elm,action,focus", "elm");
159 evas_object_focus_set(wd->scr, EINA_TRUE);
163 edje_object_signal_emit(wd->scr, "elm,action,unfocus", "elm");
164 evas_object_focus_set(wd->scr, EINA_FALSE);
169 _del_hook(Evas_Object *obj)
171 Widget_Data *wd = elm_widget_data_get(obj);
177 _mirrored_set(Evas_Object *obj, Eina_Bool mirrored)
179 Widget_Data *wd = elm_widget_data_get(obj);
182 elm_smart_scroller_mirrored_set(wd->scr, mirrored);
186 _theme_hook(Evas_Object *obj)
188 Widget_Data *wd = elm_widget_data_get(obj);
190 _elm_widget_mirrored_reload(obj);
196 _mirrored_set(obj, elm_widget_mirrored_get(obj));
197 elm_smart_scroller_object_theme_set(obj, wd->scr,
198 wd->widget_name, wd->widget_base,
199 elm_widget_style_get(obj));
200 // edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
201 edj = elm_smart_scroller_edje_object_get(wd->scr);
202 str = edje_object_data_get(edj, "focus_highlight");
203 if ((str) && (!strcmp(str, "on")))
204 elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
206 elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
212 _elm_scroller_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
214 Widget_Data *wd = elm_widget_data_get(obj);
217 if ((!wd) || (!wd->content))
222 /* Try Focus cycle in subitem */
223 if ((elm_widget_can_focus_get(cur)) || (elm_widget_child_can_focus_get(cur)))
224 return elm_widget_focus_next_get(cur, dir, next);
227 *next = (Evas_Object *)obj;
228 return !elm_widget_focus_get(obj);
232 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
234 Widget_Data *wd = elm_widget_data_get(obj);
236 edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
241 _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)
243 Widget_Data *wd = elm_widget_data_get(obj);
245 edje_object_signal_callback_add(elm_smart_scroller_edje_object_get(wd->scr),
246 emission, source, func_cb, data);
250 _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)
252 Widget_Data *wd = elm_widget_data_get(obj);
253 edje_object_signal_callback_del_full(
254 elm_smart_scroller_edje_object_get(wd->scr), emission, source,
259 _show_region_hook(void *data, Evas_Object *obj)
261 Widget_Data *wd = elm_widget_data_get(data);
262 Evas_Coord x, y, w, h;
264 elm_widget_show_region_get(obj, &x, &y, &w, &h);
266 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
270 _focus_region_hook(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
272 Widget_Data *wd = elm_widget_data_get(obj);
274 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
278 _sizing_eval(Evas_Object *obj)
280 Widget_Data *wd = elm_widget_data_get(obj);
281 Evas_Coord vw, vh, minw, minh, maxw, maxh, w, h, vmw, vmh;
287 evas_object_size_hint_min_get(wd->content, &minw, &minh);
288 evas_object_size_hint_max_get(wd->content, &maxw, &maxh);
289 evas_object_size_hint_weight_get(wd->content, &xw, &yw);
293 elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
296 if ((minw > 0) && (vw < minw)) vw = minw;
297 else if ((maxw > 0) && (vw > maxw)) vw = maxw;
299 else if (minw > 0) vw = minw;
302 if ((minh > 0) && (vh < minh)) vh = minh;
303 else if ((maxh > 0) && (vh > maxh)) vh = maxh;
305 else if (minh > 0) vh = minh;
306 if (wd->content) evas_object_resize(wd->content, vw, vh);
309 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
310 if (wd->min_w) w = vmw + minw;
311 if (wd->min_h) h = vmh + minh;
312 evas_object_size_hint_max_get(obj, &maxw, &maxh);
313 if ((maxw > 0) && (w > maxw)) w = maxw;
314 if ((maxh > 0) && (h > maxh)) h = maxh;
315 evas_object_size_hint_min_set(obj, w, h);
320 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
326 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
328 Widget_Data *wd = elm_widget_data_get(obj);
329 Evas_Object *sub = event_info;
332 if (sub == wd->content)
334 elm_widget_on_show_region_hook_set(wd->content, NULL, NULL);
335 evas_object_event_callback_del_full (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
336 _changed_size_hints, obj);
340 else if (sub == wd->scr)
345 _hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
347 Widget_Data *wd = elm_widget_data_get(obj);
351 elm_smart_scroller_hold_set(wd->scr, 1);
355 _hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
357 Widget_Data *wd = elm_widget_data_get(obj);
361 elm_smart_scroller_hold_set(wd->scr, 0);
365 _freeze_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
367 Widget_Data *wd = elm_widget_data_get(obj);
371 elm_smart_scroller_freeze_set(wd->scr, 1);
375 _freeze_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
377 Widget_Data *wd = elm_widget_data_get(obj);
381 elm_smart_scroller_freeze_set(wd->scr, 0);
385 _resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
391 _edge_left(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
393 evas_object_smart_callback_call(data, SIG_EDGE_LEFT, NULL);
397 _edge_right(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
399 evas_object_smart_callback_call(data, SIG_EDGE_RIGHT, NULL);
403 _edge_top(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
405 evas_object_smart_callback_call(data, SIG_EDGE_TOP, NULL);
409 _edge_bottom(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
411 evas_object_smart_callback_call(data, SIG_EDGE_BOTTOM, NULL);
415 _scroll(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
417 evas_object_smart_callback_call(data, SIG_SCROLL, NULL);
421 _scroll_anim_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
423 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL);
427 _scroll_anim_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
429 evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
433 _scroll_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
435 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
439 _scroll_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
441 evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
445 * Add a new scroller to the parent
447 * @param parent The parent object
448 * @return The new object or NULL if it cannot be created
453 elm_scroller_add(Evas_Object *parent)
458 Evas_Coord minw, minh;
460 EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
462 wd = ELM_NEW(Widget_Data);
463 e = evas_object_evas_get(parent);
465 obj = elm_widget_add(e);
466 ELM_SET_WIDTYPE(widtype, "scroller");
467 elm_widget_type_set(obj, "scroller");
468 elm_widget_sub_object_add(parent, obj);
469 elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
470 elm_widget_data_set(obj, wd);
471 elm_widget_del_hook_set(obj, _del_hook);
472 elm_widget_theme_hook_set(obj, _theme_hook);
473 elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
474 elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
475 elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
476 elm_widget_focus_next_hook_set(obj, _elm_scroller_focus_next_hook);
477 elm_widget_can_focus_set(obj, EINA_TRUE);
478 elm_widget_event_hook_set(obj, _event_hook);
479 elm_widget_focus_region_hook_set(obj, _focus_region_hook);
481 wd->widget_name = eina_stringshare_add("scroller");
482 wd->widget_base = eina_stringshare_add("base");
484 wd->scr = elm_smart_scroller_add(e);
485 elm_smart_scroller_widget_set(wd->scr, obj);
487 elm_widget_resize_object_set(obj, wd->scr);
488 evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
489 _changed_size_hints, obj);
491 edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &minw, &minh);
492 evas_object_size_hint_min_set(obj, minw, minh);
493 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
495 evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
496 evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
497 evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
498 evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
499 evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
501 evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj);
502 evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj);
503 evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj);
504 evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom, obj);
505 evas_object_smart_callback_add(wd->scr, "scroll", _scroll, obj);
506 evas_object_smart_callback_add(wd->scr, "animate,start", _scroll_anim_start, obj);
507 evas_object_smart_callback_add(wd->scr, "animate,stop", _scroll_anim_stop, obj);
508 evas_object_smart_callback_add(wd->scr, "drag,start", _scroll_drag_start, obj);
509 evas_object_smart_callback_add(wd->scr, "drag,stop", _scroll_drag_stop, obj);
513 // TODO: convert Elementary to subclassing of Evas_Smart_Class
514 // TODO: and save some bytes, making descriptions per-class and not instance!
515 evas_object_smart_callbacks_descriptions_set(obj, _signals);
516 _mirrored_set(obj, elm_widget_mirrored_get(obj));
521 _elm_scroller_edje_object_get(Evas_Object *obj)
523 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
524 Widget_Data *wd = elm_widget_data_get(obj);
525 if (!wd) return NULL;
526 return elm_smart_scroller_edje_object_get(wd->scr);
530 * Set the content of the scroller widget (the object to be scrolled around).
532 * Once the content object is set, a previously set one will be deleted.
533 * If you want to keep that old content object, use the
534 * elm_scroller_content_unset() function.
536 * @param obj The scroller object
537 * @param content The new content object
542 elm_scroller_content_set(Evas_Object *obj, Evas_Object *content)
544 ELM_CHECK_WIDTYPE(obj, widtype);
545 Widget_Data *wd = elm_widget_data_get(obj);
547 if (wd->content == content) return;
548 if (wd->content) evas_object_del(wd->content);
549 wd->content = content;
552 elm_widget_on_show_region_hook_set(content, _show_region_hook, obj);
553 elm_widget_sub_object_add(obj, content);
555 elm_smart_scroller_child_set(wd->scr, content);
556 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
557 _changed_size_hints, obj);
563 * Get the content of the scroller widget
565 * Return the content object which is set for this widget
567 * @param obj The slider object
568 * @return The content that is being used
573 elm_scroller_content_get(const Evas_Object *obj)
575 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
576 Widget_Data *wd = elm_widget_data_get(obj);
577 if (!wd) return NULL;
582 * Unset the content of the scroller widget
584 * Unparent and return the content object which was set for this widget
586 * @param obj The slider object
587 * @return The content that was being used
592 elm_scroller_content_unset(Evas_Object *obj)
594 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
595 Widget_Data *wd = elm_widget_data_get(obj);
596 Evas_Object *content;
597 if (!wd) return NULL;
598 if (!wd->content) return NULL;
599 content = wd->content;
600 elm_widget_sub_object_del(obj, wd->content);
601 edje_object_part_unswallow(wd->scr, wd->content);
607 * Set custom theme elements for the scroller
609 * @param obj The scroller object
610 * @param widget The widget name to use (default is "scroller")
611 * @param base The base name to use (default is "base")
616 elm_scroller_custom_widget_base_theme_set(Evas_Object *obj, const char *widget, const char *base)
618 ELM_CHECK_WIDTYPE(obj, widtype);
619 Widget_Data *wd = elm_widget_data_get(obj);
621 EINA_SAFETY_ON_NULL_RETURN(widget);
622 EINA_SAFETY_ON_NULL_RETURN(base);
623 if (eina_stringshare_replace(&wd->widget_name, widget) |
624 eina_stringshare_replace(&wd->widget_base, base))
629 * Make the scroller minimum size limited to the minimum size of the content
631 * By default the scroller will be as small as its design allows, irrespective
632 * of its content. This will make the scroller minimum size the right size
633 * horizontally and/or vertically to perfectly fit its content.
635 * @param obj The scroller object
636 * @param w Enable limiting minimum size horizontally
637 * @param h Enable limiting minimum size vertically
642 elm_scroller_content_min_limit(Evas_Object *obj, Eina_Bool w, Eina_Bool h)
644 ELM_CHECK_WIDTYPE(obj, widtype);
645 Widget_Data *wd = elm_widget_data_get(obj);
653 * Show a specific virtual region within the scroller content object
655 * This will ensure all (or part if it does not fit) of the designated
656 * region in the virtual content object (0, 0 starting at the top-left of the
657 * virtual content object) is shown within the scroller.
659 * @param obj The scroller object
660 * @param x X coordinate of the region
661 * @param y Y coordinate of the region
662 * @param w Width of the region
663 * @param h Height of the region
668 elm_scroller_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
670 ELM_CHECK_WIDTYPE(obj, widtype);
671 Widget_Data *wd = elm_widget_data_get(obj);
672 if ((!wd) || (!wd->scr)) return;
673 elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
677 * Set the scroller scrollbar policy
679 * This sets the scrollbar visibility policy for the given scroller.
680 * ELM_SMART_SCROLLER_POLICY_AUTO means the scrollber is made visible if it
681 * is needed, and otherwise kept hidden. ELM_SMART_SCROLLER_POLICY_ON turns
682 * it on all the time, and ELM_SMART_SCROLLER_POLICY_OFF always keeps it off.
683 * This applies respectively for the horizontal and vertical scrollbars.
685 * @param obj The scroller object
686 * @param policy_h Horizontal scrollbar policy
687 * @param policy_v Vertical scrollbar policy
692 elm_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v)
694 ELM_CHECK_WIDTYPE(obj, widtype);
695 Widget_Data *wd = elm_widget_data_get(obj);
696 const Elm_Scroller_Policy map[3] =
698 ELM_SMART_SCROLLER_POLICY_AUTO,
699 ELM_SMART_SCROLLER_POLICY_ON,
700 ELM_SMART_SCROLLER_POLICY_OFF
702 if ((!wd) || (!wd->scr)) return;
703 if ((policy_h >= 3) || (policy_v >= 3)) return;
704 elm_smart_scroller_policy_set(wd->scr, map[policy_h], map[policy_v]);
708 elm_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v)
710 ELM_CHECK_WIDTYPE(obj, widtype);
711 Widget_Data *wd = elm_widget_data_get(obj);
712 if ((!wd) || (!wd->scr)) return;
713 elm_smart_scroller_policy_get(wd->scr,
714 (Elm_Smart_Scroller_Policy *) policy_h,
715 (Elm_Smart_Scroller_Policy *) policy_v);
719 * Get the currently visible content region
721 * This gets the current region in the content object that is visible through
722 * the scroller. Also see elm_scroller_region_show(). The region co-ordinates
723 * are returned in the @p x, @p y, @p w, @p h values pointed to.
725 * @param obj The scroller object
726 * @param x X coordinate of the region
727 * @param y Y coordinate of the region
728 * @param w Width of the region
729 * @param h Height of the region
734 elm_scroller_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
736 ELM_CHECK_WIDTYPE(obj, widtype);
737 Widget_Data *wd = elm_widget_data_get(obj);
738 if ((!wd) || (!wd->scr)) return;
739 if ((x) || (y)) elm_smart_scroller_child_pos_get(wd->scr, x, y);
740 if ((w) || (h)) elm_smart_scroller_child_viewport_size_get(wd->scr, w, h);
744 * Get the size of the content child object
746 * This gets the size of the child object of the scroller. Actually the
747 * content of a scroller doesn't specifically need to be an actual object
748 * as it can be virtual and defined purely by callbacks.
750 * @param obj The scroller object
751 * @param w Width return
752 * @param h Height return
757 elm_scroller_child_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
759 ELM_CHECK_WIDTYPE(obj, widtype);
760 Widget_Data *wd = elm_widget_data_get(obj);
762 evas_object_geometry_get(wd->content, NULL, NULL, w, h);
766 * Set bouncing behavior
768 * When scrolling, the scroller may "bounce" when reaching an edge of the child
769 * object. This is a visual way to indicate the end has been reached. This is
770 * enabled by default for both axes. This will set if it is enabled for that
771 * axis with the boolean parameters for each axis.
773 * @param obj The scroller object
774 * @param h_bounce Will the scroller bounce horizontally or not
775 * @param v_bounce Will the scroller bounce vertically or not
780 elm_scroller_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
782 ELM_CHECK_WIDTYPE(obj, widtype);
783 Widget_Data *wd = elm_widget_data_get(obj);
784 if ((!wd) || (!wd->scr)) return;
785 elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
789 * Get the bounce mode
791 * @param obj The Scroller object
792 * @param h_bounce Allow bounce horizontally
793 * @param v_bounce Allow bounce vertically
798 elm_scroller_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
800 ELM_CHECK_WIDTYPE(obj, widtype);
801 Widget_Data *wd = elm_widget_data_get(obj);
803 elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);
807 * Set scroll page size relative to viewport size.
809 * The scroller is capable of limiting scrolling by the user to "pages". That
810 * is to jump by and only show a "whole page" at a time as if the continuous
811 * area of the scroller content is split into page sized pieces. This sets
812 * the size of a page relative to the viewport of the scroller. 1.0 is "1
813 * viewport" is size (horizontally or vertically). 0.0 turns it off in that
814 * axis. This is mutually exclusive with page size
815 * (see elm_scroller_page_size_set() for more information). Likewise 0.5
816 * is "half a viewport". Sane usable valus are normally between 0.0 and 1.0
817 * including 1.0. If you only want 1 axis to be page "limited", use 0.0 for
820 * @param obj The scroller object
821 * @param h_pagerel The horizontal page relative size
822 * @param v_pagerel The vertical page relative size
827 elm_scroller_page_relative_set(Evas_Object *obj, double h_pagerel, double v_pagerel)
829 ELM_CHECK_WIDTYPE(obj, widtype);
830 Widget_Data *wd = elm_widget_data_get(obj);
832 wd->pagerel_h = h_pagerel;
833 wd->pagerel_v = v_pagerel;
835 elm_smart_scroller_paging_set(wd->scr, wd->pagerel_h, wd->pagerel_v,
836 wd->pagesize_h, wd->pagesize_v);
840 * Set scroll page size.
842 * See also elm_scroller_page_relative_set(). This, instead of a page size
843 * being relative to the viewport, sets it to an absolute fixed value, with
844 * 0 turning it off for that axis.
846 * @param obj The scroller object
847 * @param h_pagesize The horizontal page size
848 * @param v_pagesize The vertical page size
853 elm_scroller_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize)
855 ELM_CHECK_WIDTYPE(obj, widtype);
856 Widget_Data *wd = elm_widget_data_get(obj);
858 wd->pagesize_h = h_pagesize;
859 wd->pagesize_v = v_pagesize;
861 elm_smart_scroller_paging_set(wd->scr, wd->pagerel_h, wd->pagerel_v,
862 wd->pagesize_h, wd->pagesize_v);
866 * Show a specific virtual region within the scroller content object.
868 * This will ensure all (or part if it does not fit) of the designated
869 * region in the virtual content object (0, 0 starting at the top-left of the
870 * virtual content object) is shown within the scroller. Unlike
871 * elm_scroller_region_show(), this allow the scroller to "smoothly slide"
872 * to this location (if configuration in general calls for transitions). It
873 * may not jump immediately to the new location and make take a while and
874 * show other content along the way.
876 * @param obj The scroller object
877 * @param x X coordinate of the region
878 * @param y Y coordinate of the region
879 * @param w Width of the region
880 * @param h Height of the region
885 elm_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
887 ELM_CHECK_WIDTYPE(obj, widtype);
888 Widget_Data *wd = elm_widget_data_get(obj);
889 if ((!wd) || (!wd->scr)) return;
890 elm_smart_scroller_region_bring_in(wd->scr, x, y, w, h);
895 * Set event propagation on a scroller
897 * This enables or disabled event propagation from the scroller content to
898 * the scroller and its parent. By default event propagation is disabled.
900 * @param obj The scroller object
901 * @param propagation If propagation is enabled or not
906 elm_scroller_propagate_events_set(Evas_Object *obj, Eina_Bool propagation)
908 ELM_CHECK_WIDTYPE(obj, widtype);
909 Widget_Data *wd = elm_widget_data_get(obj);
912 evas_object_propagate_events_set(wd->scr, propagation);
916 * Get event propagation for a scroller
918 * This gets the event propagation for a scroller. See
919 * elm_scroller_propagate_events_set() for more information
921 * @param obj The scroller object
922 * @return The propagation state
927 elm_scroller_propagate_events_get(const Evas_Object *obj)
929 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
930 Widget_Data *wd = elm_widget_data_get(obj);
931 if (!wd) return EINA_FALSE;
933 return evas_object_propagate_events_get(wd->scr);