A toolbar is a widget that displays a list of items inside a box. It can be scrollable, show a menu with items that don’t fit to toolbar size or even crop them.
Only one item can be selected at a time.
Items can have multiple states, or show menus when selected by the user.
clicked
- when the user clicks on a toolbar item and becomes selected.
longpressed
- when the toolbar is pressed for a certain amount of time.
item,focused
- When the toolbar item has received focus. (since 1.10)
item,unfocused
- When the toolbar item has lost focus. (since 1.10)
default
transparent
- no background or shadow, just show the content
default
- label of the toolbar item
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)
efl.elementary.
ELM_TOOLBAR_SHRINK_NONE
¶Set toolbar minimum size to fit all the items
efl.elementary.
ELM_TOOLBAR_SHRINK_HIDE
¶Hide exceeding items
efl.elementary.
ELM_TOOLBAR_SHRINK_SCROLL
¶Allow accessing exceeding items through a scroller
efl.elementary.
ELM_TOOLBAR_SHRINK_MENU
¶Inserts a button to pop up a menu with exceeding items
efl.elementary.
ELM_TOOLBAR_SHRINK_EXPAND
¶Expand all items according the size of the toolbar.
Where to position the item in the toolbar.
efl.elementary.
ELM_TOOLBAR_ITEM_SCROLLTO_NONE
¶No scrollto
efl.elementary.
ELM_TOOLBAR_ITEM_SCROLLTO_IN
¶To the nearest viewport
efl.elementary.
ELM_TOOLBAR_ITEM_SCROLLTO_FIRST
¶To the first of viewport
efl.elementary.
ELM_TOOLBAR_ITEM_SCROLLTO_MIDDLE
¶To the middle of viewport
efl.elementary.
ELM_TOOLBAR_ITEM_SCROLLTO_LAST
¶To the last of viewport
efl.elementary.
Toolbar
(Object parent, *args, **kwargs)¶Bases: efl.elementary.__init__.LayoutClass
Changed in version 1.8: Inherits from LayoutClass.
parent (efl.evas.Object
) – The parent object
**kwargs – All the remaining keyword arguments are interpreted as properties of the instance
align
¶The alignment of the items.
Alignment of toolbar items, from 0.0
to indicates to align
left, to 1.0
, to align to right. 0.5
centralize
items.
Centered items by default.
float
align_get
¶align_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_clicked_add
¶When the user clicks on a toolbar item and becomes selected.
callback_clicked_del
¶callback_item_focused_add
¶When the toolbar item has received focus.
New in version 1.10.
callback_item_focused_del
¶callback_item_unfocused_add
¶When the toolbar item has lost focus.
New in version 1.10.
callback_item_unfocused_del
¶callback_longpressed_add
¶When the toolbar is pressed for a certain amount of time.
callback_longpressed_del
¶callback_selected_add
¶When the toolbar item is selected.
New in version 1.11.
callback_selected_del
¶callback_unselected_add
¶When the toolbar item is unselected.
New in version 1.11.
callback_unselected_del
¶first_item
¶Get the first item in the given toolbar widget’s list of items.
See also
first_item_get
¶homogeneous
¶Homogeneous mode.
This will enable the homogeneous mode where items are of the same size.
bool
homogeneous_get
¶homogeneous_set
¶horizontal
¶A toolbar’s orientation
By default, a toolbar will be horizontal. Change this property to create a vertical toolbar.
bool
horizontal_get
¶horizontal_set
¶icon_order_lookup
¶Icon lookup order, for toolbar items’ icons.
Icons added before calling this function will not be affected.
The default lookup order is ELM_ICON_LOOKUP_THEME_FDO
.
icon_order_lookup_get
¶icon_order_lookup_set
¶icon_size
¶The icon size, in pixels, to be used by toolbar items.
Note
Default value is 32
. It reads value from elm config.
int
icon_size_get
¶icon_size_set
¶item_append
¶item_find_by_label
¶Returns a toolbar item by its label.
label (string) – The label of the item to find.
The toolbar item matching label
or None
on failure.
items_count
¶Get the number of items in a toolbar
The number of items in toolbar
int
last_item
¶Get the last item in the given toolbar widget’s list of items.
See also
last_item_get
¶The parent object of the toolbar items’ menus.
Each item can be set as item menu, with ToolbarItem.menu
.
For more details about setting the parent for toolbar menus, see
parent
.
Object
more_item
¶Get the more item.
The more item can be changed with
text
and
content
.
more_item_get
¶reorder_mode
¶Reorder mode
bool
New in version 1.8.
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.
select_mode
¶The toolbar select mode.
select_mode_get
¶select_mode_set
¶selected_item
¶The selected item.
The selected item can be unselected with ToolbarItem.selected
.
The selected item always will be highlighted on toolbar.
See also
selected_items
selected_item_get
¶shrink_mode
¶The shrink state of toolbar.
The toolbar won’t scroll if ELM_TOOLBAR_SHRINK_NONE
, but will
enforce a minimum size so all the items will fit, won’t scroll and
won’t show the items that don’t fit if ELM_TOOLBAR_SHRINK_HIDE
,
will scroll if ELM_TOOLBAR_SHRINK_SCROLL
, and will create a
button to pop up excess elements with ELM_TOOLBAR_SHRINK_MENU
.
shrink_mode_get
¶shrink_mode_set
¶standard_priority
¶The standard priority of visible items in a toolbar
If the priority of the item is up to standard priority, it is shown in basic panel. The other items are located in more menu or panel. The more menu or panel can be shown when the more item is clicked.
int
transverse_expanded
¶Item’s transverse expansion.
bool
This will expand the transverse length of the item according the transverse length of the toolbar. The default is what the transverse length of the item is set according its min value (this property is False).
New in version 1.8.
transverse_expanded_get
¶transverse_expanded_set
¶efl.elementary.
ToolbarItem
(icon=None, label=None, callback=None, cb_data=None, *args, **kwargs)¶Bases: efl.elementary.__init__.ObjectItem
this item is selected, i.e., the user clicks over an unselected item.
If such function isn’t needed, just passing None
as func
is
enough. The same should be done for data
.
Toolbar will load icon image from fdo or current theme. This
behavior can be set by Toolbar.icon_order_lookup
function.
If an absolute path is provided it will load it direct from a file.
icon (string) – A string with icon name or the absolute path of an image file.
label (string) – The label of the item.
callback (function) – The function to call when the item is clicked.
append_to
¶Append item to the toolbar.
A new item will be created and appended to the toolbar, i.e., will be set as last item.
Items created with this method can be deleted with
delete()
toolbar (Toolbar
) – The toolbar this item should be appended to
The created item or None
upon failure.
bring_in
¶Show this item with scroll animation, when the toolbar can be scrolled.
New in version 1.8.
icon
¶The icon associated with the item.
Toolbar will load icon image from fdo or current theme. This
behavior can be set by Toolbar.icon_order_lookup
function.
If an absolute path is provided it will load it direct from a file.
See also
string
icon_file
¶Set the icon associated with item to an image in a binary buffer.
Note
The icon image set by this function can be changed
by icon
.
string or tuple of strings
icon_file_set
¶icon_get
¶icon_object
¶Get the icon object of item.
Icon
icon_object_get
¶icon_set
¶insert_after
¶Insert a new item into the toolbar object after item after
.
A new item will be created and added to the toolbar. Its position in
this toolbar will be just after item after
.
Items created with this method can be deleted with
delete()
after (ToolbarItem
) – The toolbar item to insert after.
The created item or None
upon failure.
insert_before
¶Insert a new item into the toolbar object before item before
.
A new item will be created and added to the toolbar. Its position in
this toolbar will be just before item before
.
Items created with this method can be deleted with
delete()
before (ToolbarItem
) – The toolbar item to insert before.
The created item or None
upon failure.
This property has two diffent functionalities. The object you get from
it is the Menu
object used by this
toolbar item, and setting it to True or False controls whether this item
is a menu or not.
If item wasn’t set as menu item, getting the value of this property sets it to be that.
Once it is set to be a menu, it can be manipulated through
Toolbar.menu_parent
and the
Menu
functions and properties.
So, items to be displayed in this item’s menu should be added with
efl.elementary.menu.Menu.item_add()
.
The following code exemplifies the most basic usage:
tb = Toolbar(win)
item = tb.item_append("refresh", "Menu")
item.menu = True
tb.menu_parent = win
menu = item.menu
menu.item_add(None, "edit-cut", "Cut")
menu_item = menu.item_add(None, "edit-copy", "Copy")
bool
next
¶Get the item after item
in toolbar.
Note
If it is the last item, None
will be returned.
See also
next_get
¶object_get
¶prepend_to
¶Prepend item to the toolbar.
A new item will be created and prepended to the toolbar, i.e., will be set as first item.
Items created with this method can be deleted with
delete()
toolbar (Toolbar
) – The toolbar this item should be prepended to
The created item or None
upon failure.
prev
¶Get the item before item
in toolbar.
Note
If it is the first item, None
will be returned.
See also
prev_get
¶priority
¶The priority of a toolbar item.
This is used only when the toolbar shrink mode is set to
ELM_TOOLBAR_SHRINK_MENU
or ELM_TOOLBAR_SHRINK_HIDE
.
When space is less than required, items with low priority will be
removed from the toolbar and added to a dynamically-created menu, while
items with higher priority will remain on the toolbar, with the same
order they were added.
int
priority_get
¶priority_set
¶selected
¶The selected state of an item.
This reflects the selected state of the given item. True
for
selected, False
for not selected.
If a new item is selected the previously selected will be unselected.
Previously selected item can be get with function
Toolbar.selected_item
.
Selected items will be highlighted.
See also
bool
selected_get
¶selected_set
¶separator
¶Whether item is a separator or not.
Items aren’t set as separator by default.
If set as separator it will display separator theme, so won’t display icons or label.
bool
separator_get
¶separator_set
¶show
¶Show this item, when the toolbar can be scrolled.
New in version 1.8.
state
¶An item state.
state_add
¶state_del
¶state_get
¶state_next
¶state_prev
¶state_set
¶state_unset
¶