This widget aims to have more expansive list than the simple list in
Elementary that could have more flexible items and allow many more
entries while still being fast and low on memory usage. At the same time
it was also made to be able to do tree structures. But the price to pay
is more complexity when it comes to usage. If all you want is a simple
list (not much items) with icons and a single text, use the normal
List
object.
Genlist has a fairly large API, mostly because it’s relatively complex, trying to be both expansive, powerful and efficient. First we will begin an overview on the theory behind genlist.
In order to have the ability to add and delete items on the fly, genlist
implements the item class (callback) system where the application provides a
structure with information about that type of item (genlist may contain
multiple different items with different classes, states and styles).
Genlist will call the functions in this class (methods) when an item is
“realized” (i.e., created dynamically, while the user is scrolling the
grid). All objects will simply be deleted when no longer needed with
efl.evas.Object.delete()
. GenlistItemClass
contains the
following members:
item_style
- This is a constant string and define the name of the default
item style. It must be provided.
decorate_item_style
- This is a constant string and define the name of
the style to be used in the “decorate” mode.
See GenlistItem.decorate_mode
.
decorate_all_item_style
- This is a constant string and
define the name of the style to be used in the “decorate all” mode.
See Genlist.decorate_mode
.
text_get
- This function will be called for every text part. Should
return the text to display. See GenlistItemClass.text_get()
.
content_get
- This function will be called for every content part.
Should return an object to display, the object will be deleted by the
genlist on its deletion or when the item is “unrealized”. See
GenlistItemClass.content_get()
.
state_get
- This function will be called for every state part. Must
return True
for false/off or True
for true/on. Genlists will
emit a signal to its theming Edje object with "elm,state,xxx,active"
and "elm"
as “emission” and “source” arguments, respectively, when
the state is true (the default is false), where xxx
is the name of
the (state) part. See GenlistItemClass.state_get()
.
func.del
- This is intended for use when genlist items are deleted,
so any data attached to the item (e.g. its data parameter on creation)
can be deleted. See GenlistItemClass.delete()
.
default
The default style: icon, text, end icon
default_style
The text part is a textblock and can use markups
double_label
Two different text parts
icon_top_text_bottom
group_index
one_icon
Only 1 icon (left) (since: 1.1)
end_icon
Only 1 icon (at end/right) (since: 1.1)
no_icon
No icon (since: 1.1)
full
Only one object, elm.swallow.content, which consumes whole area of
the genlist item (since: 1.7)
indent
Has indentation to match tree group items (since: 1.19)
An item in a genlist can have 0 or more texts (they can be regular text
or textblock Evas objects - that’s up to the style to determine), 0 or
more contents (which are simply objects swallowed into the genlist item’s
theming Edje object) and 0 or more boolean states, which have the
behavior left to the user to define. The Edje part names for each of
these properties will be looked up, in the theme file for the genlist,
under the Edje (string) data items named labels
, contents
and states
, respectively. For each of those properties, if more
than one part is provided, they must have names listed separated by
spaces in the data fields. For the default genlist item theme, we have
one text part (elm.text
), two content parts
(elm.swallow.icon
and elm.swallow.end
) and no state parts.
If the application wants multiple items to be able to be selected,
Genlist.multi_select
can enable this. If the list is
single-selection only (the default), then Genlist.selected_item
will return the selected item, if any, or None if none is selected. If the
list is multi-select then Genlist.selected_items
will return a
list (that is only valid as long as no items are modified (added, deleted,
selected or unselected)).
There are also convenience functions.
efl.elementary.object_item.ObjectItem.widget
will return the genlist
object the item belongs to. GenlistItem.show()
will make the scroller
scroll to show that specific item so its visible.
efl.elementary.object_item.ObjectItem.data
returns the data pointer
set by the item creation functions.
If an item changes (state of boolean changes, text or contents change),
then use GenlistItem.update()
to have genlist update the item with
the new state. Genlist will re-realize the item and thus call the functions
in the _Elm_Genlist_Item_Class for that item.
Use GenlistItem.selected
to programmatically (un)select an item or
get its selected state. Similarly to expand/contract an item and get its
expanded state, use GenlistItem.expanded
. And again to make an item
disabled (unable to be selected and appear differently) use
GenlistItem.disabled
to set this and get the disabled state.
In general to indicate how the genlist should expand items horizontally to
fill the list area, use Genlist.mode
. Valid modes are
ELM_LIST_LIMIT, ELM_LIST_COMPRESS and ELM_LIST_SCROLL. The default is
ELM_LIST_SCROLL. This mode means that if items are too wide to fit, the
scroller will scroll horizontally. Otherwise items are expanded to
fill the width of the viewport of the scroller. If it is
ELM_LIST_LIMIT, items will be expanded to the viewport width
if larger than the item, but genlist widget with is
limited to the largest item. D not use ELM_LIST_LIMIT mode with homogeneous
mode turned on. ELM_LIST_COMPRESS can be combined with a different style
that uses Edje’s ellipsis feature (cutting text off like this: “tex…”).
Items will only call their selection func and callback when first becoming
selected. Any further clicks will do nothing, unless you enable always
select with Genlist.select_mode
as ELM_OBJECT_SELECT_MODE_ALWAYS.
This means even if selected, every click will make the selected callbacks
be called. Genlist.select_mode
as ELM_OBJECT_SELECT_MODE_NONE will
turn off the ability to select items entirely and they will neither
appear selected nor call selected callback functions.
Remember that you can create new styles and add your own theme augmentation per
application with efl.elementary.theme.Theme.extension_add()
. If you
absolutely must have a specific style that overrides any theme the user or
system sets up you can use efl.elementary.theme.Theme.overlay_add()
to
add such a file.
This widget supports the scrollable interface.
If you wish to control the scrolling behaviour using these functions,
inherit both the widget class and the
Scrollable
class
using multiple inheritance, for example:
class ScrollableGenlist(Genlist, Scrollable):
def __init__(self, canvas, *args, **kwargs):
Genlist.__init__(self, canvas)
Evas tracks every object you create. Every time it processes an event (mouse move, down, up etc.) it needs to walk through objects and find out what event that affects. Even worse every time it renders display updates, in order to just calculate what to re-draw, it needs to walk through many many many objects. Thus, the more objects you keep active, the more overhead Evas has in just doing its work. It is advisable to keep your active objects to the minimum working set you need. Also remember that object creation and deletion carries an overhead, so there is a middle-ground, which is not easily determined. But don’t keep massive lists of objects you can’t see or use. Genlist does this with list objects. It creates and destroys them dynamically as you scroll around. It groups them into blocks so it can determine the visibility etc. of a whole block at once as opposed to having to walk the whole list. This 2-level list allows for very large numbers of items to be in the list (tests have used up to 2,000,000 items). Also genlist employs a queue for adding items. As items may be different sizes, every item added needs to be calculated as to its size and thus this presents a lot of overhead on populating the list, this genlist employs a queue. Any item added is queued and spooled off over time, actually appearing some time later, so if your list has many members you may find it takes a while for them to all appear, with your process consuming a lot of CPU while it is busy spooling.
Genlist also implements a tree structure, but it does so with callbacks to the application, with the application filling in tree structures when requested (allowing for efficient building of a very deep tree that could even be used for file-management). See the above smart signal callbacks for details.
activated
- The user has double-clicked or pressed
(enter|return|spacebar) on an item. The event_info
parameter is the
item that was activated.
clicked,double
- The user has double-clicked an item. The
event_info
parameter is the item that was double-clicked.
clicked,right
- The user has right-clicked an item. The
event_info
parameter is the item that was right-clicked. (since: 1.13)
selected
- This is called when a user has made an item selected.
The event_info parameter is the genlist item that was selected.
unselected
- This is called when a user has made an item
unselected. The event_info parameter is the genlist item that was
unselected.
expanded
- This is called when GenlistItem.expanded
is
called and the item is now meant to be expanded. The event_info
parameter is the genlist item that was indicated to expand. It is the
job of this callback to then fill in the child items.
contracted
- This is called when GenlistItem.expanded
is
called and the item is now meant to be contracted. The event_info
parameter is the genlist item that was indicated to contract. It is the
job of this callback to then delete the child items.
expand,request
- This is called when a user has indicated they want
to expand a tree branch item. The callback should decide if the item can
expand (has any children) and then call GenlistItem.expanded
appropriately to set the state. The event_info parameter is the genlist
item that was indicated to expand.
contract,request
- This is called when a user has indicated they
want to contract a tree branch item. The callback should decide if the
item can contract (has any children) and then call
GenlistItem.expanded
appropriately to set the state. The
event_info parameter is the genlist item that was indicated to contract.
realized
- This is called when the item in the list is created as a
real evas object. event_info parameter is the genlist item that was
created.
unrealized
- This is called just before an item is unrealized.
After this call content objects provided will be deleted and the item
object itself delete or be put into a floating cache.
drag,start,up
- This is called when the item in the list has been
dragged (not scrolled) up.
drag,start,down
- This is called when the item in the list has been
dragged (not scrolled) down.
drag,start,left
- This is called when the item in the list has been
dragged (not scrolled) left.
drag,start,right
- This is called when the item in the list has
been dragged (not scrolled) right.
drag,stop
- This is called when the item in the list has stopped
being dragged.
drag
- This is called when the item in the list is being dragged.
longpressed
- This is called when the item is pressed for a certain
amount of time. By default it’s 1 second. The event_info parameter is the
longpressed genlist item.
scroll,anim,start
- This is called when scrolling animation has
started.
scroll,anim,stop
- This is called when scrolling animation has
stopped.
scroll,drag,start
- This is called when dragging the content has
started.
scroll,drag,stop
- This is called when dragging the content has
stopped.
edge,top
- This is called when the genlist is scrolled until
the top edge.
edge,bottom
- This is called when the genlist is scrolled
until the bottom edge.
edge,left
- This is called when the genlist is scrolled
until the left edge.
edge,right
- This is called when the genlist is scrolled
until the right edge.
multi,swipe,left
- This is called when the genlist is multi-touch
swiped left.
multi,swipe,right
- This is called when the genlist is multi-touch
swiped right.
multi,swipe,up
- This is called when the genlist is multi-touch
swiped up.
multi,swipe,down
- This is called when the genlist is multi-touch
swiped down.
multi,pinch,out
- This is called when the genlist is multi-touch
pinched out.
multi,pinch,in
- This is called when the genlist is multi-touch
pinched in.
swipe
- This is called when the genlist is swiped.
moved
- This is called when a genlist item is moved in reorder mode.
moved,after
- This is called when a genlist item is moved after
another item in reorder mode. The event_info parameter is the reordered
item. To get the relative previous item, use GenlistItem.prev
.
This signal is called along with “moved” signal.
moved,before
- This is called when a genlist item is moved before
another item in reorder mode. The event_info parameter is the reordered
item. To get the relative previous item, use GenlistItem.next
.
This signal is called along with “moved” signal.
language,changed
- This is called when the program’s language is
changed.
tree,effect,finished
- This is called when a genlist tree effect
is finished.
highlighted
- an item in the list is highlighted. This is called when
the user presses an item or keyboard selection is done so the item is
physically highlighted. The event_info
parameter is the item that was
highlighted.
unhighlighted
- an item in the list is unhighlighted. This is called
when the user releases an item or keyboard selection is moved so the item
is physically unhighlighted. The event_info
parameter is the item that
was unhighlighted.
item,focused
- When the genlist item has received focus. (since 1.10)
item,unfocused
- When the genlist item has lost focus. (since 1.10)
changed
- Genlist is now changed their items and properties and all
calculation is finished. (since 1.16)
filter,done
- Genlist filter operation is completed.. (since 1.17)
efl.elementary.
ELM_GENLIST_ITEM_NONE
¶Simple item
efl.elementary.
ELM_GENLIST_ITEM_TREE
¶The item may be expanded and have child items
efl.elementary.
ELM_GENLIST_ITEM_GROUP
¶An index item of a group of items
efl.elementary.
ELM_GENLIST_ITEM_FIELD_ALL
¶Match all fields
efl.elementary.
ELM_GENLIST_ITEM_FIELD_TEXT
¶Match text fields
efl.elementary.
ELM_GENLIST_ITEM_FIELD_CONTENT
¶Match content fields
efl.elementary.
ELM_GENLIST_ITEM_FIELD_STATE
¶Match state fields
efl.elementary.
ELM_GENLIST_ITEM_SCROLLTO_NONE
¶No scroll to
efl.elementary.
ELM_GENLIST_ITEM_SCROLLTO_IN
¶Scroll to the nearest viewport
efl.elementary.
ELM_GENLIST_ITEM_SCROLLTO_TOP
¶Scroll to the top of viewport
efl.elementary.
ELM_GENLIST_ITEM_SCROLLTO_MIDDLE
¶Scroll to the middle of viewport
efl.elementary.
ELM_GENLIST_ITEM_SCROLLTO_BOTTTOM
¶Scroll to the bottom of viewport
New in version 1.17.
efl.elementary.
Genlist
(Object parent, *args, **kwargs)¶Bases: efl.elementary.__init__.Object
parent (efl.evas.Object
) – The parent object
**kwargs – All the remaining keyword arguments are interpreted as properties of the instance
at_xy_item_get
¶Get the item that is at the x, y canvas coords.
x – The input x coordinate
y – The input y coordinate
posret – The position relative to the item returned here
(ObjectItem
it, int posret)
This returns the item at the given coordinates (which are canvas
relative, not object-relative). If an item is at that coordinate,
that item handle is returned, and if posret
is not None, the
integer pointed to is set to a value of -1, 0 or 1, depending if
the coordinate is on the upper portion of that item (-1), on the
middle section (0) or on the lower part (1). If None is returned as
an item (no item found there), then posret may indicate -1 or 1
based if the coordinate is above or below all items respectively in
the genlist.
block_count
¶This will configure the block count to tune to the target with particular performance matrix.
A block of objects will be used to reduce the number of operations due to many objects in the screen. It can determine the visibility, or if the object has changed, it theme needs to be updated, etc. doing this kind of calculation to the entire block, instead of per object.
The default value for the block count is enough for most lists, so unless you know you will have a lot of objects visible in the screen at the same time, don’t try to change this.
block_count_get
¶block_count_set
¶bounce
¶Deprecated since version 1.8: You should combine with Scrollable class instead.
bounce_get
¶Deprecated since version 1.8: You should combine with Scrollable class instead.
bounce_set
¶Deprecated since version 1.8: You should combine with Scrollable class instead.
callback_activated_add
¶callback_activated_del
¶callback_changed_add
¶calculation is finished.
New in version 1.16.
callback_changed_del
¶callback_clicked_double_add
¶callback_clicked_double_del
¶callback_clicked_right_add
¶The user has right-clicked an item.
New in version 1.13.
callback_clicked_right_del
¶callback_contract_request_add
¶callback_contract_request_del
¶callback_contracted_add
¶callback_contracted_del
¶callback_drag_add
¶callback_drag_del
¶callback_drag_start_down_add
¶callback_drag_start_down_del
¶callback_drag_start_left_add
¶callback_drag_start_left_del
¶callback_drag_start_right_add
¶callback_drag_start_right_del
¶callback_drag_start_up_add
¶callback_drag_start_up_del
¶callback_drag_stop_add
¶callback_drag_stop_del
¶callback_expand_request_add
¶callback_expand_request_del
¶callback_expanded_add
¶callback_expanded_del
¶callback_filter_done_add
¶Genlist filter operation is completed.
New in version 1.17.
callback_filter_done_del
¶callback_highlighted_add
¶an item in the list is highlighted. This is called when the user presses an item or keyboard selection is done so the item is physically highlighted. The %c event_info parameter is the item that was highlighted.
callback_highlighted_del
¶callback_item_focused_add
¶When the genlist item has received focus.
New in version 1.10.
callback_item_focused_del
¶callback_item_unfocused_add
¶When the genlist item has lost focus.
New in version 1.10.
callback_item_unfocused_del
¶callback_longpressed_add
¶callback_longpressed_del
¶callback_moved_add
¶callback_moved_after_add
¶callback_moved_after_del
¶callback_moved_before_add
¶callback_moved_before_del
¶callback_moved_del
¶callback_multi_pinch_in_add
¶callback_multi_pinch_in_del
¶callback_multi_pinch_out_add
¶callback_multi_pinch_out_del
¶callback_multi_swipe_down_add
¶callback_multi_swipe_down_del
¶callback_multi_swipe_left_add
¶callback_multi_swipe_left_del
¶callback_multi_swipe_right_add
¶callback_multi_swipe_right_del
¶callback_multi_swipe_up_add
¶callback_multi_swipe_up_del
¶callback_realized_add
¶callback_realized_del
¶callback_selected_add
¶callback_selected_del
¶callback_swipe_add
¶callback_swipe_del
¶callback_tree_effect_finished_add
¶callback_tree_effect_finished_del
¶callback_unhighlighted_add
¶an item in the list is unhighlighted. This is called when the user releases an item or keyboard selection is moved so the item is physically unhighlighted. The %c event_info parameter is the item that was unhighlighted.
callback_unhighlighted_del
¶callback_unrealized_add
¶callback_unrealized_del
¶callback_unselected_add
¶callback_unselected_del
¶clear
¶Remove all items from a given genlist widget.
decorate_mode
¶Genlist decorate mode for all items.
bool
decorate_mode_get
¶decorate_mode_set
¶decorated_item
¶This function returns the item that was activated with a mode, by the function elm_genlist_item_decorate_mode_set().
See also
decorated_item_get
¶drag_item_container_add
¶Set a item container (list, genlist, grid) as source of drag
tm_to_anim – Time period to wait before start animation.
tm_to_drag – Time period to wait before start dragging.
itemgetcb – Callback to get Evas object for item at (x,y)
data_get – Callback to get drag info
RuntimeError – if setting drag source failed.
New in version 1.17.
drag_item_container_del
¶Deletes a item container from drag-source list
RuntimeError – if deleting drag source failed.
New in version 1.17.
drop_item_container_add
¶Set a item container (list, genlist, grid) as target for drop.
format – The formats supported for dropping
itemgetcb – Callback to get Evas object for item at (x,y)
entercb – The function to call when the object is entered with a drag
enterdata – The application data to pass to enterdata
leavecb – The function to call when the object is left with a drag
leavedata – The application data to pass to leavedata
poscb – The function to call when the object has a drag over it
posdata – The application data to pass to posdata
dropcb – The function to call when a drop has occurred
cbdata – The application data to pass to dropcb
RuntimeError – if setting drop target failed.
New in version 1.17.
drop_item_container_del
¶Removes a container from list of drop targets.
RuntimeError – if deleting drop target failed.
New in version 1.17.
filter
¶Set filter mode with key.
This initiates the filter mode of genlist with user/application provided key. If key is None, the filter mode is turned off.
The given key will be passed back in the filter_get function of the GenlistItemClass
any python object
New in version 1.17.
filter_get
¶filter_set
¶filtered_items_count
¶Return how many items have passed the filter currently.
This behaviour is O(1) and may or may not return the filtered count for complete genlist based on the timing of the call. To get complete count, call after “filter,done” callback.
The number of filtered items
int
New in version 1.18.
first_item
¶This returns the first item in the list.
first_item_get
¶focus_on_selection
¶Focus upon items selection mode
bool
When enabled, every selection of an item inside the genlist will automatically set focus to its first focusable widget from the left. This is true of course if the selection was made by clicking an unfocusable area in an item or selecting it with a key movement. Clicking on a focusable widget inside an item will cause this particular item to get focus as usual.
New in version 1.8.
highlight_mode
¶Whether the item will, or will not highlighted on selection. The selected and clicked callback functions will still be called.
Highlight is enabled by default.
bool
highlight_mode_get
¶highlight_mode_set
¶homogeneous
¶This will enable the homogeneous mode where items are of the same height and width so that genlist may do the lazy-loading at its maximum (which increases the performance for scrolling the list).
See also
bool
homogeneous_get
¶homogeneous_set
¶item_append
¶Append a new item (add as last row) to this genlist.
item_class – a valid instance that defines the
behavior of this row. See GenlistItemClass
.
item_data – some data that defines the model of this
row. This value will be given to methods of
item_class
such as
GenlistItemClass.text_get()
. It will also be
provided to func
as its last parameter.
parent_item – if this is a tree child, then the
parent item must be given here, otherwise it may be
None. The parent must have the flag
ELM_GENLIST_ITEM_SUBITEMS
set.
flags – defines special behavior of this item, can be one of: ELM_GENLIST_ITEM_NONE, ELM_GENLIST_ITEM_TREE or ELM_GENLIST_ITEM_GROUP
func –
if not None, this must be a callable to be called back when the item is selected. The function signature is:
func(item, obj, item_data)
Where item
is the handle, obj
is the Evas object
that represents this item, and item_data
is the
value given as parameter to this function.
item_insert_after
¶Insert a new item after another item to this genlist.
item_class – a valid instance that defines the
behavior of this row. See GenlistItemClass
.
item_data – some data that defines the model of this
row. This value will be given to methods of
item_class
such as
GenlistItemClass.text_get()
. It will also be
provided to func
as its last parameter.
after_item – the new item will be inserted after this one.
flags – defines special behavior of this item, can be one of: ELM_GENLIST_ITEM_NONE, ELM_GENLIST_ITEM_TREE or ELM_GENLIST_ITEM_GROUP
func –
if not None, this must be a callable to be called back when the item is selected. The function signature is:
func(item, obj, item_data)
Where item
is the handle, obj
is the Evas object
that represents this item, and item_data
is the
value given as parameter to this function.
item_insert_before
¶Insert a new item before another item to this genlist.
item_class – a valid instance that defines the
behavior of this row. See GenlistItemClass
.
item_data – some data that defines the model of this
row. This value will be given to methods of
item_class
such as
GenlistItemClass.text_get()
. It will also be
provided to func
as its last parameter.
before_item – the new item will be inserted before this one.
flags – defines special behavior of this item, can be one of: ELM_GENLIST_ITEM_NONE, ELM_GENLIST_ITEM_TREE or ELM_GENLIST_ITEM_GROUP
func –
if not None, this must be a callable to be called back when the item is selected. The function signature is:
func(item, obj, item_data)
Where item
is the handle, obj
is the Evas object
that represents this item, and item_data
is the
value given as parameter to this function.
item_prepend
¶Prepend a new item (add as first row) to this genlist.
item_class – a valid instance that defines the
behavior of this row. See GenlistItemClass
.
item_data – some data that defines the model of this
row. This value will be given to methods of
item_class
such as
GenlistItemClass.text_get()
. It will also be
provided to func
as its last parameter.
parent_item – if this is a tree child, then the
parent item must be given here, otherwise it may be
None. The parent must have the flag
ELM_GENLIST_ITEM_SUBITEMS
set.
flags – defines special behavior of this item, can be one of: ELM_GENLIST_ITEM_NONE, ELM_GENLIST_ITEM_TREE or ELM_GENLIST_ITEM_GROUP
func –
if not None, this must be a callable to be called back when the item is selected. The function signature is:
func(item, obj, item_data)
Where item
is the handle, obj
is the Evas object
that represents this item, and item_data
is the
value given as parameter to this function.
item_sorted_insert
¶This inserts a new item in the genlist based on a user defined comparison function.
item_class – a valid instance that defines the
behavior of this row. See GenlistItemClass
.
item_data – some data that defines the model of this
row. This value will be given to methods of
item_class
such as
GenlistItemClass.text_get()
. It will also be
provided to func
as its last parameter.
comparison_func –
The function called for the sort.
this must be a callable and will be called
to insert the item in the right position. The two arguments passed
are two GenlistItem
to compare. The function must return
1 if item1
comes before item2
, 0 if the two items
are equal or -1 otherwise.
Signature is:
func(item1, item2)->int
parent_item – if this is a tree child, then the
parent item must be given here, otherwise it may be
None. The parent must have the flag
ELM_GENLIST_ITEM_SUBITEMS
set.
flags – defines special behavior of this item, can be one of: ELM_GENLIST_ITEM_NONE, ELM_GENLIST_ITEM_TREE or ELM_GENLIST_ITEM_GROUP
func –
if not None, this must be a callable to be called back when the item is selected. The function signature is:
func(item, obj, item_data)
Where item
is the handle, obj
is the Evas object
that represents this item, and item_data
is the
value given as parameter to this function.
items_count
¶Return how many items are currently in a list
int
last_item
¶This returns the last item in the list.
last_item_get
¶longpress_timeout
¶This option will change how long it takes to send an event “longpressed” after the mouse down signal is sent to the list. If this event occurs, no “clicked” event will be sent.
Warning
If you set the longpress timeout value with this API, your genlist will not be affected by the longpress value of elementary config value later.
longpress_timeout_get
¶longpress_timeout_set
¶mode
¶The mode used for sizing items horizontally.
Default value is ELM_LIST_SCROLL
. This mode means that if items are too
wide to fit, the scroller will scroll horizontally. Otherwise items are
expanded to fill the width of the viewport of the scroller. If it is
ELM_LIST_LIMIT
, items will be expanded to the viewport width and limited
to that size. If it is ELM_LIST_COMPRESS
, the item width will be fixed
(restricted to a minimum of) to the list width when calculating its size
in order to allow the height to be calculated based on it. This allows,
for instance, text block to wrap lines if the Edje part is configured
with “text.min: 0 1”.
Note
ELM_LIST_COMPRESS
will make list resize slower as it will
have to recalculate every item height again whenever the list
width changes!
Note
With homogeneous
mode all items in the genlist have the same
width/height. With ELM_LIST_COMPRESS
the genlist items have
fast initializing. However there are no sub-objects in genlist
which can be on-the-fly resizable (such as TEXTBLOCK), as some
dynamic resizable objects would not be diplayed properly.
mode_get
¶mode_set
¶multi_select
¶This enables (True
) or disables (False
) multi-selection in
the list. This allows more than 1 item to be selected. To retrieve
the list of selected items, use elm_genlist_selected_items_get().
bool
multi_select_get
¶multi_select_mode
¶The genlist multi select mode.
Whenever the user need to pres Ctrl to perform multiselect or not.
New in version 1.20.
multi_select_mode_get
¶multi_select_mode_set
¶multi_select_set
¶nth_item_get
¶Get the nth item, in a given genlist widget, placed at
position nth
, in its internal items list
nth – The number of the item to grab (0 being the first)
The item stored in the object at position nth
or
None
, if there’s no item with that index (and on errors)
New in version 1.8.
realized_items
¶This returns a list of the realized items in the genlist. The list contains genlist items. The list must be freed by the caller when done with eina_list_free(). The item pointers in the list are only valid so long as those items are not deleted or the genlist is not deleted.
See also
tuple of GenlistItem
realized_items_get
¶realized_items_update
¶This updates all realized items by calling all the item class functions again to get the contents, texts and states. Use this when the original item data has changed and the changes are desired to be reflected.
To update just one item, use Genlist.item_update()
.
See also
reorder_mode
¶Reorder mode.
bool
reorder_mode_get
¶reorder_mode_set
¶scroller_policy
¶Deprecated since version 1.8: You should combine with Scrollable class instead.
scroller_policy_get
¶Deprecated since version 1.8: You should combine with Scrollable class instead.
scroller_policy_set
¶Deprecated since version 1.8: You should combine with Scrollable class instead.
search_by_text_item_get
¶Search genlist item by given string.
This function uses globs (like “*.jpg”) for searching and takes search flags as last parameter. That is a bitfield with values to be ored together or 0 for no flags.
item_to_search_from (GenlistItem
) – item to start search from, or None to
search from the first item.
part_name (string) – Name of the TEXT part of genlist item to search string in (usually “elm.text”).
pattern (string) – The search pattern.
flags (Glob matching) – Search flags
The first item found
New in version 1.11.
select_mode
¶Selection mode of the Genlist widget.
selection func and callback when first becoming selected. Any further clicks will do nothing, unless you set always select mode.
every click will make the selected callbacks be called.
select items entirely and they will neither appear selected nor call selected callback functions.
select_mode_get
¶select_mode_set
¶selected_item
¶This gets the selected item in the list (if multi-selection is enabled, only the item that was first selected in the list is returned - which is not very useful, so see elm_genlist_selected_items_get() for when multi-selection is used).
If no item is selected, None is returned.
See also
selected_item_get
¶selected_items
¶It returns a list of the selected items. This list is only valid so long as the selection doesn’t change (no items are selected or unselected, or unselected implicitly by deletion). The list contains genlist items. The order of the items in this list is the order which they were selected, i.e. the first item in this list is the first item that was selected, and so on.
Note
If not in multi-select mode, consider using function
Genlist.selected_item
instead.
See also
tuple of GenlistItem
selected_items_get
¶tree_effect_enabled
¶Genlist tree effect.
bool
tree_effect_enabled_get
¶tree_effect_enabled_set
¶efl.elementary.
GenlistItem
(GenlistItemClass item_class, item_data=None, GenlistItem parent_item=None, Elm_Genlist_Item_Type flags=enums.ELM_GENLIST_ITEM_NONE, func=None, func_data=None, *args, **kwargs)¶Bases: efl.elementary.__init__.ObjectItem
item_data – Data that defines the model of this row.
This value will be given to methods of item_class
such as
GenlistItemClass.text_get()
.
item_class (GenlistItemClass
) – a valid instance that defines the behavior of this
row.
parent_item (GenlistItem
) – If this is a tree child, then the
parent item must be given here, otherwise it may be
None. The parent must have the flag
ELM_GENLIST_ITEM_SUBITEMS
set.
flags (Genlist item types) – defines special behavior of this item:
func –
if not None, this must be a callable to be called back when the item is selected. The function signature is:
func(item, obj, item_data)
Where item
is the handle, obj
is the Evas object
that represents this item, and item_data
is the
value given as parameter to this function.
func_data – This value will be passed to the callback.
all_contents_unset
¶This instructs genlist to release references to contents in the item, meaning that they will no longer be managed by genlist and are floating “orphans” that can be re-used elsewhere if the user wants to.
The list of now orphans objects
list
New in version 1.18.
Warning
Don’t forget to do something with the returned objects, they are hidden in the canvas, but still alive. You should at least delete them if you don’t need to reuse.
append_to
¶Append a new item (add as last row) to this genlist.
genlist (Genlist
) – The Genlist upon which this item is to be appended.
bring_in
¶This causes genlist to jump to the item and show it (by animatedly scrolling), if it is not fully visible. This may use animation and take a some time to do so.
scrollto_type (Genlist items’ scroll-to types) – Where to position the item in the viewport.
See also
data
¶User data (model) for the item.
Changed in version 1.16: Property is now also writable
data_get
¶data_set
¶decorate_mode
¶A genlist mode is a different way of selecting an item. Once a mode is activated on an item, any other selected item is immediately unselected. This feature provides an easy way of implementing a new kind of animation for selecting an item, without having to entirely rewrite the item style theme. However, the Genlist.selected_* API can’t be used to get what item is activate for a mode.
The current item style will still be used, but applying a genlist mode to an item will select it using a different kind of animation.
The current active item for a mode can be found at
Genlist.decorated_item
.
The characteristics of genlist mode are:
Only one mode can be active at any time, and for only one item.
Genlist handles deactivating other items when one item is activated.
A mode is defined in the genlist theme (edc), and more modes can easily be added.
A mode style and the genlist item style are different things. They can be combined to provide a default style to the item, with some kind of animation for that item when the mode is activated.
When a mode is activated on an item, a new view for that item is created. The theme of this mode defines the animation that will be used to transit the item from the old view to the new view. This second (new) view will be active for that item while the mode is active on the item, and will be destroyed after the mode is totally deactivated from that item.
(unicode decorate_it_type, bool decorate_it_set)
See also
decorate_mode_get
¶decorate_mode_set
¶demote
¶Demote an item to the end of the list
expanded
¶This function flags the item of type #ELM_GENLIST_ITEM_TREE as expanded or not.
The theme will respond to this change visually, and a signal “expanded” or “contracted” will be sent from the genlist with a the item that has been expanded/contracted.
Calling this function won’t show or hide any child of this item (if it is a parent). You must manually delete and create them on the callbacks of the “expanded” or “contracted” signals.
bool
expanded_depth
¶Get the depth of expanded item.
int
expanded_depth_get
¶expanded_get
¶expanded_set
¶fields_update
¶This updates an item’s part by calling item’s fetching functions again to get the contents, texts and states. Use this when the original item data has changed and the changes are desired to be reflected. Parts argument is used for globbing to match ‘*’, ‘?’, and ‘.’ It can be used at updating multi fields.
Use elm_genlist_realized_items_update() to update an item’s all property.
parts (unicode) – The name of item’s part
itf (Genlist items’ field types) – The type of item’s part type
See also
flip
¶The flip state of a given genlist item. Flip mode overrides current item object. It can be used for on-the-fly item replace. Flip mode can be used with/without decorate mode.
bool
flip_get
¶flip_set
¶index
¶Get the index of the item. It is only valid once displayed.
int
index_get
¶insert_after
¶Insert a new item (row) after another item in this genlist.
after_item (GenlistItem
) – a reference item to use, the new item
will be inserted after it.
insert_before
¶Insert a new item (row) before another item in this genlist.
before_item (GenlistItem
) – a reference item to use, the new item
will be inserted before it.
item_class_update
¶This sets another class of the item, changing the way that it is displayed. After changing the item class, elm_genlist_item_update() is called on the item.
next
¶This returns the item placed after the item
, on the container
genlist.
See also
next_get
¶parent
¶This returns the item that was specified as parent of the item on elm_genlist_item_append() and insertion related functions.
parent_get
¶prepend_to
¶Prepend a new item (add as first row) to this Genlist.
genlist (Genlist
) – The Genlist upon which this item is to be prepended.
prev
¶This returns the item placed before the item
, on the container
genlist.
See also
prev_get
¶promote
¶Promote an item to the top of the list
select_mode
¶Item’s select mode. Possible values are:
select_mode_get
¶select_mode_set
¶selected
¶This sets the selected state of an item. If multi selection is
not enabled on the containing genlist and selected
is True
,
any other previously selected items will get unselected in favor of
this new one.
bool
selected_get
¶selected_set
¶show
¶This causes genlist to jump to the item and show it (by jumping to that position), if it is not fully visible.
scrollto_type (Genlist items’ scroll-to types) – Where to position the item in the viewport.
See also
sorted_insert
¶Insert a new item into the sorted genlist object
genlist (Genlist
) – The Genlist object
comparison_func –
The function called for the sort.
This must be a callable and will be called
to insert the item in the right position. The two arguments passed
are two GenlistItem
to compare. The function must return
1 if item1
comes before item2
, 0 if the two items
are equal or -1 otherwise.
Signature is:
func(item1, item2)->int
This inserts an item in the genlist based on user defined comparison function. The two arguments passed to the function are genlist items to compare.
subitems_clear
¶This removes all items that are children (and their descendants) of the item.
subitems_count
¶Get the number of subitems.
The number of subitems, 0 on error.
int
New in version 1.9.
subitems_get
¶Get the list of subitems.
The list of subitems.
list of GenlistItem
New in version 1.9.
type
¶This function returns the item’s type. Normally the item’s type. If it failed, return value is ELM_GENLIST_ITEM_MAX
type_get
¶update
¶This updates an item by calling all the item class functions again to get the contents, texts and states. Use this when the original item data has changed and the changes are desired to be reflected.
Use elm_genlist_realized_items_update() to update all already realized items.
See also
efl.elementary.
GenlistItemClass
(item_style=None, text_get_func=None, content_get_func=None, state_get_func=None, del_func=None, decorate_item_style=None, decorate_all_item_style=None, filter_get_func=None, reusable_content_get_func=None, *args, **kwargs)¶Bases: object
This class should be created and handled to the Genlist itself.
It may be subclassed, in this case the methods text_get()
,
content_get()
, state_get()
and delete()
will
be used.
It may also be instantiated directly, given getters to override as constructor parameters.
item_style – the string that defines the genlist item theme to be used. The corresponding edje group will have this as suffix.
text_get_func – if provided will override the
behavior defined by text_get()
in this class. Its
purpose is to return the label string to be used by a
given part and row. This function should have the
signature:
func(obj, part, item_data) -> string
content_get_func – if provided will override the behavior
defined by content_get()
in this class. Its purpose is
to return the icon object to be used (swallowed) by a
given part and row. This function should have the
signature:
func(obj, part, item_data) -> obj
state_get_func – if provided will override the
behavior defined by state_get()
in this class. Its
purpose is to return the boolean state to be used by a
given part and row. This function should have the
signature:
func(obj, part, item_data) -> bool
del_func – if provided will override the behavior
defined by delete()
in this class. Its purpose is to be
called when row is deleted, thus finalizing resources
and similar. This function should have the signature:
func(obj, part, item_data)
reusable_content_get_func – if provided will override the behavior
defined by reusable_content_get()
in this class.
Its purpose is to return the icon object to be used (swallowed) by a
given part and row. This can be used to reuse (cache) contents
(since 1.18)
This function should have the signature:
func(obj, part, item_data, old_content) -> obj
Note
In all these signatures, ‘obj’ means Genlist and ‘item_data’ is the value given to Genlist item append/prepend methods, it should represent your row model as you want.
content_get
¶To be called by Genlist for each row to get its icon.
obj – the Genlist instance
part – the part that is being handled.
item_data – the value given to genlist append/prepend.
icon object to be used and swallowed.
evas Object or None
decorate_all_item_style
¶Decorate all style of this item class.
decorate_item_style
¶The decoration style of this item class.
filter_get
¶To be called by Genlist for each row when filter is enabled.
obj – the Genlist instance
key – the filter key given in the filter_set function
item_data – the value given to genlist append/prepend.
Wheter the item should be visible or not
bool
free
¶Free the C level struct.
New in version 1.8.
item_style
¶The style of this item class.
ref
¶Increase the C level reference count.
New in version 1.8.
reusable_content_get
¶To be called by Genlist for each row to get its icon.
obj – the Genlist instance
part – the part that is being handled.
item_data – the value given to genlist append/prepend.
old_content – the old (if available) content that can be used instead of creating a new object every time.
icon object to be used and swallowed.
evas Object or None
state_get
¶To be called by Genlist for each row to get its state.
obj – the Genlist instance
part – the part that is being handled.
item_data – the value given to genlist append/prepend.
state to be used.
bool or None
text_get
¶To be called by Genlist for each row to get its label.
obj – the Genlist instance
part – the part that is being handled.
item_data – the value given to genlist append/prepend.
label to be used.
str or None
unref
¶Decrease the C level reference count.
New in version 1.8.