elementary: Improve include file modularity
[framework/uifw/elementary.git] / src / lib / elm_scroller.c
1 #include <Elementary.h>
2 #include "elm_priv.h"
3 #include "els_scroller.h"
4
5 typedef struct _Widget_Data Widget_Data;
6
7 struct _Widget_Data
8 {
9    Evas_Object *scr;
10    Evas_Object *content;
11    const char *widget_name, *widget_base;
12    Eina_Bool min_w : 1;
13    Eina_Bool min_h : 1;
14    double pagerel_h, pagerel_v;
15    Evas_Coord pagesize_h, pagesize_v;
16 };
17
18 static const char *widtype = NULL;
19 static void _del_hook(Evas_Object *obj);
20 static void _theme_hook(Evas_Object *obj);
21 static void _show_region_hook(void *data, Evas_Object *obj);
22 static void _sizing_eval(Evas_Object *obj);
23 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
24 static void _on_focus_hook(void *data, Evas_Object *obj);
25 static Eina_Bool _event_hook(Evas_Object *obj, Evas_Object *src,
26                              Evas_Callback_Type type, void *event_info);
27
28
29 static const char SIG_SCROLL[] = "scroll";
30 static const char SIG_SCROLL_ANIM_START[] = "scroll,anim,start";
31 static const char SIG_SCROLL_ANIM_STOP[] = "scroll,anim,stop";
32 static const char SIG_SCROLL_DRAG_START[] = "scroll,drag,start";
33 static const char SIG_SCROLL_DRAG_STOP[] = "scroll,drag,stop";
34 static const char SIG_EDGE_LEFT[] = "edge,left";
35 static const char SIG_EDGE_RIGHT[] = "edge,right";
36 static const char SIG_EDGE_TOP[] = "edge,top";
37 static const char SIG_EDGE_BOTTOM[] = "edge,bottom";
38 static const Evas_Smart_Cb_Description _signals[] = {
39   {SIG_SCROLL, ""},
40   {SIG_SCROLL_ANIM_START, ""},
41   {SIG_SCROLL_ANIM_STOP, ""},
42   {SIG_SCROLL_DRAG_START, ""},
43   {SIG_SCROLL_DRAG_STOP, ""},
44   {SIG_EDGE_LEFT, ""},
45   {SIG_EDGE_RIGHT, ""},
46   {SIG_EDGE_TOP, ""},
47   {SIG_EDGE_BOTTOM, ""},
48   {NULL, NULL}
49 };
50
51 static Eina_Bool
52 _event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
53 {
54    if (type != EVAS_CALLBACK_KEY_DOWN) return EINA_FALSE;
55    Evas_Event_Key_Down *ev = event_info;
56    Widget_Data *wd = elm_widget_data_get(obj);
57    if (!wd) return EINA_FALSE;
58    if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
59    if (elm_widget_disabled_get(obj)) return EINA_FALSE;
60
61    Evas_Coord x = 0;
62    Evas_Coord y = 0;
63    Evas_Coord step_x = 0;
64    Evas_Coord step_y = 0;
65    Evas_Coord max_x = 0;
66    Evas_Coord max_y = 0;
67    Evas_Coord v_w = 0;
68    Evas_Coord v_h = 0;
69    Evas_Coord page_x = 0;
70    Evas_Coord page_y = 0;
71
72    elm_smart_scroller_child_pos_get(wd->scr, &x, &y);
73    elm_smart_scroller_step_size_get(wd->scr, &step_x, &step_y);
74    elm_smart_scroller_page_size_get(wd->scr, &page_x, &page_y);
75    elm_smart_scroller_child_viewport_size_get(wd->scr, &v_w, &v_h);
76    elm_scroller_child_size_get(obj, &max_x, &max_y);
77
78    if ((!strcmp(ev->keyname, "Left")) || (!strcmp(ev->keyname, "KP_Left")))
79      {
80         x -= step_x;
81      }
82    else if ((!strcmp(ev->keyname, "Right")) || (!strcmp(ev->keyname, "KP_Right")))
83      {
84         x += step_x;
85      }
86    else if ((!strcmp(ev->keyname, "Up"))  || (!strcmp(ev->keyname, "KP_Up")))
87      {
88         y -= step_y;
89      }
90    else if ((!strcmp(ev->keyname, "Down")) || (!strcmp(ev->keyname, "KP_Down")))
91      {
92         y += step_y;
93      }
94    else if ((!strcmp(ev->keyname, "Home")) || (!strcmp(ev->keyname, "KP_Home")))
95      {
96         y = 0;
97      }
98    else if ((!strcmp(ev->keyname, "End")) || (!strcmp(ev->keyname, "KP_End")))
99      {
100         y = max_y - v_h;
101      }
102    else if ((!strcmp(ev->keyname, "Prior")) || (!strcmp(ev->keyname, "KP_Prior")))
103      {
104         if (page_y < 0)
105           y -= -(page_y * v_h) / 100;
106         else
107           y -= page_y;
108      }
109    else if ((!strcmp(ev->keyname, "Next")) || (!strcmp(ev->keyname, "KP_Next")))
110      {
111         if (page_y < 0)
112           y += -(page_y * v_h) / 100;
113         else
114           y += page_y;
115      }
116    else return EINA_FALSE;
117
118    ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
119    elm_smart_scroller_child_pos_set(wd->scr, x, y);
120    return EINA_TRUE;
121 }
122
123 static void
124 _on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
125 {
126    Widget_Data *wd = elm_widget_data_get(obj);
127    if (!wd) return;
128    if (elm_widget_focus_get(obj))
129      {
130         edje_object_signal_emit(wd->scr, "elm,action,focus", "elm");
131         evas_object_focus_set(wd->scr, EINA_TRUE);
132      }
133    else
134      {
135         edje_object_signal_emit(wd->scr, "elm,action,unfocus", "elm");
136         evas_object_focus_set(wd->scr, EINA_FALSE);
137      }
138 }
139
140 static void
141 _del_hook(Evas_Object *obj)
142 {
143    Widget_Data *wd = elm_widget_data_get(obj);
144    if (!wd) return;
145    free(wd);
146 }
147
148 static void
149 _mirrored_set(Evas_Object *obj, Eina_Bool mirrored)
150 {
151    Widget_Data *wd = elm_widget_data_get(obj);
152    if (!wd) return;
153    if (wd->scr)
154      elm_smart_scroller_mirrored_set(wd->scr, mirrored);
155 }
156
157 static void
158 _theme_hook(Evas_Object *obj)
159 {
160    Widget_Data *wd = elm_widget_data_get(obj);
161    if (!wd) return;
162    _elm_widget_mirrored_reload(obj);
163    if (wd->scr)
164      {
165         Evas_Object *edj;
166         const char *str;
167
168         _mirrored_set(obj, elm_widget_mirrored_get(obj));
169         elm_smart_scroller_object_theme_set(obj, wd->scr,
170                                             wd->widget_name, wd->widget_base,
171                                             elm_widget_style_get(obj));
172         //        edje_object_scale_set(wd->scr, elm_widget_scale_get(obj) * _elm_config->scale);
173         edj = elm_smart_scroller_edje_object_get(wd->scr);
174         str = edje_object_data_get(edj, "focus_highlight");
175         if ((str) && (!strcmp(str, "on")))
176           elm_widget_highlight_in_theme_set(obj, EINA_TRUE);
177         else
178           elm_widget_highlight_in_theme_set(obj, EINA_FALSE);
179      }
180    _sizing_eval(obj);
181 }
182
183 static Eina_Bool
184 _elm_scroller_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
185 {
186    Widget_Data *wd = elm_widget_data_get(obj);
187    Evas_Object *cur;
188
189    if ((!wd) || (!wd->content))
190      return EINA_FALSE;
191
192    cur = wd->content;
193
194    /* Try Focus cycle in subitem */
195    if ((elm_widget_can_focus_get(cur)) || (elm_widget_child_can_focus_get(cur)))
196      return elm_widget_focus_next_get(cur, dir, next);
197
198    /* Return */
199    *next = (Evas_Object *)obj;
200    return !elm_widget_focus_get(obj);
201 }
202
203 static void
204 _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
205 {
206    Widget_Data *wd = elm_widget_data_get(obj);
207    if (!wd) return;
208    edje_object_signal_emit(elm_smart_scroller_edje_object_get(wd->scr),
209                            emission, source);
210 }
211
212 static void
213 _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
214 {
215    Widget_Data *wd = elm_widget_data_get(obj);
216    if (!wd) return;
217    edje_object_signal_callback_add(elm_smart_scroller_edje_object_get(wd->scr),
218                                    emission, source, func_cb, data);
219 }
220
221 static void
222 _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
223 {
224    Widget_Data *wd = elm_widget_data_get(obj);
225    edje_object_signal_callback_del_full(
226       elm_smart_scroller_edje_object_get(wd->scr), emission, source,
227       func_cb, data);
228 }
229
230 static void
231 _show_region_hook(void *data, Evas_Object *obj)
232 {
233    Widget_Data *wd = elm_widget_data_get(data);
234    Evas_Coord x, y, w, h;
235    if (!wd) return;
236    elm_widget_show_region_get(obj, &x, &y, &w, &h);
237    if (wd->scr)
238      elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
239 }
240
241 static void
242 _focus_region_hook(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
243 {
244    Widget_Data *wd = elm_widget_data_get(obj);
245    if (wd->scr)
246      elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
247 }
248
249 static void
250 _sizing_eval(Evas_Object *obj)
251 {
252    Widget_Data *wd = elm_widget_data_get(obj);
253    Evas_Coord  vw, vh, minw = 0, minh = 0, maxw = 0, maxh = 0, w, h, vmw, vmh;
254    double xw = 0.0, yw = 0.0;
255
256    if (!wd) return;
257    if (wd->content)
258      {
259         evas_object_size_hint_min_get(wd->content, &minw, &minh);
260         evas_object_size_hint_max_get(wd->content, &maxw, &maxh);
261         evas_object_size_hint_weight_get(wd->content, &xw, &yw);
262      }
263    if (wd->scr)
264      {
265         elm_smart_scroller_child_viewport_size_get(wd->scr, &vw, &vh);
266         if (xw > 0.0)
267           {
268              if ((minw > 0) && (vw < minw)) vw = minw;
269              else if ((maxw > 0) && (vw > maxw)) vw = maxw;
270           }
271         else if (minw > 0) vw = minw;
272         if (yw > 0.0)
273           {
274              if ((minh > 0) && (vh < minh)) vh = minh;
275              else if ((maxh > 0) && (vh > maxh)) vh = maxh;
276           }
277         else if (minh > 0) vh = minh;
278         if (wd->content) evas_object_resize(wd->content, vw, vh);
279         w = -1;
280         h = -1;
281         edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &vmw, &vmh);
282         if (wd->min_w) w = vmw + minw;
283         if (wd->min_h) h = vmh + minh;
284         evas_object_size_hint_max_get(obj, &maxw, &maxh);
285         if ((maxw > 0) && (w > maxw)) w = maxw;
286         if ((maxh > 0) && (h > maxh)) h = maxh;
287         evas_object_size_hint_min_set(obj, w, h);
288      }
289 }
290
291 static void
292 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
293 {
294    _sizing_eval(data);
295 }
296
297 static void
298 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
299 {
300    Widget_Data *wd = elm_widget_data_get(obj);
301    Evas_Object *sub = event_info;
302
303    if (!wd) return;
304    if (sub == wd->content)
305      {
306         elm_widget_on_show_region_hook_set(wd->content, NULL, NULL);
307         evas_object_event_callback_del_full (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
308                                              _changed_size_hints, obj);
309         wd->content = NULL;
310         _sizing_eval(obj);
311      }
312    else if (sub == wd->scr)
313      wd->scr = NULL;
314 }
315
316 static void
317 _hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
318 {
319    Widget_Data *wd = elm_widget_data_get(obj);
320
321    if (!wd) return;
322    if (wd->scr)
323      elm_smart_scroller_hold_set(wd->scr, 1);
324 }
325
326 static void
327 _hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
328 {
329    Widget_Data *wd = elm_widget_data_get(obj);
330
331    if (!wd) return;
332    if (wd->scr)
333      elm_smart_scroller_hold_set(wd->scr, 0);
334 }
335
336 static void
337 _freeze_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
338 {
339    Widget_Data *wd = elm_widget_data_get(obj);
340
341    if (!wd) return;
342    if (wd->scr)
343      elm_smart_scroller_freeze_set(wd->scr, 1);
344 }
345
346 static void
347 _freeze_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
348 {
349    Widget_Data *wd = elm_widget_data_get(obj);
350
351    if (!wd) return;
352    if (wd->scr)
353      elm_smart_scroller_freeze_set(wd->scr, 0);
354 }
355
356 static void
357 _resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
358 {
359    _sizing_eval(data);
360 }
361
362 static void
363 _edge_left(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
364 {
365    evas_object_smart_callback_call(data, SIG_EDGE_LEFT, NULL);
366 }
367
368 static void
369 _edge_right(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
370 {
371    evas_object_smart_callback_call(data, SIG_EDGE_RIGHT, NULL);
372 }
373
374 static void
375 _edge_top(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
376 {
377    evas_object_smart_callback_call(data, SIG_EDGE_TOP, NULL);
378 }
379
380 static void
381 _edge_bottom(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
382 {
383    evas_object_smart_callback_call(data, SIG_EDGE_BOTTOM, NULL);
384 }
385
386 static void
387 _scroll(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
388 {
389    evas_object_smart_callback_call(data, SIG_SCROLL, NULL);
390 }
391
392 static void
393 _scroll_anim_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
394 {
395    evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_START, NULL);
396 }
397
398 static void
399 _scroll_anim_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
400 {
401    evas_object_smart_callback_call(data, SIG_SCROLL_ANIM_STOP, NULL);
402 }
403
404 static void
405 _scroll_drag_start(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
406 {
407    evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_START, NULL);
408 }
409
410 static void
411 _scroll_drag_stop(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
412 {
413    evas_object_smart_callback_call(data, SIG_SCROLL_DRAG_STOP, NULL);
414 }
415
416 EAPI Evas_Object *
417 elm_scroller_add(Evas_Object *parent)
418 {
419    Evas_Object *obj;
420    Evas *e;
421    Widget_Data *wd;
422    Evas_Coord minw, minh;
423
424    ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
425
426    ELM_SET_WIDTYPE(widtype, "scroller");
427    elm_widget_type_set(obj, "scroller");
428    elm_widget_sub_object_add(parent, obj);
429    elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
430    elm_widget_data_set(obj, wd);
431    elm_widget_del_hook_set(obj, _del_hook);
432    elm_widget_theme_hook_set(obj, _theme_hook);
433    elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
434    elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
435    elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
436    elm_widget_focus_next_hook_set(obj, _elm_scroller_focus_next_hook);
437    elm_widget_can_focus_set(obj, EINA_TRUE);
438    elm_widget_event_hook_set(obj, _event_hook);
439    elm_widget_focus_region_hook_set(obj, _focus_region_hook);
440
441    wd->widget_name = eina_stringshare_add("scroller");
442    wd->widget_base = eina_stringshare_add("base");
443
444    wd->scr = elm_smart_scroller_add(e);
445    elm_smart_scroller_widget_set(wd->scr, obj);
446    _theme_hook(obj);
447    elm_widget_resize_object_set(obj, wd->scr);
448    evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
449                                   _changed_size_hints, obj);
450
451    edje_object_size_min_calc(elm_smart_scroller_edje_object_get(wd->scr), &minw, &minh);
452    evas_object_size_hint_min_set(obj, minw, minh);
453    evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, obj);
454
455    evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
456    evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
457    evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
458    evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
459    evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
460
461    evas_object_smart_callback_add(wd->scr, "edge,left", _edge_left, obj);
462    evas_object_smart_callback_add(wd->scr, "edge,right", _edge_right, obj);
463    evas_object_smart_callback_add(wd->scr, "edge,top", _edge_top, obj);
464    evas_object_smart_callback_add(wd->scr, "edge,bottom", _edge_bottom, obj);
465    evas_object_smart_callback_add(wd->scr, "scroll", _scroll, obj);
466    evas_object_smart_callback_add(wd->scr, "animate,start", _scroll_anim_start, obj);
467    evas_object_smart_callback_add(wd->scr, "animate,stop", _scroll_anim_stop, obj);
468    evas_object_smart_callback_add(wd->scr, "drag,start", _scroll_drag_start, obj);
469    evas_object_smart_callback_add(wd->scr, "drag,stop", _scroll_drag_stop, obj);
470
471    _sizing_eval(obj);
472
473    // TODO: convert Elementary to subclassing of Evas_Smart_Class
474    // TODO: and save some bytes, making descriptions per-class and not instance!
475    evas_object_smart_callbacks_descriptions_set(obj, _signals);
476    _mirrored_set(obj, elm_widget_mirrored_get(obj));
477    return obj;
478 }
479
480 Evas_Object *
481 _elm_scroller_edje_object_get(Evas_Object *obj)
482 {
483    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
484    Widget_Data *wd = elm_widget_data_get(obj);
485    if (!wd) return NULL;
486    return elm_smart_scroller_edje_object_get(wd->scr);
487 }
488
489 EAPI void
490 elm_scroller_content_set(Evas_Object *obj, Evas_Object *content)
491 {
492    ELM_CHECK_WIDTYPE(obj, widtype);
493    Widget_Data *wd = elm_widget_data_get(obj);
494    if (!wd) return;
495    if (wd->content == content) return;
496    if (wd->content) evas_object_del(wd->content);
497    wd->content = content;
498    if (content)
499      {
500         elm_widget_on_show_region_hook_set(content, _show_region_hook, obj);
501         elm_widget_sub_object_add(obj, content);
502         if (wd->scr)
503           elm_smart_scroller_child_set(wd->scr, content);
504         evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
505                                        _changed_size_hints, obj);
506      }
507    _sizing_eval(obj);
508 }
509
510 EAPI Evas_Object *
511 elm_scroller_content_get(const Evas_Object *obj)
512 {
513    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
514    Widget_Data *wd = elm_widget_data_get(obj);
515    if (!wd) return NULL;
516    return wd->content;
517 }
518
519 EAPI Evas_Object *
520 elm_scroller_content_unset(Evas_Object *obj)
521 {
522    ELM_CHECK_WIDTYPE(obj, widtype) NULL;
523    Widget_Data *wd = elm_widget_data_get(obj);
524    Evas_Object *content;
525    if (!wd) return NULL;
526    if (!wd->content) return NULL;
527    content = wd->content;
528    elm_widget_sub_object_del(obj, wd->content);
529    edje_object_part_unswallow(wd->scr, wd->content);
530    wd->content = NULL;
531    return content;
532 }
533
534 EAPI void
535 elm_scroller_custom_widget_base_theme_set(Evas_Object *obj, const char *widget, const char *base)
536 {
537    ELM_CHECK_WIDTYPE(obj, widtype);
538    Widget_Data *wd = elm_widget_data_get(obj);
539    if (!wd) return;
540    EINA_SAFETY_ON_NULL_RETURN(widget);
541    EINA_SAFETY_ON_NULL_RETURN(base);
542    if (eina_stringshare_replace(&wd->widget_name, widget) |
543        eina_stringshare_replace(&wd->widget_base, base))
544      _theme_hook(obj);
545 }
546
547 EAPI void
548 elm_scroller_content_min_limit(Evas_Object *obj, Eina_Bool w, Eina_Bool h)
549 {
550    ELM_CHECK_WIDTYPE(obj, widtype);
551    Widget_Data *wd = elm_widget_data_get(obj);
552    if (!wd) return;
553    wd->min_w = w;
554    wd->min_h = h;
555    _sizing_eval(obj);
556 }
557
558 EAPI void
559 elm_scroller_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
560 {
561    ELM_CHECK_WIDTYPE(obj, widtype);
562    Widget_Data *wd = elm_widget_data_get(obj);
563    if ((!wd) || (!wd->scr)) return;
564    elm_smart_scroller_child_region_show(wd->scr, x, y, w, h);
565 }
566
567 EAPI void
568 elm_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v)
569 {
570    ELM_CHECK_WIDTYPE(obj, widtype);
571    Widget_Data *wd = elm_widget_data_get(obj);
572    const Elm_Scroller_Policy map[3] =
573      {
574         ELM_SMART_SCROLLER_POLICY_AUTO,
575         ELM_SMART_SCROLLER_POLICY_ON,
576         ELM_SMART_SCROLLER_POLICY_OFF
577      };
578    if ((!wd) || (!wd->scr)) return;
579    if ((policy_h >= 3) || (policy_v >= 3)) return;
580    elm_smart_scroller_policy_set(wd->scr, map[policy_h], map[policy_v]);
581 }
582
583 EAPI void
584 elm_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v)
585 {
586    ELM_CHECK_WIDTYPE(obj, widtype);
587    Widget_Data *wd = elm_widget_data_get(obj);
588    if ((!wd) || (!wd->scr)) return;
589    elm_smart_scroller_policy_get(wd->scr,
590                                  (Elm_Smart_Scroller_Policy *) policy_h,
591                                  (Elm_Smart_Scroller_Policy *) policy_v);
592 }
593
594 EAPI void
595 elm_scroller_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
596 {
597    ELM_CHECK_WIDTYPE(obj, widtype);
598    Widget_Data *wd = elm_widget_data_get(obj);
599    if ((!wd) || (!wd->scr)) return;
600    if ((x) || (y)) elm_smart_scroller_child_pos_get(wd->scr, x, y);
601    if ((w) || (h)) elm_smart_scroller_child_viewport_size_get(wd->scr, w, h);
602 }
603
604 EAPI void
605 elm_scroller_child_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h)
606 {
607    ELM_CHECK_WIDTYPE(obj, widtype);
608    Widget_Data *wd = elm_widget_data_get(obj);
609    if (!wd) return;
610    evas_object_geometry_get(wd->content, NULL, NULL, w, h);
611 }
612
613 EAPI void
614 elm_scroller_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce)
615 {
616    ELM_CHECK_WIDTYPE(obj, widtype);
617    Widget_Data *wd = elm_widget_data_get(obj);
618    if ((!wd) || (!wd->scr)) return;
619    elm_smart_scroller_bounce_allow_set(wd->scr, h_bounce, v_bounce);
620 }
621
622 EAPI void
623 elm_scroller_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce)
624 {
625    ELM_CHECK_WIDTYPE(obj, widtype);
626    Widget_Data *wd = elm_widget_data_get(obj);
627    if (!wd) return;
628    elm_smart_scroller_bounce_allow_get(wd->scr, h_bounce, v_bounce);
629 }
630
631 EAPI void
632 elm_scroller_page_relative_set(Evas_Object *obj, double h_pagerel, double v_pagerel)
633 {
634    ELM_CHECK_WIDTYPE(obj, widtype);
635    Widget_Data *wd = elm_widget_data_get(obj);
636    if (!wd) return;
637    wd->pagerel_h = h_pagerel;
638    wd->pagerel_v = v_pagerel;
639    if (wd->scr)
640      elm_smart_scroller_paging_set(wd->scr, wd->pagerel_h, wd->pagerel_v,
641                                    wd->pagesize_h, wd->pagesize_v);
642 }
643
644 EAPI void
645 elm_scroller_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize)
646 {
647    ELM_CHECK_WIDTYPE(obj, widtype);
648    Widget_Data *wd = elm_widget_data_get(obj);
649    if (!wd) return;
650    wd->pagesize_h = h_pagesize;
651    wd->pagesize_v = v_pagesize;
652    if (wd->scr)
653      elm_smart_scroller_paging_set(wd->scr, wd->pagerel_h, wd->pagerel_v,
654                                    wd->pagesize_h, wd->pagesize_v);
655 }
656
657 EAPI void
658 elm_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
659 {
660    ELM_CHECK_WIDTYPE(obj, widtype);
661    Widget_Data *wd = elm_widget_data_get(obj);
662    if ((!wd) || (!wd->scr)) return;
663    elm_smart_scroller_region_bring_in(wd->scr, x, y, w, h);
664 }
665
666 EAPI void
667 elm_scroller_propagate_events_set(Evas_Object *obj, Eina_Bool propagation)
668 {
669    ELM_CHECK_WIDTYPE(obj, widtype);
670    Widget_Data *wd = elm_widget_data_get(obj);
671    if (!wd) return;
672
673    elm_smart_scroller_propagate_events_set(wd->scr, propagation);
674 }
675
676 EAPI Eina_Bool
677 elm_scroller_propagate_events_get(const Evas_Object *obj)
678 {
679    ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
680    Widget_Data *wd = elm_widget_data_get(obj);
681    if (!wd) return EINA_FALSE;
682
683    return elm_smart_scroller_propagate_events_get(wd->scr);
684 }
685
686 EAPI void
687 elm_scroller_gravity_set(Evas_Object *obj, double x, double y)
688 {
689    ELM_CHECK_WIDTYPE(obj, widtype);
690    Widget_Data *wd = elm_widget_data_get(obj);
691    if (!wd) return;
692
693    elm_smart_scroller_gravity_set(wd->scr, x, y);
694 }
695
696 EAPI void
697 elm_scroller_gravity_get(const Evas_Object *obj, double *x, double *y)
698 {
699    ELM_CHECK_WIDTYPE(obj, widtype);
700    Widget_Data *wd = elm_widget_data_get(obj);
701    if (!wd) return;
702
703    elm_smart_scroller_gravity_get(wd->scr, x, y);
704 }
705
706 EAPI void
707 elm_scroller_page_move_set(Evas_Object *obj, Eina_Bool set)
708 {
709    return ;
710 }