2c365c8b2015283c3acb05706733309cb160992c
[framework/uifw/elementary.git] / src / lib / elm_scroller.c
1 #include <Elementary.h>
2 #include "elm_priv.h"
3
4 /**
5  * @defgroup Scroller Scroller
6  *
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.
12  *
13  * Signals that you can add callbacks for are:
14  *
15  * edge,left - the left edge of the content has been reached
16  *
17  * edge,right - the right edge of the content has been reached
18  *
19  * edge,top - the top edge of the content has been reached
20  *
21  * edge,bottom - the bottom edge of the content has been reached
22  *
23  * scroll - the content has been scrolled (moved)
24  *
25  * scroll,anim,start - scrolling animation has started
26  *
27  * scroll,anim,stop - scrolling animation has stopped
28  *
29  * scroll,drag,start - dragging the contents around has started
30  *
31  * scroll,drag,stop - dragging the contents around has stopped
32  */
33 typedef struct _Widget_Data Widget_Data;
34
35 struct _Widget_Data
36 {
37    Evas_Object *scr;
38    Evas_Object *content;
39    const char *widget_name, *widget_base;
40    Eina_Bool min_w : 1;
41    Eina_Bool min_h : 1;
42    double pagerel_h, pagerel_v;
43    Evas_Coord pagesize_h, pagesize_v;
44 };
45
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
53 static const char SIG_SCROLL[] = "scroll";
54 static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
55 static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
56 static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
57 static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
58 static const char SIG_EDGE_LEFT[] = "edge,left";
59 static const char SIG_EDGE_RIGHT[] = "edge,right";
60 static const char SIG_EDGE_TOP[] = "edge,top";
61 static const char SIG_EDGE_BOTTOM[] = "edge,bottom";
62 static const Evas_Smart_Cb_Description _signals[] = {
63   {SIG_SCROLL, ""},
64   {SIG_SCROLL_ANIM_START, ""},
65   {SIG_SCROLL_ANIM_STOP, ""},
66   {SIG_SCROLL_DRAG_START, ""},
67   {SIG_SCROLL_DRAG_STOP, ""},
68   {SIG_EDGE_LEFT, ""},
69   {SIG_EDGE_RIGHT, ""},
70   {SIG_EDGE_TOP, ""},
71   {SIG_EDGE_BOTTOM, ""},
72   {NULL, NULL}
73 };
74
75 static void
76 _del_hook(Evas_Object *obj)
77 {
78    
79    Widget_Data *wd = elm_widget_data_get(obj);
80    if (!wd) return;
81    free(wd);
82 }
83
84 static void
85 _theme_hook(Evas_Object *obj)
86 {
87    Widget_Data *wd = elm_widget_data_get(obj);
88    if (!wd) return;
89    if (wd->scr)
90      {
91         elm_smart_scroller_object_theme_set(obj, wd->scr, 
92                                             wd->widget_name, wd->widget_base,
93                                             elm_widget_style_get(obj));
94 //        edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
95      }
96    _sizing_eval(obj);
97 }
98
99 static void
100 _show_region_hook(void *data, Evas_Object *obj)
101 {
102    
103    Widget_Data *wd = elm_widget_data_get(data);
104    Evas_Coord x, y, w, h;
105    if (!wd) return;
106    elm_widget_show_region_get(obj, &x, &y, &w, &h);
107    if (wd->scr)
108      elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
109 }
110
111 static void
112 _sizing_eval(Evas_Object *obj)
113 {
114    
115    Widget_Data *wd = elm_widget_data_get(obj);
116    Evas_Coord  vw, vh, minw, minh, maxw, maxh, w, h, vmw, vmh;
117    double xw, yw;
118
119    if (!wd) return;
120    evas_object_size_hint_min_get(wd->content, &minw, &minh);
121    evas_object_size_hint_max_get(wd->content, &maxw, &maxh);
122    evas_object_size_hint_weight_get(wd->content, &xw, &yw);
123    if (wd->scr)
124      {
125         elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
126         if (xw > 0.0)
127           {
128              if ((minw > 0) && (vw < minw)) vw = minw;
129              else if ((maxw > 0) && (vw > maxw)) vw = maxw;
130           }
131         else if (minw > 0) vw = minw;
132         if (yw > 0.0)
133           {
134              if ((minh > 0) && (vh < minh)) vh = minh;
135              else if ((maxh > 0) && (vh > maxh)) vh = maxh;
136           }
137         else if (minh > 0) vh = minh;
138         evas_object_resize(wd->content, vw, vh);
139         w = -1;
140         h = -1;
141         edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
142         if (wd->min_w) w = vmw + minw;
143         if (wd->min_h) h = vmh + minh;
144         evas_object_size_hint_min_set(obj, w, h);
145      }
146 }
147
148 static void
149 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
150 {
151    _sizing_eval(data);
152 }
153
154 static void
155 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
156 {
157    
158    Widget_Data *wd = elm_widget_data_get(obj);
159    Evas_Object *sub = event_info;
160
161    if (!wd) return;
162    if (sub == wd->content)
163      {
164         elm_widget_on_show_region_hook_set(wd->content, NULL, NULL);
165         evas_object_event_callback_del_full (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
166            _changed_size_hints, obj);
167         wd->content = NULL;
168         _sizing_eval(obj);
169      }
170    else if (sub == wd->scr)
171      wd->scr = NULL;
172 }
173
174 static void
175 _hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
176 {
177    
178    Widget_Data *wd = elm_widget_data_get(obj);
179
180    if (!wd) return;
181    if (wd->scr)
182      elm_smart_scroller_hold_set(wd->scr, 1);
183 }
184
185 static void
186 _hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
187 {
188    
189    Widget_Data *wd = elm_widget_data_get(obj);
190
191    if (!wd) return;
192    if (wd->scr)
193      elm_smart_scroller_hold_set(wd->scr, 0);
194 }
195
196 static void
197 _freeze_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
198 {
199    
200    Widget_Data *wd = elm_widget_data_get(obj);
201
202    if (!wd) return;
203    if (wd->scr)
204      elm_smart_scroller_freeze_set(wd->scr, 1);
205 }
206
207 static void
208 _freeze_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
209 {
210    
211    Widget_Data *wd = elm_widget_data_get(obj);
212
213    if (!wd) return;
214    if (wd->scr)
215      elm_smart_scroller_freeze_set(wd->scr, 0);
216 }
217
218 static void
219 _resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
220 {
221    _sizing_eval(data);
222 }
223
224 static void
225 _edge_left(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
226 {
227    evas_object_smart_callback_call(data, SIG_EDGE_LEFT, NULL);
228 }
229
230 static void
231 _edge_right(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
232 {
233    evas_object_smart_callback_call(data, SIG_EDGE_RIGHT, NULL);
234 }
235
236 static void
237 _edge_top(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
238 {
239    evas_object_smart_callback_call(data, SIG_EDGE_TOP, NULL);
240 }
241
242 static void
243 _edge_bottom(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
244 {
245    evas_object_smart_callback_call(data, SIG_EDGE_BOTTOM, NULL);
246 }
247
248 static void
249 _scroll(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
250 {
251    evas_object_smart_callback_call(data, SIG_SCROLL, NULL);
252 }
253
254 static void
255 _scroll_anim_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
256 {
257    evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL);
258 }
259
260 static void
261 _scroll_anim_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
262 {
263    evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
264 }
265
266 static void
267 _scroll_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
268 {
269    evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
270 }
271
272 static void
273 _scroll_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
274 {
275    evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
276 }
277
278 /**
279  * Add a new scroller to the parent
280  *
281  * @param parent The parent object
282  * @return The new object or NULL if it cannot be created
283  *
284  * @ingroup Scroller
285  */
286 EAPI Evas_Object *
287 elm_scroller_add(Evas_Object *parent)
288 {
289    Evas_Object *obj;
290    Evas *e;
291    Widget_Data *wd;
292    Evas_Coord minw, minh;
293
294    wd = ELM_NEW(Widget_Data);
295    e = evas_object_evas_get(parent);
296    obj = elm_widget_add(e);
297    ELM_SET_WIDTYPE(widtype, "scroller");
298    elm_widget_type_set(obj, "scroller");
299    elm_widget_sub_object_add(parent, obj);
300    elm_widget_data_set(obj, wd);
301    elm_widget_del_hook_set(obj, _del_hook);
302    elm_widget_theme_hook_set(obj, _theme_hook);
303
304    wd->widget_name = eina_stringshare_add("scroller");
305    wd->widget_base = eina_stringshare_add("base");
306    
307    wd->scr = elm_smart_scroller_add(e);
308    elm_smart_scroller_widget_set(wd->scr, obj);
309    elm_smart_scroller_object_theme_set(obj, wd->scr, 
310                                        wd->widget_name, wd->widget_base,
311                                        elm_widget_style_get(obj));
312    elm_widget_resize_object_set(obj, wd->scr);
313    evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
314                                   _changed_size_hints, obj);
315
316    edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &minw, &minh);
317    evas_object_size_hint_min_set(obj, minw, minh);
318    evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
319
320    evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
321    evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
322    evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
323    evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
324    evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
325
326    evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj);
327    evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj);
328    evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj);
329    evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom, obj);
330    evas_object_smart_callback_add(wd->scr, "scroll", _scroll, obj);
331    evas_object_smart_callback_add(wd->scr, "animate,start", _scroll_anim_start, obj);
332    evas_object_smart_callback_add(wd->scr, "animate,stop", _scroll_anim_stop, obj);
333    evas_object_smart_callback_add(wd->scr, "drag,start", _scroll_drag_start, obj);
334    evas_object_smart_callback_add(wd->scr, "drag,stop", _scroll_drag_stop, obj);
335
336    _sizing_eval(obj);
337
338    // TODO: convert Elementary to subclassing of Evas_Smart_Class
339    // TODO: and save some bytes, making descriptions per-class and not instance!
340    evas_object_smart_callbacks_descriptions_set(obj, _signals);
341    return obj;
342 }
343
344
345 /**
346  * Set the content object
347  *
348  * Sets the content of the scroller (the object to be scrolled around)
349  *
350  * @param obj The scroller object
351  * @param content The new content object
352  *
353  * @ingroup Scroller
354  */
355 EAPI void
356 elm_scroller_content_set(Evas_Object *obj, Evas_Object *content)
357 {
358    ELM_CHECK_WIDTYPE(obj, widtype);
359    Widget_Data *wd = elm_widget_data_get(obj);
360    if (!wd) return;
361    if ((wd->content != content) && (wd->content))
362      elm_widget_sub_object_del(obj, wd->content);
363    wd->content = content;
364    if (content)
365      {
366         elm_widget_on_show_region_hook_set(content, _show_region_hook, obj);
367         elm_widget_sub_object_add(obj, content);
368         if (wd->scr)
369           elm_smart_scroller_child_set(wd->scr, content);
370         evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
371                                        _changed_size_hints, obj);
372         _sizing_eval(obj);
373      }
374 }
375
376 /**
377  * Set custom theme elements for the scroller
378  * 
379  * @param obj The scroller object
380  * @param widget The widget name to use (default is "scroller")
381  * @param base The base name to use (default is "base")
382  */
383 EAPI void
384 elm_scroller_custom_widget_base_theme_set(Evas_Object *obj, const char *widget, const char *base)
385 {
386    ELM_CHECK_WIDTYPE(obj, widtype);
387    Widget_Data *wd = elm_widget_data_get(obj);
388    if (!wd) return;
389    if ((!widget) || (!base)) return;
390    if (eina_stringshare_replace(&wd->widget_name, widget) |
391        eina_stringshare_replace(&wd->widget_base, base))
392      _theme_hook(obj);
393 }
394
395 /**
396  * Make the scroller minimum size limited to the minimum size of the content
397  *
398  * By default the scroller will be as small as its design allows, irrespective
399  * of its content. This will make the scroller minimum size the right size
400  * horizontally and/or vertically to perfectly fit its content.
401  *
402  * @param obj The scroller object
403  * @param w Enable limiting minimum size horizontally
404  * @param h Enable limiting minimum size vertically
405  *
406  * @ingroup Scroller
407  */
408 EAPI void
409 elm_scroller_content_min_limit(Evas_Object *obj, Eina_Bool w, Eina_Bool h)
410 {
411    ELM_CHECK_WIDTYPE(obj, widtype);
412    Widget_Data *wd = elm_widget_data_get(obj);
413    if (!wd) return;
414    wd->min_w = w;
415    wd->min_h = h;
416    _sizing_eval(obj);
417 }
418
419 /**
420  * Show a specific virtual region within the scroller content object
421  *
422  * This will ensure all (or part if it does not fit) of the designated
423  * region in the virtual content object (0, 0 starting at the top-left of the
424  * virtual content object) is shown within the scroller.
425  *
426  * @param obj The scroller object
427  * @param x X coordinate of the region
428  * @param y Y coordinate of the region
429  * @param w Width of the region
430  * @param h Height of the region
431  *
432  * @ingroup Scroller
433  */
434 EAPI void
435 elm_scroller_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
436 {
437    ELM_CHECK_WIDTYPE(obj, widtype);
438    Widget_Data *wd = elm_widget_data_get(obj);
439    if (!wd) return;
440    if (wd->scr)
441      elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
442 }
443
444 /**
445  * Set the scroller scrollbar policy
446  *
447  * This sets the scrollbar visibility policy for the given scroller.
448  * ELM_SMART_SCROLLER_POLICY_AUTO means the scrollber is made visible if it
449  * is needed, and otherwise kept hidden. ELM_SMART_SCROLLER_POLICY_ON turns
450  * it on all the time, and ELM_SMART_SCROLLER_POLICY_OFF always keeps it off.
451  * This applies respectively for the horizontal and vertical scrollbars.
452  *
453  * @param obj The scroller object
454  * @param policy_h Horizontal scrollbar policy
455  * @param policy_v Vertical scrollbar policy
456  *
457  * @ingroup Scroller
458  */
459 EAPI void
460 elm_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v)
461 {
462    ELM_CHECK_WIDTYPE(obj, widtype);
463    Widget_Data *wd = elm_widget_data_get(obj);
464    const Elm_Scroller_Policy map[3] =
465      {
466         ELM_SMART_SCROLLER_POLICY_AUTO,
467           ELM_SMART_SCROLLER_POLICY_ON,
468           ELM_SMART_SCROLLER_POLICY_OFF
469      };
470    if (!wd) return;
471    if ((policy_h >= 3) || (policy_v >= 3)) return;
472    if (wd->scr)
473      elm_smart_scroller_policy_set(wd->scr, map[policy_h], map[policy_v]);
474 }
475
476 EAPI void
477 elm_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v)
478 {
479    ELM_CHECK_WIDTYPE(obj, widtype);
480    Widget_Data *wd = elm_widget_data_get(obj);
481    Elm_Smart_Scroller_Policy s_policy_h, s_policy_v;
482    if (!wd) return;
483    if (wd->scr)
484      elm_smart_scroller_policy_get(wd->scr, &s_policy_h, &s_policy_v);
485    *policy_h = (Elm_Scroller_Policy) s_policy_h;
486    *policy_v = (Elm_Scroller_Policy) s_policy_v;
487 }
488
489 /**
490  * Get the currently visible content region
491  *
492  * This gets the current region in the content object that is visible through
493  * the scroller. Also see elm_scroller_region_show(). The region co-ordinates
494  * are returned in the @p x, @p y, @p w, @p h values pointed to.
495  *
496  * @param obj The scroller object
497  * @param x X coordinate of the region
498  * @param y Y coordinate of the region
499  * @param w Width of the region
500  * @param h Height of the region
501  *
502  * @ingroup Scroller
503  */
504 EAPI void
505 elm_scroller_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
506 {
507    ELM_CHECK_WIDTYPE(obj, widtype);
508    Widget_Data *wd = elm_widget_data_get(obj);
509    if (!wd) return;
510    if (wd->scr)
511      {
512         if ((x) && (y)) elm_smart_scroller_child_pos_get(wd->scr, x, y);
513         if ((w) && (h)) elm_smart_scroller_child_viewport_size_get(wd->scr, w, h);
514      }
515 }
516
517 /**
518  * Get the size of the content child object
519  *
520  * This gets the size of the child object of the scroller. Actually the
521  * content of a scroller doesn't specifically need to be an actual object
522  * as it can be virtual and defined purely by callbacks.
523  *
524  * @param obj The scroller object
525  * @param w Width return
526  * @param h Height return
527  *
528  * @ingroup Scroller
529  */
530 EAPI void
531 elm_scroller_child_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
532 {
533    ELM_CHECK_WIDTYPE(obj, widtype);
534    Widget_Data *wd = elm_widget_data_get(obj);
535    if (!wd) return;
536    evas_object_geometry_get(wd->content, NULL, NULL, w, h);
537 }
538
539 /**
540  * Set bouncing behavior
541  *
542  * When scrolling, the scroller may "bounce" when reaching an edge of the child
543  * object. This is a visual way to indicate the end has been reached. This is
544  * enabled by default for both axes. This will set if it is enabled for that
545  * axis with the boolean parameers for each axis.
546  *
547  * @param obj The scroller object
548  * @param h_bounce Will the scroller bounce horizontally or not
549  y Y coordinate of the region
550  w Width of the region
551  h Height of the region
552
553  EAPI void elm_scroller_region_show ( Evas_Object *  obj, * @param v_bounce Will the scroller bounce vertically or not
554  *
555  * @ingroup Scroller
556  */
557 EAPI void
558 elm_scroller_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
559 {
560    ELM_CHECK_WIDTYPE(obj, widtype);
561    Widget_Data *wd = elm_widget_data_get(obj);
562    if (!wd) return;
563    if (wd->scr)
564      elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
565 }
566
567 /**
568  * Set scroll page size relative to viewport size
569  *
570  * The scroller is sapale of limiting scrolling by the user to "pages". That
571  * is to jump by and only show a "whole page" at a time as if the continuous
572  * area of the scroller conent is split into page sized pieces. This sets
573  * the size of a page relative to the viewport of the scroller. 1.0 is "1
574  * viewport" is size (horizontally or vertically). 0.0 turns it off in that
575  * axis. This is mutually exclusive with page size
576  * (see elm_scroller_page_size_set()  for more information). likewise 0.5
577  * is "half a viewport". Sane usable valus are normally between 0.0 and 1.0
578  * including 1.0. If you only want 1 axis to be page "limited", use 0.0 for
579  * the other axis.
580  *
581  * @param obj The scroller object
582  * @param h_pagerel The horizontal page relative size
583  * @param v_pagerel The vertical page relative size
584  *
585  * @ingroup Scroller
586  */
587 EAPI void
588 elm_scroller_page_relative_set(Evas_Object *obj, double h_pagerel, double v_pagerel)
589 {
590    ELM_CHECK_WIDTYPE(obj, widtype);
591    Widget_Data *wd = elm_widget_data_get(obj);
592    if (!wd) return;
593    wd->pagerel_h = h_pagerel;
594    wd->pagerel_v = v_pagerel;
595    if (wd->scr)
596      elm_smart_scroller_paging_set(wd->scr, wd->pagerel_h, wd->pagerel_v,
597                                    wd->pagesize_h, wd->pagesize_v);
598 }
599
600 /**
601  * Set scroll page size
602  *
603  * See also elm_scroller_page_relative_set(). This, instead of a page size
604  * being relaive to the viewport, sets it to an absolute fixed value, with
605  * 0 turning it off for that axis.
606  *
607  * @param obj The scroller object
608  * @param h_pagesize The horizontal page size
609  * @param v_pagesize The vertical page size
610  *
611  * @ingroup Scroller
612  */
613 EAPI void
614 elm_scroller_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize)
615 {
616    ELM_CHECK_WIDTYPE(obj, widtype);
617    Widget_Data *wd = elm_widget_data_get(obj);
618    if (!wd) return;
619    wd->pagesize_h = h_pagesize;
620    wd->pagesize_v = v_pagesize;
621    if (wd->scr)
622      elm_smart_scroller_paging_set(wd->scr, wd->pagerel_h, wd->pagerel_v,
623                                    wd->pagesize_h, wd->pagesize_v);
624 }
625
626 /**
627  * Show a specific virtual region within the scroller content object
628  *
629  * This will ensure all (or part if it does not fit) of the designated
630  * region in the virtual content object (0, 0 starting at the top-left of the
631  * virtual content object) is shown within the scroller. Unlike
632  * elm_scroller_region_show(), this allow the scroller to "smoothly slide"
633  * to this location (if configuration in general calls for transitions). It
634  * may not jump immediately to the new location and make take a while and
635  * show other content along the way.
636  *
637  * @param obj The scroller object
638  * @param x X coordinate of the region
639  * @param y Y coordinate of the region
640  * @param w Width of the region
641  * @param h Height of the region
642  *
643  * @ingroup Scroller
644  */
645 EAPI void
646 elm_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
647 {
648    ELM_CHECK_WIDTYPE(obj, widtype);
649    Widget_Data *wd = elm_widget_data_get(obj);
650    if (!wd) return;
651    if (wd->scr)
652      elm_smart_scroller_region_bring_in(wd->scr, x, y, w, h);
653 }