2 * @defgroup Scroller Scroller
5 * @image html scroller_inheritance_tree.png
6 * @image latex scroller_inheritance_tree.eps
8 * A scroller holds (and clips) a single object and "scrolls it
9 * around". This means that it allows the user to use a scroll bar (or
10 * a finger) to drag the viewable region around, moving through a much
11 * larger object that is contained in the scroller. The scroller will
12 * always have a small minimum size by default as it won't be limited
13 * by the contents of the scroller.
15 * This widget inherits from the @ref Layout one, so that all the
16 * functions acting on it also work for scroller objects.
18 * This widget emits the following signals, besides the ones sent from
19 * @li @c "edge,left" - the left edge of the content has been reached
20 * @li @c "edge,right" - the right edge of the content has been reached
21 * @li @c "edge,top" - the top edge of the content has been reached
22 * @li @c "edge,bottom" - the bottom edge of the content has been reached
23 * @li @c "scroll" - the content has been scrolled (moved)
24 * @li @c "scroll,anim,start" - scrolling animation has started
25 * @li @c "scroll,anim,stop" - scrolling animation has stopped
26 * @li @c "scroll,drag,start" - dragging the contents around has started
27 * @li @c "scroll,drag,stop" - dragging the contents around has stopped
29 * This widget implements the @ref elm-scrollable-interface interface.
30 * Its (non-deprecated) API functions, except for elm_scroller_add(),
31 * which gives basic scroller objects, are meant to be a basis for all
32 * other scrollable widgets (i.e. widgets implementing @ref
33 * elm-scrollable-interface). So, they will work both on pristine
34 * scroller widgets and on other "specialized" scrollable widgets.
36 * @note The @c "scroll,anim,*" and @c "scroll,drag,*" signals are
37 * only emitted by user intervention.
39 * @note When Elementary is under its default profile and theme (meant
40 * for touch interfaces), scroll bars will @b not be draggable --
41 * their function is merely to indicate how much has been scrolled.
43 * @note When Elementary is under its desktop/standard profile and
44 * theme, the thumb scroll (a.k.a. finger scroll) won't work.
46 * Default content parts of the scroller widget that you can use are:
47 * @li @c "default" - Content of the scroller
49 * In @ref tutorial_scroller you'll find an example on how to use most
55 * @brief Type that controls when scrollbars should appear.
57 * @see elm_scroller_policy_set()
61 ELM_SCROLLER_POLICY_AUTO = 0, /**< Show scrollbars as needed */
62 ELM_SCROLLER_POLICY_ON, /**< Always show scrollbars */
63 ELM_SCROLLER_POLICY_OFF, /**< Never show scrollbars */
64 ELM_SCROLLER_POLICY_LAST
65 } Elm_Scroller_Policy;
68 * @brief Type that controls how the content is scrolled.
70 * @see elm_scroller_single_direction_set()
74 ELM_SCROLLER_SINGLE_DIRECTION_NONE = 0, /**< Scroll every direction */
75 ELM_SCROLLER_SINGLE_DIRECTION_SOFT, /**< Scroll single direction if the direction is certain*/
76 ELM_SCROLLER_SINGLE_DIRECTION_HARD, /**< Scroll only single direction */
77 ELM_SCROLLER_SINGLE_DIRECTION_LAST
78 } Elm_Scroller_Single_Direction;
81 * @brief Add a new scroller to the parent
83 * @param parent The parent object
84 * @return The new object or NULL if it cannot be created
88 EAPI Evas_Object *elm_scroller_add(Evas_Object *parent);
91 * @brief Set custom theme elements for the scroller
93 * @param obj The scroller object
94 * @param widget The widget name to use (default is "scroller")
95 * @param base The base name to use (default is "base")
97 * @deprecated Use elm_layout_theme_set() instead.
101 EINA_DEPRECATED EAPI void elm_scroller_custom_widget_base_theme_set(Evas_Object *obj, const char *widget, const char *base);
104 * @brief Make the scroller minimum size limited to the minimum size of the content
106 * @param obj The scroller object
107 * @param w Enable limiting minimum size horizontally
108 * @param h Enable limiting minimum size vertically
110 * By default the scroller will be as small as its design allows,
111 * irrespective of its content. This will make the scroller minimum size the
112 * right size horizontally and/or vertically to perfectly fit its content in
117 EAPI void elm_scroller_content_min_limit(Evas_Object *obj, Eina_Bool w, Eina_Bool h);
120 * @brief Show a specific virtual region within the scroller content object
122 * @param obj The scroller object
123 * @param x X coordinate of the region
124 * @param y Y coordinate of the region
125 * @param w Width of the region
126 * @param h Height of the region
128 * This will ensure all (or part if it does not fit) of the designated
129 * region in the virtual content object (0, 0 starting at the top-left of the
130 * virtual content object) is shown within the scroller.
134 EAPI void elm_scroller_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
137 * @brief Set the scrollbar visibility policy
139 * @param obj The scroller object
140 * @param policy_h Horizontal scrollbar policy
141 * @param policy_v Vertical scrollbar policy
143 * This sets the scrollbar visibility policy for the given scroller.
144 * ELM_SCROLLER_POLICY_AUTO means the scrollbar is made visible if it is
145 * needed, and otherwise kept hidden. ELM_SCROLLER_POLICY_ON turns it on all
146 * the time, and ELM_SCROLLER_POLICY_OFF always keeps it off. This applies
147 * respectively for the horizontal and vertical scrollbars.
151 EAPI void elm_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v);
154 * @brief Gets scrollbar visibility policy
156 * @param obj The scroller object
157 * @param policy_h Horizontal scrollbar policy
158 * @param policy_v Vertical scrollbar policy
160 * @see elm_scroller_policy_set()
164 EAPI void elm_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v);
167 * @brief Set the type of single direction scroll
169 * @param obj The scroller object
170 * @param single_dir The type of single direction
172 * @see elm_scroller_single_direction_get()
178 EAPI void elm_scroller_single_direction_set(Evas_Object *obj, Elm_Scroller_Single_Direction single_dir);
181 * @brief Get the type of single direction scroll
183 * @param obj The scroller object
184 * @return the type of single direction
186 * @see elm_scroller_single_direction_get()
192 EAPI Elm_Scroller_Single_Direction elm_scroller_single_direction_get(const Evas_Object *obj);
195 * @brief Get the currently visible content region
197 * @param obj The scroller object
198 * @param x X coordinate of the region
199 * @param y Y coordinate of the region
200 * @param w Width of the region
201 * @param h Height of the region
203 * This gets the current region in the content object that is visible through
204 * the scroller. The region co-ordinates are returned in the @p x, @p y, @p
205 * w, @p h values pointed to.
207 * @note All coordinates are relative to the content.
209 * @see elm_scroller_region_show()
213 EAPI void elm_scroller_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
216 * @brief Get the size of the content object
218 * @param obj The scroller object
219 * @param w Width of the content object.
220 * @param h Height of the content object.
222 * This gets the size of the content object of the scroller.
226 EAPI void elm_scroller_child_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
229 * @brief Set bouncing behavior
231 * @param obj The scroller object
232 * @param h_bounce Allow bounce horizontally
233 * @param v_bounce Allow bounce vertically
235 * When scrolling, the scroller may "bounce" when reaching an edge of the
236 * content object. This is a visual way to indicate the end has been reached.
237 * This is enabled by default for both axis. This API will set if it is enabled
238 * for the given axis with the boolean parameters for each axis.
242 EAPI void elm_scroller_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce);
245 * @brief Get the bounce behaviour
247 * @param obj The Scroller object
248 * @param h_bounce Will the scroller bounce horizontally or not
249 * @param v_bounce Will the scroller bounce vertically or not
251 * @see elm_scroller_bounce_set()
255 EAPI void elm_scroller_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce);
258 * @brief Set scroll page size relative to viewport size.
260 * @param obj The scroller object
261 * @param h_pagerel The horizontal page relative size
262 * @param v_pagerel The vertical page relative size
264 * The scroller is capable of limiting scrolling by the user to "pages". That
265 * is to jump by and only show a "whole page" at a time as if the continuous
266 * area of the scroller content is split into page sized pieces. This sets
267 * the size of a page relative to the viewport of the scroller. 1.0 is "1
268 * viewport" is size (horizontally or vertically). 0.0 turns it off in that
269 * axis. This is mutually exclusive with page size
270 * (see elm_scroller_page_size_set() for more information). Likewise 0.5
271 * is "half a viewport". Sane usable values are normally between 0.0 and 1.0
272 * including 1.0. If you only want 1 axis to be page "limited", use 0.0 for
277 EAPI void elm_scroller_page_relative_set(Evas_Object *obj, double h_pagerel, double v_pagerel);
280 * Get a given scroller widget's scrolling page size, relative to
283 * @param obj The scroller object
284 * @param h_pagerel Pointer to a variable where to store the
285 * horizontal page (relative) size
286 * @param v_pagerel Pointer to a variable where to store the
287 * vertical page (relative) size
289 * @see elm_scroller_page_relative_set() for more details
295 EAPI void elm_scroller_page_relative_get(const Evas_Object *obj, double *h_pagerel, double *v_pagerel);
298 * @brief Set scroll page size.
300 * @param obj The scroller object
301 * @param h_pagesize The horizontal page size
302 * @param v_pagesize The vertical page size
304 * This sets the page size to an absolute fixed value, with 0 turning it off
307 * @see elm_scroller_page_relative_set()
308 * @see elm_scroller_page_size_get()
312 EAPI void elm_scroller_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize);
315 * @brief Retrieve a scroller widget's current page size.
317 * @param obj The scroller object
318 * @param h_pagesize Where to store its horizontal page size
319 * @param v_pagesize Where to store its vertical page size
321 * @see elm_scroller_page_size_set() for more details
322 * @see elm_scroller_page_relative_set()
328 EAPI void elm_scroller_page_size_get(const Evas_Object *obj, Evas_Coord *h_pagesize, Evas_Coord *v_pagesize);
331 * @brief Set the maxium of the movable page at a flicking.
333 * @param obj The scroller object
334 * @param page_limit_h The maxium of the movable horizontal page
335 * @param page_limit_v The maxium of the movable vertical page
337 * The value of maxium movable page should be more than 1.
339 * @see elm_scroller_page_scroll_limit_get()
345 EAPI void elm_scroller_page_scroll_limit_set(Evas_Object *obj, int page_limit_h, int page_limit_v);
348 * @brief Get the maxium of the movable page at a flicking.
350 * @param obj The scroller object
351 * @param page_limit_h The maxium of the movable horizontal page
352 * @param page_limit_v The maxium of the movable vertical page
355 * @see elm_scroller_page_scroll_limit_set()
361 EAPI void elm_scroller_page_scroll_limit_get(Evas_Object *obj, int *page_limit_h, int *page_limit_v);
364 * @brief Get scroll current page number.
366 * @param obj The scroller object
367 * @param h_pagenumber The horizontal page number
368 * @param v_pagenumber The vertical page number
370 * The page number starts from 0. 0 is the first page.
371 * Current page means the page which meets the top-left of the viewport.
372 * If there are two or more pages in the viewport, it returns the number of the page
373 * which meets the top-left of the viewport.
375 * @see elm_scroller_last_page_get()
376 * @see elm_scroller_page_show()
377 * @see elm_scroller_page_bring_in()
381 EAPI void elm_scroller_current_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber);
384 * @brief Get scroll last page number.
386 * @param obj The scroller object
387 * @param h_pagenumber The horizontal page number
388 * @param v_pagenumber The vertical page number
390 * The page number starts from 0. 0 is the first page.
391 * This returns the last page number among the pages.
393 * @see elm_scroller_current_page_get()
394 * @see elm_scroller_page_show()
395 * @see elm_scroller_page_bring_in()
399 EAPI void elm_scroller_last_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber);
402 * Show a specific virtual region within the scroller content object by page number.
404 * @param obj The scroller object
405 * @param h_pagenumber The horizontal page number
406 * @param v_pagenumber The vertical page number
408 * 0, 0 of the indicated page is located at the top-left of the viewport.
409 * This will jump to the page directly without animation.
414 * sc = elm_scroller_add(win);
415 * elm_object_content_set(sc, content);
416 * elm_scroller_page_relative_set(sc, 1, 0);
417 * elm_scroller_current_page_get(sc, &h_page, &v_page);
418 * elm_scroller_page_show(sc, h_page + 1, v_page);
421 * @see elm_scroller_page_bring_in()
425 EAPI void elm_scroller_page_show(Evas_Object *obj, int h_pagenumber, int v_pagenumber);
428 * Show a specific virtual region within the scroller content object by page number.
430 * @param obj The scroller object
431 * @param h_pagenumber The horizontal page number
432 * @param v_pagenumber The vertical page number
434 * 0, 0 of the indicated page is located at the top-left of the viewport.
435 * This will slide to the page with animation.
440 * sc = elm_scroller_add(win);
441 * elm_object_content_set(sc, content);
442 * elm_scroller_page_relative_set(sc, 1, 0);
443 * elm_scroller_last_page_get(sc, &h_page, &v_page);
444 * elm_scroller_page_bring_in(sc, h_page, v_page);
447 * @see elm_scroller_page_show()
451 EAPI void elm_scroller_page_bring_in(Evas_Object *obj, int h_pagenumber, int v_pagenumber);
454 * @brief Show a specific virtual region within the scroller content object.
456 * @param obj The scroller object
457 * @param x X coordinate of the region
458 * @param y Y coordinate of the region
459 * @param w Width of the region
460 * @param h Height of the region
462 * This will ensure all (or part if it does not fit) of the designated
463 * region in the virtual content object (0, 0 starting at the top-left of the
464 * virtual content object) is shown within the scroller. Unlike
465 * elm_scroller_region_show(), this allow the scroller to "smoothly slide"
466 * to this location (if configuration in general calls for transitions). It
467 * may not jump immediately to the new location and make take a while and
468 * show other content along the way.
470 * @see elm_scroller_region_show()
474 EAPI void elm_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
477 * @brief Set event propagation on a scroller
479 * @param obj The scroller object
480 * @param propagation If propagation is enabled or not
482 * This enables or disables event propagation from the scroller
483 * content to the scroller and its parent. By default event
484 * propagation is @b enabled.
488 EAPI void elm_scroller_propagate_events_set(Evas_Object *obj, Eina_Bool propagation);
491 * @brief Get event propagation for a scroller
493 * @param obj The scroller object
494 * @return The propagation state
496 * This gets the event propagation for a scroller.
498 * @see elm_scroller_propagate_events_set()
502 EAPI Eina_Bool elm_scroller_propagate_events_get(const Evas_Object *obj);
505 * @brief Set scrolling gravity on a scroller
507 * @param obj The scroller object
508 * @param x The scrolling horizontal gravity
509 * @param y The scrolling vertical gravity
511 * The gravity, defines how the scroller will adjust its view
512 * when the size of the scroller contents increase.
514 * The scroller will adjust the view to glue itself as follows.
516 * x=0.0, for showing the left most region of the content.
517 * x=1.0, for showing the right most region of the content.
518 * y=0.0, for showing the bottom most region of the content.
519 * y=1.0, for showing the top most region of the content.
521 * Default values for x and y are 0.0
525 EAPI void elm_scroller_gravity_set(Evas_Object *obj, double x, double y);
528 * @brief Get scrolling gravity values for a scroller
530 * @param obj The scroller object
531 * @param x The scrolling horizontal gravity
532 * @param y The scrolling vertical gravity
534 * This gets gravity values for a scroller.
536 * @see elm_scroller_gravity_set()
540 EAPI void elm_scroller_gravity_get(const Evas_Object *obj, double *x, double *y);
543 * @brief Set the infinite loop for a scroller
545 * @param obj The scroller object
546 * @param loop_h The scrolling horizontal loop
547 * @param loop_v The scrolling vertical loop
549 * This sets infinite loop for a scroller.
555 EAPI void elm_scroller_loop_set(Evas_Object *obj, Eina_Bool loop_h, Eina_Bool loop_v);
558 * @brief Get the infinite loop for a scroller
560 * @param obj The scroller object
561 * @param loop_h The scrolling horizontal loop
562 * @param loop_v The scrolling vertical loop
564 * This gets infinite loop for a scroller.
566 * @see elm_scroller_loop_set()
573 EAPI void elm_scroller_loop_get(const Evas_Object *obj, Eina_Bool *loop_h, Eina_Bool *loop_v);