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

Used to cache subclass creations on the Objective-C side. You can just set this to be the name of your view type. This value must be unique per-type.

Required Methods

What items are allowed in this toolbar.

The default items in this toolbar.

For a given identifier, return the ToolbarItem that should be displayed.

Provided Methods

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.

The default items in this toolbar. This defaults to a blank Vec, and is an optional method - mostly useful for Preferences windows.

Implementors