Toolbar
Window toolbar.
Module | require("yue.gui") |
Type | Class |
Platforms | macOS |
This view is only implemented for macOS by wrapping
NSToolbar
.
The API is still experimental and will be changed in future. Currently certain
items are not aligned correctly in toolbar.
The toolbar items are not added manually like the normal views, instead you
have to implement the get_item
delegate which creates items on request, and
then call SetDefaultItemIdentifiers
to specify the default items to show.
Class methods
create(identifier)
Create a new Toolbar
view with identifier
.
Within the application all toolbars with the same identifier are synchronized to maintain the same state, including for example, the display mode and item order. The identifier is used as the autosave name for toolbars that save their configuration.
Parameters
string
identifier
Return
Toolbar
Methods
setdefaultitemidentifiers(identifiers)
Set the identifiers of default items that would show in toolbar.
Parameters
table
identifiers - An array of toolbar items' identifiers.
setalloweditemidentifiers(identifiers)
Set the identifiers of the items that are allowed to show in toolbar.
Parameters
table
identifiers - An array of toolbar items' identifiers.
setallowcustomization(allow)
Set whether users are allowed to customize the toolbar.
Parameters
boolean
allow
setdisplaymode(mode)
Set the display mode of the toolbar items.
Parameters
Toolbar::DisplayMode
mode
setvisible(visible)
Set whether toolbar is visible.
Parameters
boolean
visible
isvisible()
Return whether toolbar is visible.
Return
boolean
getidentifier()
Return the identifier of the toolbar.
Return
string
Delegates
getitem(toolbar, identifier)
Called lazily when the toolbar is going to get the item with identifier
.
You should not cache the item to be returned.
Parameters
Toolbar
toolbarstring
identifier
Return
Toolbar::Item