Trait NSToolbarDelegate

Source
pub unsafe trait NSToolbarDelegate: NSObjectProtocol + MainThreadOnly {
    // Provided methods
    unsafe fn toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar(
        &self,
        toolbar: &NSToolbar,
        item_identifier: &NSToolbarItemIdentifier,
        flag: bool,
    ) -> Option<Retained<NSToolbarItem>>
       where Self: Sized + Message { ... }
    unsafe fn toolbarDefaultItemIdentifiers(
        &self,
        toolbar: &NSToolbar,
    ) -> Retained<NSArray<NSToolbarItemIdentifier>>
       where Self: Sized + Message { ... }
    unsafe fn toolbarAllowedItemIdentifiers(
        &self,
        toolbar: &NSToolbar,
    ) -> Retained<NSArray<NSToolbarItemIdentifier>>
       where Self: Sized + Message { ... }
    unsafe fn toolbarSelectableItemIdentifiers(
        &self,
        toolbar: &NSToolbar,
    ) -> Retained<NSArray<NSToolbarItemIdentifier>>
       where Self: Sized + Message { ... }
    unsafe fn toolbarImmovableItemIdentifiers(
        &self,
        toolbar: &NSToolbar,
    ) -> Retained<NSSet<NSToolbarItemIdentifier>>
       where Self: Sized + Message { ... }
    unsafe fn toolbar_itemIdentifier_canBeInsertedAtIndex(
        &self,
        toolbar: &NSToolbar,
        item_identifier: &NSToolbarItemIdentifier,
        index: NSInteger,
    ) -> bool
       where Self: Sized + Message { ... }
    unsafe fn toolbarWillAddItem(&self, notification: &NSNotification)
       where Self: Sized + Message { ... }
    unsafe fn toolbarDidRemoveItem(&self, notification: &NSNotification)
       where Self: Sized + Message { ... }
}
Available on crate feature NSToolbar only.
Expand description

Provided Methods§

Source

unsafe fn toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar( &self, toolbar: &NSToolbar, item_identifier: &NSToolbarItemIdentifier, flag: bool, ) -> Option<Retained<NSToolbarItem>>
where Self: Sized + Message,

Available on crate feature NSToolbarItem only.

Given an item identifier, this method returns an item. Note that it is expected that each toolbar receives its own distinct copies and each time this method is called a new item must be returned. If the item has a custom view, that view should be in place when the item is returned. Finally, do not assume the returned item is going to be added as an active item in the toolbar. In fact, the toolbar may ask for items here in order to construct the customization palette. If willBeInsertedIntoToolbar is YES, the returned item will be inserted, and you can expect toolbarWillAddItem: is about to be posted.

Source

unsafe fn toolbarDefaultItemIdentifiers( &self, toolbar: &NSToolbar, ) -> Retained<NSArray<NSToolbarItemIdentifier>>
where Self: Sized + Message,

Returns the ordered list of items to be shown in the toolbar by default. If during initialization, no overriding values are found in the user defaults, or if the user chooses to revert to the default items this set will be used.

Source

unsafe fn toolbarAllowedItemIdentifiers( &self, toolbar: &NSToolbar, ) -> Retained<NSArray<NSToolbarItemIdentifier>>
where Self: Sized + Message,

Returns the list of all allowed items by identifier. By default, the toolbar does not assume any items are allowed so every allowed item must be explicitly listed. The set of allowed items is used to construct the customization palette. The order of items does not necessarily guarantee the order of appearance in the palette. At minimum, you should return the default item list.

Source

unsafe fn toolbarSelectableItemIdentifiers( &self, toolbar: &NSToolbar, ) -> Retained<NSArray<NSToolbarItemIdentifier>>
where Self: Sized + Message,

Optional method. Those wishing to indicate item selection in a toolbar should implement this method to return a non-empty array of selectable item identifiers. If implemented, the toolbar will remember and display the selected item with a special highlight. A selected item is one whose item identifier matches the current selected item identifier. Clicking on an item whose identifier is selectable will automatically update the toolbar’s selectedItemIdentifier when possible. See selectedItemIdentifier for more details.

Source

unsafe fn toolbarImmovableItemIdentifiers( &self, toolbar: &NSToolbar, ) -> Retained<NSSet<NSToolbarItemIdentifier>>
where Self: Sized + Message,

Items in this set cannot be dragged or removed by the user.

Source

unsafe fn toolbar_itemIdentifier_canBeInsertedAtIndex( &self, toolbar: &NSToolbar, item_identifier: &NSToolbarItemIdentifier, index: NSInteger, ) -> bool
where Self: Sized + Message,

Whether or not an item can be moved to a specified position in the toolbar. If implemented, this method will be called during a user drag and does not necessarily indicate the final position of an item. An index of NSNotFound indicates the item would be removed from the toolbar.

Source

unsafe fn toolbarWillAddItem(&self, notification: &NSNotification)
where Self: Sized + Message,

Before a new item is added to the toolbar, this notification is posted. This is the best place to notice a new item is going into the toolbar. For instance, if you need to cache a reference to the toolbar item or need to set up some initial state, this is the best place to do it. The notification object is the toolbar to which the item is being added. The item being added and its new index can be found by referencing NSToolbarItemKey and NSToolbarNewIndexKey in the userInfo dictionary respectively.

Source

unsafe fn toolbarDidRemoveItem(&self, notification: &NSNotification)
where Self: Sized + Message,

After an item is removed from a toolbar the notification is sent. This allows the chance to tear down information related to the item that may have been cached. The notification object is the toolbar from which the item is being removed. The item being removed is found by referencing the NSToolbarItemKey in the userInfo.

Trait Implementations§

Source§

impl ProtocolType for dyn NSToolbarDelegate

Source§

const NAME: &'static str = "NSToolbarDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn NSToolbarDelegate

Implementations on Foreign Types§

Source§

impl<T> NSToolbarDelegate for ProtocolObject<T>

Implementors§

Source§

impl NSToolbarDelegate for NSTabViewController

Available on crate feature NSTabViewController only.