Instance Method

toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:

Returns the toolbar item for the specified identifier.

Declaration

- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSToolbarItemIdentifier)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag;

Parameters

toolbar

The toolbar making the request.

itemIdentifier

The identifier of the toolbar item being requested.

flag

A Boolean indicating whether the item is inserted immediately into the toolbar. A value of YES means the item is inserted into the toolbar. A value of NO means the item is added to the toolbar’s configuration palette. The same item may be requested more than once with different values for this flag.

Return Value

The requested toolbar item or nil to indicate that the specified item is not supported. When the same item is requested again, you may return the same NSToolbarItem object or a different one.

Discussion

This method is called for tab view interfaces that use the NSTabViewControllerTabStyleToolbar style. Use this method to create toolbar items for any custom identifiers you specified in the toolbarAllowedItemIdentifiers: and toolbarDefaultItemIdentifiers: methods.

If you override this method, you must call super at some point in your implementation. The default implementation of this method returns toolbar items for the tabs in the tab bar interface. The identifier for each toolbar item is the same as the identifier for the corresponding tab view item. Similarly, the toolbar item’s label, image and toolTip properties are bound to those of the corresponding tab view item.

See Also

Responding to Toolbar Events

- toolbarAllowedItemIdentifiers:

Returns the array of identifier strings for the allowed toolbar items.

- toolbarDefaultItemIdentifiers:

Returns the array of identifier strings for the default toolbar items.

- toolbarSelectableItemIdentifiers:

Returns the array of identifier strings for the selectable toolbar items