Scroller

../_images/scroller-preview.png

Widget description

A scroller holds a single object and “scrolls it around”.

This means that it allows the user to use a scrollbar (or a finger) to drag the viewable region around, allowing to move through a much larger object that is contained in the scroller. The scroller will always have a small minimum size by default as it won’t be limited by the contents of the scroller.

This widget inherits from LayoutClass, so that all the functions acting on it also work for scroller objects.

Note

When Elementary is in embedded mode the scrollbars will not be draggable, they appear merely as indicators of how much has been scrolled.

Note

When Elementary is in desktop mode the thumbscroll(a.k.a. fingerscroll) won’t work.

Emitted signals

  • edge,left - the left edge of the content has been reached
  • edge,right - the right edge of the content has been reached
  • edge,top - the top edge of the content has been reached
  • edge,bottom - the bottom edge of the content has been reached
  • scroll - the content has been scrolled (moved)
  • scroll,left - the content has been scrolled (moved) leftwards
  • scroll,right - the content has been scrolled (moved) rightwards
  • scroll,up - the content has been scrolled (moved) upwards
  • scroll,down - the content has been scrolled (moved) downwards
  • scroll,anim,start - scrolling animation has started
  • scroll,anim,stop - scrolling animation has stopped
  • scroll,drag,start - dragging the contents around has started
  • scroll,drag,stop - dragging the contents around has stopped
  • vbar,drag - the vertical scroll bar has been dragged
  • vbar,press - the vertical scroll bar has been pressed
  • vbar,unpress - the vertical scroll bar has been unpressed
  • hbar,drag - the horizontal scroll bar has been dragged
  • hbar,press - the horizontal scroll bar has been pressed
  • hbar,unpress - the horizontal scroll bar has been unpressed
  • scroll,page,changed - the visible page has changed

Note

The “scroll,anim,*” and “scroll,drag,*” signals are only emitted by user intervention.

Layout content parts

  • default - A content of the scroller

Enumerations

Scrollbar visibility

efl.elementary.ELM_SCROLLER_POLICY_AUTO

Show scrollbars as needed

efl.elementary.ELM_SCROLLER_POLICY_ON

Always show scrollbars

efl.elementary.ELM_SCROLLER_POLICY_OFF

Never show scrollbars

Single direction

Type that controls how the content is scrolled.

efl.elementary.ELM_SCROLLER_SINGLE_DIRECTION_NONE

Scroll every direction

efl.elementary.ELM_SCROLLER_SINGLE_DIRECTION_SOFT

Scroll single direction if the direction is certain

efl.elementary.ELM_SCROLLER_SINGLE_DIRECTION_HARD

Scroll only single direction

Movement block

Type that blocks the scroll movement in one or more direction.

since:1.8
efl.elementary.ELM_SCROLLER_MOVEMENT_NO_BLOCK

Do not block movements

efl.elementary.ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL

Block vertical movements

efl.elementary.ELM_SCROLLER_MOVEMENT_BLOCK_HORIZONTAL

Block horizontal movements

Inheritance diagram

Inheritance diagram of Scroller

class efl.elementary.Scroller(..)

Bases: efl.elementary.__init__.Scrollable, efl.elementary.__init__._ScrollerWidget

class efl.elementary.Scrollable(*args, **kwargs)

Bases: efl.elementary.__init__.Object

object. It has the function of clipping and moving the actual scrollable content around, by the command of the scrollable interface calls.

If a widget supports the scrollable interface, you can inherit from the widget class and this class to allow access to the scroller of that widget.

bounce

The bouncing behavior

When scrolling, the scroller may “bounce” when reaching an edge of the content object. This is a visual way to indicate the end has been reached. This is enabled by default for both axis. This API will set if it is enabled for the given axis with the boolean parameters for each axis.

Type:(bool h, bool v)
bounce_get()
bounce_set(h, v)
callback_edge_bottom_add(func, *args, **kwargs)

The bottom edge of the content has been reached.

callback_edge_bottom_del(func)
callback_edge_left_add(func, *args, **kwargs)

The left edge of the content has been reached.

callback_edge_left_del(func)
callback_edge_right_add(func, *args, **kwargs)

The right edge of the content has been reached.

callback_edge_right_del(func)
callback_edge_top_add(func, *args, **kwargs)

The top edge of the content has been reached.

callback_edge_top_del(func)
callback_hbar_drag_add(func, *args, **kwargs)

the horizontal scroll bar has been dragged

callback_hbar_drag_del(func)
callback_hbar_press_add(func, *args, **kwargs)

the horizontal scroll bar has been pressed

callback_hbar_press_del(func)
callback_hbar_unpress_add(func, *args, **kwargs)

the horizontal scroll bar has been unpressed

callback_hbar_unpress_del(func)
callback_scroll_add(func, *args, **kwargs)

The content has been scrolled (moved).

callback_scroll_anim_start_add(func, *args, **kwargs)

Scrolling animation has started.

callback_scroll_anim_start_del(func)
callback_scroll_anim_stop_add(func, *args, **kwargs)

Scrolling animation has stopped.

callback_scroll_anim_stop_del(func)
callback_scroll_del(func)
callback_scroll_down_add(func, *args, **kwargs)

the content has been scrolled (moved) downwards

callback_scroll_down_del(func)
callback_scroll_drag_start_add(func, *args, **kwargs)

Dragging the contents around has started.

callback_scroll_drag_start_del(func)
callback_scroll_drag_stop_add(func, *args, **kwargs)

Dragging the contents around has stopped.

callback_scroll_drag_stop_del(func)
callback_scroll_left_add(func, *args, **kwargs)

the content has been scrolled (moved) leftwards

callback_scroll_left_del(func)
callback_scroll_page_changed_add(func, *args, **kwargs)

the visible page has changed

callback_scroll_page_changed_del(func)
callback_scroll_right_add(func, *args, **kwargs)

the content has been scrolled (moved) rightwards

callback_scroll_right_del(func)
callback_scroll_up_add(func, *args, **kwargs)

the content has been scrolled (moved) upwards

callback_scroll_up_del(func)
callback_vbar_drag_add(func, *args, **kwargs)

the vertical scroll bar has been dragged

callback_vbar_drag_del(func)
callback_vbar_press_add(func, *args, **kwargs)

the vertical scroll bar has been pressed

callback_vbar_press_del(func)
callback_vbar_unpress_add(func, *args, **kwargs)

the vertical scroll bar has been unpressed

callback_vbar_unpress_del(func)
child_size

Get the size of the content object

This gets the size of the content object of the scroller.

Type:(int w, int h)
child_size_get()
content_min_limit(w, h)

Make the scroller minimum size limited to the minimum size of the content

By default the scroller will be as small as its design allows, irrespective of its content. This will make the scroller minimum size the right size horizontally and/or vertically to perfectly fit its content in that direction.

Parameters:
  • w (bool) – Enable limiting minimum size horizontally
  • h (bool) – Enable limiting minimum size vertically
current_page

Get scroll current page number.

The page number starts from 0. 0 is the first page. Current page means the page which meets the top-left of the viewport. If there are two or more pages in the viewport, it returns the number of the page which meets the top-left of the viewport.

Type:(int h_pagenumber, int v_pagenumber)
current_page_get()
custom_widget_base_theme_set(widget, base)

custom_widget_base_theme_set(widget, base)

Deprecated since version 1.8: Use theme instead.

gravity

Scrolling gravity on a scroller

The gravity, defines how the scroller will adjust its view when the size of the scroller contents increase.

The scroller will adjust the view to glue itself as follows:

x=0.0, for showing the left most region of the content. x=1.0, for showing the right most region of the content. y=0.0, for showing the bottom most region of the content. y=1.0, for showing the top most region of the content.

Default values for x and y are 0.0

Type:(float x, float y)
gravity_get()
gravity_set(x, y)
last_page

Get scroll last page number.

The page number starts from 0. 0 is the first page. This returns the last page number among the pages.

Type:(int h_pagenumber, int v_pagenumber)
last_page_get()
loop

Set an infinite loop for the scroller

Type:(bool h, bool v)

New in version 1.14.

loop_get()
loop_set(h, v)
movement_block

Blocking of scrolling (per axis) on a given scroller

This function will block scrolling movement (by input of a user) in a given direction. One can disable movements in the X axis, the Y axis or both. The default value is ELM_SCROLLER_MOVEMENT_NO_BLOCK, where movements are allowed in both directions.

What makes this function different from scroll_freeze_push(), scroll_hold_push() and scroll_lock_x_set() (or scroll_lock_x_set()) is that it doesn’t propagate its effects to any parent or child widget of the object. Only the target scrollable widget will be locked with regard to scrolling.

Type:Movement block

New in version 1.8.

page_bring_in(h_pagenumber, v_pagenumber)

Show a specific virtual region within the scroller content object by page number.

0, 0 of the indicated page is located at the top-left of the viewport. This will slide to the page with animation.

Example of usage:

sc = Scroller(win)
sc.content = content
sc.page_relative = (1, 0)
h_page, v_page = sc.last_page
sc.page_bring_in(h_page, v_page)

See also

page_show()

Parameters:
  • h_pagenumber (int) – The horizontal page number
  • v_pagenumber (int) – The vertical page number
page_relative

Set scroll page size relative to viewport size.

The scroller is capable of limiting scrolling by the user to “pages”. That is to jump by and only show a “whole page” at a time as if the continuous area of the scroller content is split into page sized pieces. This sets the size of a page relative to the viewport of the scroller. 1.0 is “one viewport” in size (horizontally or vertically). 0.0 turns it off in that axis. This is mutually exclusive with page size (see page_size for more information). Likewise 0.5 is “half a viewport”. Sane usable values are normally between 0.0 and 1.0 including 1.0. If you only want a single axis to be page “limited”, use 0.0 for the other axis.

Type:(float h_pagerel, float v_pagerel)
page_relative_get()
page_relative_set(h_pagerel, v_pagerel)
page_scroll_limit

The maximum of the movable page at a flicking.

The value of maximum movable page should be more than 1.

Type:(int page_limit_h, int page_limit_v)

New in version 1.8.

page_scroll_limit_get()
page_scroll_limit_set(page_limit_h, page_limit_v)
page_show(h_pagenumber, v_pagenumber)

Show a specific virtual region within the scroller content object by page number.

0, 0 of the indicated page is located at the top-left of the viewport. This will jump to the page directly without animation.

Example of usage:

sc = Scroller(win)
sc.content = content
sc.page_relative = (1, 0)
h_page, v_page = sc.current_page
sc.page_show(h_page + 1, v_page)

See also

page_bring_in()

Parameters:
  • h_pagenumber (int) – The horizontal page number
  • v_pagenumber (int) – The vertical page number
page_size

Scroller widget’s current page size.

An absolute fixed value, with 0 turning it off for that axis.

See also

page_relative

Type:(int h_pagesize, int v_pagesize)

New in version 1.8: Getter for this property

page_size_get()
page_size_set(h_pagesize, v_pagesize)
page_snap

Page snapping behavior of a scroller

When scrolling, if a scroller is paged (see page_size and page_relative), the scroller may snap to pages when being scrolled, i.e., even if it had momentum to scroll further, it will stop at the next page boundaries. This is disabled, by default, for both axis. This function will set if it that is enabled or not, for each axis.

Note

If the object is not set to have pages, nothing will happen after this call.

Type:(bool page_h_snap, bool page_v_snap)

New in version 1.8.

policy

The scrollbar visibility policy

This property reflects the scrollbar visibility policy for the given scroller. ELM_SCROLLER_POLICY_AUTO means the scrollbar is made visible if it is needed, and otherwise kept hidden. ELM_SCROLLER_POLICY_ON turns it on all the time, and ELM_SCROLLER_POLICY_OFF always keeps it off. This applies respectively for the horizontal and vertical scrollbars.

Type:(Scrollbar visibility policy_h, Scrollbar visibility policy_v)
policy_get()
policy_set(policy_h, policy_v)
propagate_events

Event propagation for a scroller

This enables or disables event propagation from the scroller content to the scroller and its parent. By default event propagation is disabled.

Type:bool
propagate_events_get()
propagate_events_set(propagation)
region

Get the currently visible content region

This gets the current region in the content object that is visible through the scroller. The region co-ordinates are returned in the x, y, w, h values pointed to.

Note

All coordinates are relative to the content.

See also

region_show()

Type:tuple of Evas_Coord (int)
region_bring_in(x, y, w, h)

Show a specific virtual region within the scroller content object.

This will ensure all (or part if it does not fit) of the designated region in the virtual content object (0, 0 starting at the top-left of the virtual content object) is shown within the scroller. Unlike elm_scroller_region_show(), this allow the scroller to “smoothly slide” to this location (if configuration in general calls for transitions). It may not jump immediately to the new location and make take a while and show other content along the way.

See also

region_show()

Parameters:
  • x (Evas_Coord (int)) – X coordinate of the region
  • y (Evas_Coord (int)) – Y coordinate of the region
  • w (Evas_Coord (int)) – Width of the region
  • h (Evas_Coord (int)) – Height of the region
region_get()
region_show(x, y, w, h)

Show a specific virtual region within the scroller content object

This will ensure all (or part if it does not fit) of the designated region in the virtual content object (0, 0 starting at the top-left of the virtual content object) is shown within the scroller.

Parameters:
  • x (Evas_Coord (int)) – X coordinate of the region
  • y (Evas_Coord (int)) – Y coordinate of the region
  • w (Evas_Coord (int)) – Width of the region
  • h (Evas_Coord (int)) – Height of the region
single_direction

The type of single direction scroll

Type:Single direction

New in version 1.8.

single_direction_get()
single_direction_set(single_dir)
step_size

The step size to move scroller by key event.

Type:(int x, int y)

New in version 1.13.

step_size_get()
step_size_set(x, y)
wheel_disabled

Enable or disable mouse wheel to be used to scroll the scroller.

Mouse wheel can be used to scroll up and down the scroller. Wheel is enabled by default.

Type:bool

New in version 1.15.

wheel_disabled_get()
wheel_disabled_set(disabled)