Toolbar

Window toolbar.

Modulerequire("yue.gui")
TypeClass
PlatformsmacOS

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

Return

Toolbar

Methods

setdefaultitemidentifiers(identifiers)

Set the identifiers of default items that would show in toolbar.

Parameters

setalloweditemidentifiers(identifiers)

Set the identifiers of the items that are allowed to show in toolbar.

Parameters

setallowcustomization(allow)

Set whether users are allowed to customize the toolbar.

Parameters

setdisplaymode(mode)

Set the display mode of the toolbar items.

Parameters

setvisible(visible)

Set whether toolbar is visible.

Parameters

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

Return

Toolbar::Item