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 EAPI void elm_scroller_origin_reverse_set(Evas_Object *obj, Eina_Bool origin_x, Eina_Bool origin_y);
259 EAPI void elm_scroller_origin_reverse_get(Evas_Object *obj, Eina_Bool *origin_x, Eina_Bool *origin_y);
261 * @brief Set scroll page size relative to viewport size.
263 * @param obj The scroller object
264 * @param h_pagerel The horizontal page relative size
265 * @param v_pagerel The vertical page relative size
267 * The scroller is capable of limiting scrolling by the user to "pages". That
268 * is to jump by and only show a "whole page" at a time as if the continuous
269 * area of the scroller content is split into page sized pieces. This sets
270 * the size of a page relative to the viewport of the scroller. 1.0 is "1
271 * viewport" is size (horizontally or vertically). 0.0 turns it off in that
272 * axis. This is mutually exclusive with page size
273 * (see elm_scroller_page_size_set() for more information). Likewise 0.5
274 * is "half a viewport". Sane usable values are normally between 0.0 and 1.0
275 * including 1.0. If you only want 1 axis to be page "limited", use 0.0 for
280 EAPI void elm_scroller_page_relative_set(Evas_Object *obj, double h_pagerel, double v_pagerel);
283 * Get a given scroller widget's scrolling page size, relative to
286 * @param obj The scroller object
287 * @param h_pagerel Pointer to a variable where to store the
288 * horizontal page (relative) size
289 * @param v_pagerel Pointer to a variable where to store the
290 * vertical page (relative) size
292 * @see elm_scroller_page_relative_set() for more details
298 EAPI void elm_scroller_page_relative_get(const Evas_Object *obj, double *h_pagerel, double *v_pagerel);
301 * @brief Set scroll page size.
303 * @param obj The scroller object
304 * @param h_pagesize The horizontal page size
305 * @param v_pagesize The vertical page size
307 * This sets the page size to an absolute fixed value, with 0 turning it off
310 * @see elm_scroller_page_relative_set()
311 * @see elm_scroller_page_size_get()
315 EAPI void elm_scroller_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize);
318 * @brief Retrieve a scroller widget's current page size.
320 * @param obj The scroller object
321 * @param h_pagesize Where to store its horizontal page size
322 * @param v_pagesize Where to store its vertical page size
324 * @see elm_scroller_page_size_set() for more details
325 * @see elm_scroller_page_relative_set()
331 EAPI void elm_scroller_page_size_get(const Evas_Object *obj, Evas_Coord *h_pagesize, Evas_Coord *v_pagesize);
334 * @brief Set the maxium of the movable page at a flicking.
336 * @param obj The scroller object
337 * @param page_limit_h The maxium of the movable horizontal page
338 * @param page_limit_v The maxium of the movable vertical page
340 * The value of maxium movable page should be more than 1.
342 * @see elm_scroller_page_scroll_limit_get()
348 EAPI void elm_scroller_page_scroll_limit_set(Evas_Object *obj, int page_limit_h, int page_limit_v);
351 * @brief Get the maxium of the movable page at a flicking.
353 * @param obj The scroller object
354 * @param page_limit_h The maxium of the movable horizontal page
355 * @param page_limit_v The maxium of the movable vertical page
358 * @see elm_scroller_page_scroll_limit_set()
364 EAPI void elm_scroller_page_scroll_limit_get(Evas_Object *obj, int *page_limit_h, int *page_limit_v);
367 * @brief Get scroll current page number.
369 * @param obj The scroller object
370 * @param h_pagenumber The horizontal page number
371 * @param v_pagenumber The vertical page number
373 * The page number starts from 0. 0 is the first page.
374 * Current page means the page which meets the top-left of the viewport.
375 * If there are two or more pages in the viewport, it returns the number of the page
376 * which meets the top-left of the viewport.
378 * @see elm_scroller_last_page_get()
379 * @see elm_scroller_page_show()
380 * @see elm_scroller_page_bring_in()
384 EAPI void elm_scroller_current_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber);
387 * @brief Get scroll last page number.
389 * @param obj The scroller object
390 * @param h_pagenumber The horizontal page number
391 * @param v_pagenumber The vertical page number
393 * The page number starts from 0. 0 is the first page.
394 * This returns the last page number among the pages.
396 * @see elm_scroller_current_page_get()
397 * @see elm_scroller_page_show()
398 * @see elm_scroller_page_bring_in()
402 EAPI void elm_scroller_last_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber);
405 * Show a specific virtual region within the scroller content object by page number.
407 * @param obj The scroller object
408 * @param h_pagenumber The horizontal page number
409 * @param v_pagenumber The vertical page number
411 * 0, 0 of the indicated page is located at the top-left of the viewport.
412 * This will jump to the page directly without animation.
417 * sc = elm_scroller_add(win);
418 * elm_object_content_set(sc, content);
419 * elm_scroller_page_relative_set(sc, 1, 0);
420 * elm_scroller_current_page_get(sc, &h_page, &v_page);
421 * elm_scroller_page_show(sc, h_page + 1, v_page);
424 * @see elm_scroller_page_bring_in()
428 EAPI void elm_scroller_page_show(Evas_Object *obj, int h_pagenumber, int v_pagenumber);
431 * Show a specific virtual region within the scroller content object by page number.
433 * @param obj The scroller object
434 * @param h_pagenumber The horizontal page number
435 * @param v_pagenumber The vertical page number
437 * 0, 0 of the indicated page is located at the top-left of the viewport.
438 * This will slide to the page with animation.
443 * sc = elm_scroller_add(win);
444 * elm_object_content_set(sc, content);
445 * elm_scroller_page_relative_set(sc, 1, 0);
446 * elm_scroller_last_page_get(sc, &h_page, &v_page);
447 * elm_scroller_page_bring_in(sc, h_page, v_page);
450 * @see elm_scroller_page_show()
454 EAPI void elm_scroller_page_bring_in(Evas_Object *obj, int h_pagenumber, int v_pagenumber);
457 * @brief Show a specific virtual region within the scroller content object.
459 * @param obj The scroller object
460 * @param x X coordinate of the region
461 * @param y Y coordinate of the region
462 * @param w Width of the region
463 * @param h Height of the region
465 * This will ensure all (or part if it does not fit) of the designated
466 * region in the virtual content object (0, 0 starting at the top-left of the
467 * virtual content object) is shown within the scroller. Unlike
468 * elm_scroller_region_show(), this allow the scroller to "smoothly slide"
469 * to this location (if configuration in general calls for transitions). It
470 * may not jump immediately to the new location and make take a while and
471 * show other content along the way.
473 * @see elm_scroller_region_show()
477 EAPI void elm_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
480 * @brief Set event propagation on a scroller
482 * @param obj The scroller object
483 * @param propagation If propagation is enabled or not
485 * This enables or disables event propagation from the scroller
486 * content to the scroller and its parent. By default event
487 * propagation is @b enabled.
491 EAPI void elm_scroller_propagate_events_set(Evas_Object *obj, Eina_Bool propagation);
494 * @brief Get event propagation for a scroller
496 * @param obj The scroller object
497 * @return The propagation state
499 * This gets the event propagation for a scroller.
501 * @see elm_scroller_propagate_events_set()
505 EAPI Eina_Bool elm_scroller_propagate_events_get(const Evas_Object *obj);
508 * @brief Set scrolling gravity on a scroller
510 * @param obj The scroller object
511 * @param x The scrolling horizontal gravity
512 * @param y The scrolling vertical gravity
514 * The gravity, defines how the scroller will adjust its view
515 * when the size of the scroller contents increase.
517 * The scroller will adjust the view to glue itself as follows.
519 * x=0.0, for showing the left most region of the content.
520 * x=1.0, for showing the right most region of the content.
521 * y=0.0, for showing the bottom most region of the content.
522 * y=1.0, for showing the top most region of the content.
524 * Default values for x and y are 0.0
528 EAPI void elm_scroller_gravity_set(Evas_Object *obj, double x, double y);
531 * @brief Get scrolling gravity values for a scroller
533 * @param obj The scroller object
534 * @param x The scrolling horizontal gravity
535 * @param y The scrolling vertical gravity
537 * This gets gravity values for a scroller.
539 * @see elm_scroller_gravity_set()
543 EAPI void elm_scroller_gravity_get(const Evas_Object *obj, double *x, double *y);
546 * @brief Set mouse wheel event on a scroller
548 * @param obj The scroller object
549 * @param disabled If wheel event is disabled or not
551 * This enables or disables mouse wheel event for scroller.
552 * By default mouse wheel event is enabled.
556 EAPI void elm_scroller_wheel_disabled_set(Evas_Object *obj, Eina_Bool disabled);
559 * @brief Get mouse wheel event for a scroller
561 * @param obj The scroller object
563 * This gets if wheel event is disabled or not.
565 * @see elm_scroller_wheel_disabled_set()
569 EAPI Eina_Bool elm_scroller_wheel_disabled_get(const Evas_Object *obj);
572 * @brief Set the infinite loop for a scroller
574 * @param obj The scroller object
575 * @param loop_h The scrolling horizontal loop
576 * @param loop_v The scrolling vertical loop
578 * This sets infinite loop for a scroller.
584 EAPI void elm_scroller_loop_set(Evas_Object *obj, Eina_Bool loop_h, Eina_Bool loop_v);
587 * @brief Get the infinite loop for a scroller
589 * @param obj The scroller object
590 * @param loop_h The scrolling horizontal loop
591 * @param loop_v The scrolling vertical loop
593 * This gets infinite loop for a scroller.
595 * @see elm_scroller_loop_set()
602 EAPI void elm_scroller_loop_get(const Evas_Object *obj, Eina_Bool *loop_h, Eina_Bool *loop_v);