pub trait ToolbarDelegate {
const NAME: &'static str;
fn allowed_item_identifiers(&self) -> Vec<ItemIdentifier>;
fn default_item_identifiers(&self) -> Vec<ItemIdentifier>;
fn item_for(&self, _identifier: &str) -> &ToolbarItem;
fn subclass_name(&self) -> &'static str { ... }
fn did_load(&mut self, _toolbar: Toolbar) { ... }
fn selectable_item_identifiers(&self) -> Vec<ItemIdentifier> { ... }
}
Available on crate feature
appkit
only.Expand description
A trait that you can implement to have your struct/etc act as an NSToolbarDelegate
.
Required Associated Constants
Required Methods
fn allowed_item_identifiers(&self) -> Vec<ItemIdentifier>
fn allowed_item_identifiers(&self) -> Vec<ItemIdentifier>
What items are allowed in this toolbar.
fn default_item_identifiers(&self) -> Vec<ItemIdentifier>
fn default_item_identifiers(&self) -> Vec<ItemIdentifier>
The default items in this toolbar.
fn item_for(&self, _identifier: &str) -> &ToolbarItem
fn item_for(&self, _identifier: &str) -> &ToolbarItem
For a given identifier
, return the ToolbarItem
that should be displayed.
Provided Methods
fn subclass_name(&self) -> &'static str
fn subclass_name(&self) -> &'static str
You should rarely (read: probably never) need to implement this yourself.
It simply acts as a getter for the associated NAME
const on this trait.
This method can be used to configure your toolbar, if you need to do things involving the handle. Unlike some other view types, it’s not strictly necessary, and is provided in the interest of a uniform and expectable API.
fn selectable_item_identifiers(&self) -> Vec<ItemIdentifier>
fn selectable_item_identifiers(&self) -> Vec<ItemIdentifier>
The default items in this toolbar. This defaults to a blank Vec
, and is an optional
method - mostly useful for Preferences windows.