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 Add a new scroller to the parent
70 * @param parent The parent object
71 * @return The new object or NULL if it cannot be created
75 EAPI Evas_Object *elm_scroller_add(Evas_Object *parent);
78 * @brief Set custom theme elements for the scroller
80 * @param obj The scroller object
81 * @param widget The widget name to use (default is "scroller")
82 * @param base The base name to use (default is "base")
84 * @deprecated Use elm_layout_theme_set() instead.
88 EINA_DEPRECATED EAPI void elm_scroller_custom_widget_base_theme_set(Evas_Object *obj, const char *widget, const char *base);
91 * @brief Make the scroller minimum size limited to the minimum size of the content
93 * @param obj The scroller object
94 * @param w Enable limiting minimum size horizontally
95 * @param h Enable limiting minimum size vertically
97 * By default the scroller will be as small as its design allows,
98 * irrespective of its content. This will make the scroller minimum size the
99 * right size horizontally and/or vertically to perfectly fit its content in
104 EAPI void elm_scroller_content_min_limit(Evas_Object *obj, Eina_Bool w, Eina_Bool h);
107 * @brief Show a specific virtual region within the scroller content object
109 * @param obj The scroller object
110 * @param x X coordinate of the region
111 * @param y Y coordinate of the region
112 * @param w Width of the region
113 * @param h Height of the region
115 * This will ensure all (or part if it does not fit) of the designated
116 * region in the virtual content object (0, 0 starting at the top-left of the
117 * virtual content object) is shown within the scroller.
121 EAPI void elm_scroller_region_show(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
124 * @brief Set the scrollbar visibility policy
126 * @param obj The scroller object
127 * @param policy_h Horizontal scrollbar policy
128 * @param policy_v Vertical scrollbar policy
130 * This sets the scrollbar visibility policy for the given scroller.
131 * ELM_SCROLLER_POLICY_AUTO means the scrollbar is made visible if it is
132 * needed, and otherwise kept hidden. ELM_SCROLLER_POLICY_ON turns it on all
133 * the time, and ELM_SCROLLER_POLICY_OFF always keeps it off. This applies
134 * respectively for the horizontal and vertical scrollbars.
138 EAPI void elm_scroller_policy_set(Evas_Object *obj, Elm_Scroller_Policy policy_h, Elm_Scroller_Policy policy_v);
141 * @brief Gets scrollbar visibility policy
143 * @param obj The scroller object
144 * @param policy_h Horizontal scrollbar policy
145 * @param policy_v Vertical scrollbar policy
147 * @see elm_scroller_policy_set()
151 EAPI void elm_scroller_policy_get(const Evas_Object *obj, Elm_Scroller_Policy *policy_h, Elm_Scroller_Policy *policy_v);
154 * @brief Get the currently visible content region
156 * @param obj The scroller object
157 * @param x X coordinate of the region
158 * @param y Y coordinate of the region
159 * @param w Width of the region
160 * @param h Height of the region
162 * This gets the current region in the content object that is visible through
163 * the scroller. The region co-ordinates are returned in the @p x, @p y, @p
164 * w, @p h values pointed to.
166 * @note All coordinates are relative to the content.
168 * @see elm_scroller_region_show()
172 EAPI void elm_scroller_region_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
175 * @brief Get the size of the content object
177 * @param obj The scroller object
178 * @param w Width of the content object.
179 * @param h Height of the content object.
181 * This gets the size of the content object of the scroller.
185 EAPI void elm_scroller_child_size_get(const Evas_Object *obj, Evas_Coord *w, Evas_Coord *h);
188 * @brief Set bouncing behavior
190 * @param obj The scroller object
191 * @param h_bounce Allow bounce horizontally
192 * @param v_bounce Allow bounce vertically
194 * When scrolling, the scroller may "bounce" when reaching an edge of the
195 * content object. This is a visual way to indicate the end has been reached.
196 * This is enabled by default for both axis. This API will set if it is enabled
197 * for the given axis with the boolean parameters for each axis.
201 EAPI void elm_scroller_bounce_set(Evas_Object *obj, Eina_Bool h_bounce, Eina_Bool v_bounce);
204 * @brief Get the bounce behaviour
206 * @param obj The Scroller object
207 * @param h_bounce Will the scroller bounce horizontally or not
208 * @param v_bounce Will the scroller bounce vertically or not
210 * @see elm_scroller_bounce_set()
214 EAPI void elm_scroller_bounce_get(const Evas_Object *obj, Eina_Bool *h_bounce, Eina_Bool *v_bounce);
217 * @brief Set scroll page size relative to viewport size.
219 * @param obj The scroller object
220 * @param h_pagerel The horizontal page relative size
221 * @param v_pagerel The vertical page relative size
223 * The scroller is capable of limiting scrolling by the user to "pages". That
224 * is to jump by and only show a "whole page" at a time as if the continuous
225 * area of the scroller content is split into page sized pieces. This sets
226 * the size of a page relative to the viewport of the scroller. 1.0 is "1
227 * viewport" is size (horizontally or vertically). 0.0 turns it off in that
228 * axis. This is mutually exclusive with page size
229 * (see elm_scroller_page_size_set() for more information). Likewise 0.5
230 * is "half a viewport". Sane usable values are normally between 0.0 and 1.0
231 * including 1.0. If you only want 1 axis to be page "limited", use 0.0 for
236 EAPI void elm_scroller_page_relative_set(Evas_Object *obj, double h_pagerel, double v_pagerel);
239 * Get a given scroller widget's scrolling page size, relative to
242 * @param obj The scroller object
243 * @param h_pagerel Pointer to a variable where to store the
244 * horizontal page (relative) size
245 * @param v_pagerel Pointer to a variable where to store the
246 * vertical page (relative) size
248 * @see elm_scroller_page_relative_set() for more details
254 EAPI void elm_scroller_page_relative_get(const Evas_Object *obj, double *h_pagerel, double *v_pagerel);
257 * @brief Set scroll page size.
259 * @param obj The scroller object
260 * @param h_pagesize The horizontal page size
261 * @param v_pagesize The vertical page size
263 * This sets the page size to an absolute fixed value, with 0 turning it off
266 * @see elm_scroller_page_relative_set()
267 * @see elm_scroller_page_size_get()
271 EAPI void elm_scroller_page_size_set(Evas_Object *obj, Evas_Coord h_pagesize, Evas_Coord v_pagesize);
274 * @brief Retrieve a scroller widget's current page size.
276 * @param obj The scroller object
277 * @param h_pagesize Where to store its horizontal page size
278 * @param v_pagesize Where to store its vertical page size
280 * @see elm_scroller_page_size_set() for more details
281 * @see elm_scroller_page_relative_set()
287 EAPI void elm_scroller_page_size_get(const Evas_Object *obj, Evas_Coord *h_pagesize, Evas_Coord *v_pagesize);
290 * @brief Get scroll current page number.
292 * @param obj The scroller object
293 * @param h_pagenumber The horizontal page number
294 * @param v_pagenumber The vertical page number
296 * The page number starts from 0. 0 is the first page.
297 * Current page means the page which meets the top-left of the viewport.
298 * If there are two or more pages in the viewport, it returns the number of the page
299 * which meets the top-left of the viewport.
301 * @see elm_scroller_last_page_get()
302 * @see elm_scroller_page_show()
303 * @see elm_scroller_page_bring_in()
307 EAPI void elm_scroller_current_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber);
310 * @brief Get scroll last page number.
312 * @param obj The scroller object
313 * @param h_pagenumber The horizontal page number
314 * @param v_pagenumber The vertical page number
316 * The page number starts from 0. 0 is the first page.
317 * This returns the last page number among the pages.
319 * @see elm_scroller_current_page_get()
320 * @see elm_scroller_page_show()
321 * @see elm_scroller_page_bring_in()
325 EAPI void elm_scroller_last_page_get(const Evas_Object *obj, int *h_pagenumber, int *v_pagenumber);
328 * Show a specific virtual region within the scroller content object by page number.
330 * @param obj The scroller object
331 * @param h_pagenumber The horizontal page number
332 * @param v_pagenumber The vertical page number
334 * 0, 0 of the indicated page is located at the top-left of the viewport.
335 * This will jump to the page directly without animation.
340 * sc = elm_scroller_add(win);
341 * elm_object_content_set(sc, content);
342 * elm_scroller_page_relative_set(sc, 1, 0);
343 * elm_scroller_current_page_get(sc, &h_page, &v_page);
344 * elm_scroller_page_show(sc, h_page + 1, v_page);
347 * @see elm_scroller_page_bring_in()
351 EAPI void elm_scroller_page_show(Evas_Object *obj, int h_pagenumber, int v_pagenumber);
354 * Show a specific virtual region within the scroller content object by page number.
356 * @param obj The scroller object
357 * @param h_pagenumber The horizontal page number
358 * @param v_pagenumber The vertical page number
360 * 0, 0 of the indicated page is located at the top-left of the viewport.
361 * This will slide to the page with animation.
366 * sc = elm_scroller_add(win);
367 * elm_object_content_set(sc, content);
368 * elm_scroller_page_relative_set(sc, 1, 0);
369 * elm_scroller_last_page_get(sc, &h_page, &v_page);
370 * elm_scroller_page_bring_in(sc, h_page, v_page);
373 * @see elm_scroller_page_show()
377 EAPI void elm_scroller_page_bring_in(Evas_Object *obj, int h_pagenumber, int v_pagenumber);
380 * @brief Show a specific virtual region within the scroller content object.
382 * @param obj The scroller object
383 * @param x X coordinate of the region
384 * @param y Y coordinate of the region
385 * @param w Width of the region
386 * @param h Height of the region
388 * This will ensure all (or part if it does not fit) of the designated
389 * region in the virtual content object (0, 0 starting at the top-left of the
390 * virtual content object) is shown within the scroller. Unlike
391 * elm_scroller_region_show(), this allow the scroller to "smoothly slide"
392 * to this location (if configuration in general calls for transitions). It
393 * may not jump immediately to the new location and make take a while and
394 * show other content along the way.
396 * @see elm_scroller_region_show()
400 EAPI void elm_scroller_region_bring_in(Evas_Object *obj, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
403 * @brief Set event propagation on a scroller
405 * @param obj The scroller object
406 * @param propagation If propagation is enabled or not
408 * This enables or disables event propagation from the scroller
409 * content to the scroller and its parent. By default event
410 * propagation is @b enabled.
414 EAPI void elm_scroller_propagate_events_set(Evas_Object *obj, Eina_Bool propagation);
417 * @brief Get event propagation for a scroller
419 * @param obj The scroller object
420 * @return The propagation state
422 * This gets the event propagation for a scroller.
424 * @see elm_scroller_propagate_events_set()
428 EAPI Eina_Bool elm_scroller_propagate_events_get(const Evas_Object *obj);
431 * @brief Set scrolling gravity on a scroller
433 * @param obj The scroller object
434 * @param x The scrolling horizontal gravity
435 * @param y The scrolling vertical gravity
437 * The gravity, defines how the scroller will adjust its view
438 * when the size of the scroller contents increase.
440 * The scroller will adjust the view to glue itself as follows.
442 * x=0.0, for showing the left most region of the content.
443 * x=1.0, for showing the right most region of the content.
444 * y=0.0, for showing the bottom most region of the content.
445 * y=1.0, for showing the top most region of the content.
447 * Default values for x and y are 0.0
451 EAPI void elm_scroller_gravity_set(Evas_Object *obj, double x, double y);
454 * @brief Get scrolling gravity values for a scroller
456 * @param obj The scroller object
457 * @param x The scrolling horizontal gravity
458 * @param y The scrolling vertical gravity
460 * This gets gravity values for a scroller.
462 * @see elm_scroller_gravity_set()
466 EAPI void elm_scroller_gravity_get(const Evas_Object *obj, double *x, double *y);