Class

NSToolbarItem

The NSToolbarItem class defines each item contained within a window’s NSToolbar instance.

Overview

If an NSToolbarItem has an NSSearchField instance as its view, that search field automatically has its minimum and maximum size adjusted to the system-specified standard values (currently 140 and 240 points).

Symbols

Creating a toolbar item

init(itemIdentifier: String)

Initialize the receiver with a given identifier.

Managing attributes

var itemIdentifier: String

The receiver’s identifier.

var toolbar: NSToolbar?

The toolbar that is using the receiver.

var label: String

The receiver’s label.

var paletteLabel: String

The label that appears when the receiver is in the customization palette.

var toolTip: String?

The tooltip used when the receiver is displayed in the toolbar.

var menuFormRepresentation: NSMenuItem?

The receiver’s menu form representation.

var tag: Int

The receiver’s tag.

var target: AnyObject?

The receiver’s target.

var action: Selector?

The receiver’s action.

var isEnabled: Bool

A Boolean value that indicates whether the receiver is enabled.

var image: NSImage?

The image of the receiver.

var view: NSView?

The receiver’s view.

var minSize: NSSize

The receiver’s minimum size.

var maxSize: NSSize

The receiver’s maximum size.

Visibility priority

var visibilityPriority: Int

The receiver’s visibility priority.

Validation

func validate()

This method is called by the receiver’s toolbar during validation.

var autovalidates: Bool

A Boolean value that indicates whether the receiver is automatically validated by the toolbar.

Controlling duplicates

var allowsDuplicatesInToolbar: Bool

A Boolean value that indicates whether the receiver can be represented in the toolbar at more than one position.

Constants

Standard Identifiers

NSToolbarItem defines the following standard toolbar item identifiers.

Item Priority

When a toolbar does not have enough space to fit all its items, it must push some items into the overflow menu. These values allow you to suggest a priority for a toolbar item.