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 { ... }
}
NSToolbar
only.Expand description
Provided Methods§
Sourceunsafe fn toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar(
&self,
toolbar: &NSToolbar,
item_identifier: &NSToolbarItemIdentifier,
flag: bool,
) -> Option<Retained<NSToolbarItem>>
Available on crate feature NSToolbarItem
only.
unsafe fn toolbar_itemForItemIdentifier_willBeInsertedIntoToolbar( &self, toolbar: &NSToolbar, item_identifier: &NSToolbarItemIdentifier, flag: bool, ) -> Option<Retained<NSToolbarItem>>
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.
Sourceunsafe fn toolbarDefaultItemIdentifiers(
&self,
toolbar: &NSToolbar,
) -> Retained<NSArray<NSToolbarItemIdentifier>>
unsafe fn toolbarDefaultItemIdentifiers( &self, toolbar: &NSToolbar, ) -> Retained<NSArray<NSToolbarItemIdentifier>>
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.
Sourceunsafe fn toolbarAllowedItemIdentifiers(
&self,
toolbar: &NSToolbar,
) -> Retained<NSArray<NSToolbarItemIdentifier>>
unsafe fn toolbarAllowedItemIdentifiers( &self, toolbar: &NSToolbar, ) -> Retained<NSArray<NSToolbarItemIdentifier>>
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.
Sourceunsafe fn toolbarSelectableItemIdentifiers(
&self,
toolbar: &NSToolbar,
) -> Retained<NSArray<NSToolbarItemIdentifier>>
unsafe fn toolbarSelectableItemIdentifiers( &self, toolbar: &NSToolbar, ) -> Retained<NSArray<NSToolbarItemIdentifier>>
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.
Sourceunsafe fn toolbarImmovableItemIdentifiers(
&self,
toolbar: &NSToolbar,
) -> Retained<NSSet<NSToolbarItemIdentifier>>
unsafe fn toolbarImmovableItemIdentifiers( &self, toolbar: &NSToolbar, ) -> Retained<NSSet<NSToolbarItemIdentifier>>
Items in this set cannot be dragged or removed by the user.
Sourceunsafe fn toolbar_itemIdentifier_canBeInsertedAtIndex(
&self,
toolbar: &NSToolbar,
item_identifier: &NSToolbarItemIdentifier,
index: NSInteger,
) -> bool
unsafe fn toolbar_itemIdentifier_canBeInsertedAtIndex( &self, toolbar: &NSToolbar, item_identifier: &NSToolbarItemIdentifier, index: NSInteger, ) -> bool
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.
Sourceunsafe fn toolbarWillAddItem(&self, notification: &NSNotification)
unsafe fn toolbarWillAddItem(&self, notification: &NSNotification)
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.
Sourceunsafe fn toolbarDidRemoveItem(&self, notification: &NSNotification)
unsafe fn toolbarDidRemoveItem(&self, notification: &NSNotification)
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
impl ProtocolType for dyn NSToolbarDelegate
impl<T> ImplementedBy<T> for dyn NSToolbarDelegate
Implementations on Foreign Types§
impl<T> NSToolbarDelegate for ProtocolObject<T>where
T: ?Sized + NSToolbarDelegate,
Implementors§
impl NSToolbarDelegate for NSTabViewController
NSTabViewController
only.