| Framework |
Carbon/Carbon.h |
| Declared in | HIToolbar.h |
HIToolbar is the Carbon equivalent of the
Cocoa toolbar (specifically, the NSToolbar and NSToolbarItem classes). The
toolbar object and the items associated with a toolbar are both subclassed
from HIObject. Toolbar items can have HIViews associated with them.
For more information, see Using HIToolbar.
HIToolbarChangeAttributes
HIToolbarCopyIdentifier
HIToolbarCopyItems
HIToolbarGetAttributes
HIToolbarGetDelegate
HIToolbarSetDelegate
HIToolbarGetDisplayMode
HIToolbarSetDisplayMode
HIToolbarGetDisplaySize
HIToolbarSetDisplaySize
HIToolbarCreateItemWithIdentifier
HIToolbarAppendItem
HIToolbarInsertItemAtIndex
HIToolbarRemoveItemAtIndex
HIToolbarItemCreate
HIToolbarSetItemsWithIdentifiers
HIToolbarGetSelectedItemInWindow
HIToolbarItemGetToolbar
HIToolbarItemGetAttributes
HIToolbarItemGetAttributesInWindow
HIToolbarItemChangeAttributes
HIToolbarItemChangeAttributesInWindow
HIToolbarItemCopyHelpText
HIToolbarItemSetHelpText
HIToolbarItemCopyIdentifier
HIToolbarItemCopyImage
HIToolbarItemSetImage
HIToolbarItemCopyLabel
HIToolbarItemSetLabel
HIToolbarItemCopyMenu
HIToolbarItemSetMenu
HIToolbarItemGetCommandID
HIToolbarItemSetCommandID
HIToolbarItemIsEnabled
HIToolbarItemSetEnabled
HIToolbarItemSetIconRef
HIToolbarItemConfigDataChanged
Appends an item to the toolbar.
OSStatus HIToolbarAppendItem ( HIToolbarRef inToolbar, HIToolbarItemRef inItem );
The toolbar to receive the new item.
The item reference of the toolbar item you are adding.
An operating system result code.
This function appends an item to the end of a toolbar. Generally, you should always add items via identifier, and not with this routine.
HIToolbar.hChanges the attributes of a toolbar.
OSStatus HIToolbarChangeAttributes ( HIToolbarRef inToolbar, OptionBits inAttrsToSet, OptionBits inAttrsToClear );
The toolbar whose attributes you want to change.
The attributes you want to set. For possible values, see “Toolbar Attributes.”
The attributes you want to clear. For possible values, see “Toolbar Attributes.”
An operating system result code.
HIToolbar.hObtains the identifier for a toolbar.
OSStatus HIToolbarCopyIdentifier ( HIToolbarRef inToolbar, CFStringRef *outIdentifier );
The toolbar whose identifier you want to obtain.
The identifier. You must release it when you are finished with it.
An operating system result code.
HIToolbar.hObtains the array of toolbar items for a toolbar.
OSStatus HIToolbarCopyItems ( HIToolbarRef inToolbar, CFArrayRef *outItems );
The toolbar whose items you want to receive.
The array of toolbar items owned by the toolbar. You must release the array when you are finished with it.
An operating system result code.
HIToolbar.hCreates a toolbar.
OSStatus HIToolbarCreate ( CFStringRef inIdentifier, OptionBits inAttributes, HIToolbarRef *outToolbar );
The identifier of the toolbar. If you specify that the toolbar auto-saves its configuration, this identifier is used to mark the config info in your application’s preferences. You must specify an identifier.
Any attributes you want to set. For possible values, see “Toolbar Attributes.”
The toolbar reference to your new toolbar.
An operating system result code.
HIToolbar.hCreates a toolbar item.
OSStatus HIToolbarCreateItemWithIdentifier ( HIToolbarRef inToolbar, CFStringRef inIdentifier, CFTypeRef inConfigData, HIToolbarItemRef *outItem );
The toolbar you are adding to.
The identifier of the item you want to add.
Any config data required by the item to safely
construct. Standard items do not require any extra data, so NULL can
be passed.
The newly created toolbar item.
An operating system result code.
This function creates an item specified by a particular identifier. Using this function allows you to create any item a delegate supports by naming its identifier. It also allows you to create standard items supplied by the Toolbox, such as the separator item.
HIToolbar.hObtains the attributes for the given toolbar.
OSStatus HIToolbarGetAttributes ( HIToolbarRef inToolbar, OptionBits *outAttributes );
The toolbar whose attributes you desire.
The toolbar’s attributes. For details, see “Toolbar Attributes.”
An operating system result code.
HIToolbar.hReturns the current delegate in use by a toolbar.
HIObjectRef HIToolbarGetDelegate ( HIToolbarRef inToolbar );
The toolbar you want the delegate from.
An HIObjectRef.
The delegate handles the event processing for the toolbar.
HIToolbar.hObtains the current display mode of a toolbar.
OSStatus HIToolbarGetDisplayMode ( HIToolbarRef inToolbar, HIToolbarDisplayMode *outDisplayMode );
The toolbar whose display mode you want to receive.
The display mode.
An operating system result code.
HIToolbar.hObtains the current display size of a toolbar.
OSStatus HIToolbarGetDisplaySize ( HIToolbarRef inToolbar, HIToolbarDisplaySize *outSize );
The toolbar whose display size you want to get.
The display size.
An operating system result code.
HIToolbar.h
Obtains the toolbar item that is selected in a window.
OSStatus HIToolbarGetSelectedItemInWindow ( HIToolbarRef inToolbar, WindowRef inWindow, HIToolbarItemRef *outItem );
The toolbar in question.
A window containing the toolbar.
On return, the toolbar item that is selected
in the specified window, or NULL if
no item is selected.
An operating system result code.
Each window that shares a toolbar may have a different selected
item. The HIToolbarGetSelectedItemInWindow function
returns the selected item in a particular window.
HIToolbar.hInserts a toolbar item at a given index into a toolbar.
OSStatus HIToolbarInsertItemAtIndex ( HIToolbarRef inToolbar, HIToolbarItemRef inItem, CFIndex inIndex );
The toolbar to receive the new item.
The item reference of the toolbar item you are adding.
The index at which you want to add the item. This index is zero-based.
An operating system result code.
Generally, you should always add items via identifier, and not with this routine.
HIToolbar.hChanges the attributes of a toolbar item.
OSStatus HIToolbarItemChangeAttributes ( HIToolbarItemRef inItem, OptionBits inAttrsToSet, OptionBits inAttrsToClear );
The item in question.
The attributes to set on the item. For possible
attributes, see “Toolbar Item Attributes.”
Use kHIToolbarItemNoAttributes if
you are clearing attributes.
The attributes to clear on the item. This
value can be kHIToolbarItemNoAttributes if
you are setting attributes.
An operating system result code.
Only those attributes defined by the kHIToolbarItemMutableAttrs constant
can be passed into this function.
HIToolbar.h
Changes the attributes of a toolbar item in a specific window.
OSStatus HIToolbarItemChangeAttributesInWindow ( HIToolbarItemRef inItem, WindowRef inWindow, OptionBits inAttrsToSet, OptionBits inAttrsToClear, OptionBits inAttrsToNoLongerOverride );
The item in question.
The window containing the item in question.
The attributes to set on the item. For possible
attributes, see “Toolbar Item Attributes.”
Use kHIToolbarItemNoAttributes if
you are clearing attributes and have no attributes to set.
The attributes to clear on the item. This
value can be kHIToolbarItemNoAttributes if
you are setting attributes and have no attributes to clear.
The attributes that are to no longer be overridden. Calling this function causes the attributes to be removed from the override mask for the toolbar item in the specified window. Their effective values revert to their non-window-specific attribute values.
An operating system result code.
This function allows the attributes of a toolbar item in the
specified window to be overridden. The attributes used to draw the
view of a toolbar item in a particular window are determined by
combining the non-window-specific attributes for the item set by HIToolbarItemChangeAttributes with the
window-specific attributes set by this function. As a result, your
application can have a toolbar that is shared across several windows
with a toolbar item that is enabled in one window and disabled in
another window.
When HIToolbarItemChangeAttributesInWindow is
called to set or clear attributes, the toolbar item adds the changed
attributes to a bitmask of attributes, thereby recording which attributes
are overridden for a particular window. Once an attribute is overridden for
a window (regardless of whether the attribute is set or cleared),
the attribute remains overridden for that window until HIToolbarItemChangeAttributesInWindow is
called with that attribute specified in the inAttrsToNoLongerOverride parameter.
Only those attributes defined by the kHIToolbarItemMutableAttrs constant
can be passed into this function. For details, see “Toolbar Item Attributes.”
HIToolbar.h
Tells the toolbar that the configuration for a toolbar item has changed.
OSStatus HIToolbarItemConfigDataChanged ( HIToolbarItemRef inItem );
The item whose configuration changed.
An operating system result code.
This function tells the toolbar that the config data for a toolbar item has changed and should be written to the toolbar configuration preferences. This function is used when a custom toolbar item has extra configuration data that has changed (for example, you’ve changed an alias that a toolbar item points to). This function does nothing if the toolbar is not set to auto-save its configuration.
HIToolbar.hObtains the help tag text for a toolbar item.
OSStatus HIToolbarItemCopyHelpText ( HIToolbarItemRef inItem, CFStringRef *outShortText, CFStringRef *outLongText );
The item in question.
The short help text. This is what is displayed
normally by the help tag system when the user hovers over the toolbar
item with the mouse. You should release this string when you are
finished with it. If you do not want to receive the short help text,
pass NULL for this parameter.
The long help text. This is what is displayed
by the help tag system when the user hovers over the toolbar item
with the mouse and holds the command key down. You should release
this string when you are finished with it. If you do not want to
receive the long help text, pass NULL for
this parameter.
An operating system result code.
HIToolbar.hObtains the identifier for a given toolbar item.
OSStatus HIToolbarItemCopyIdentifier ( HIToolbarItemRef inItem, CFStringRef *outIdentifier );
The item in question.
The identifier of the item. You should release this string when you are finished with it.
An operating system result code.
The toolbar uses this identifier when writing the config information to the preferences (if set up for auto-config).
HIToolbar.hObtains the image for a toolbar item.
OSStatus HIToolbarItemCopyImage ( HIToolbarItemRef inItem, CGImageRef *outImage );
The item in question.
The retained image. You should release it when finished with it.
An operating system result code.
This image is already retained by the time you receive it, so you can release it when you are done with it.
HIToolbar.hObtains the label for a toolbar item.
OSStatus HIToolbarItemCopyLabel ( HIToolbarItemRef inItem, CFStringRef *outLabel );
The item in question.
The label of the item. You should release this when you are finished with it.
An operating system result code.
HIToolbar.hObtains the submenu for a toolbar item.
OSStatus HIToolbarItemCopyMenu ( HIToolbarItemRef inItem, MenuRef *outMenu );
The item in question.
The retained menu. You should release it when you are finished with it.
An operating system result code.
HIToolbar.hCreates a toolbar item.
OSStatus HIToolbarItemCreate ( CFStringRef inIdentifier, OptionBits inOptions, HIToolbarItemRef *outItem );
The identifier of the item in question.
Any options for the item.
The item you created.
An operating system result code.
This function creates a toolbar item for use in a toolbar.
Typically, you call HIToolbarItemCreate from
inside your delegate when your delegate is asked to create a toolbar
item.
HIToolbar.hObtains the attributes of a toolbar item.
OSStatus HIToolbarItemGetAttributes ( HIToolbarItemRef inItem, OptionBits *outAttributes );
The item in question.
The attributes of the item. For details, see “Toolbar Item Attributes.”
An operating system result code.
HIToolbar.h
Obtains the attributes of a toolbar item in the specified window.
OSStatus HIToolbarItemGetAttributesInWindow ( HIToolbarItemRef inItem, WindowRef inWindow, OptionBits *outOverriddenAttributes, OptionBits *outCombinedAttributes );
The item in question.
The window containing inItem.
Passing NULL is the same
as calling HIToolbarItemGetAttributes, which obtains
the non-window-specific attributes for the item.
On return, a bitmask indicating the attributes
for the item that are overridden in the specified window. If you
don’t need this information, pass NULL. For
details on this bitmask, see “Toolbar Item Attributes.”
On return, a bitmask indicating the effective
attributes for the item in the specified window. The bitmask is
produced by combining the non-window-specific attributes for the
item with the overridden attributes for this window. If you don’t
need this information, pass NULL. For
details on this bitmask, see “Toolbar Item Attributes.”
An operating system result code.
In addition to obtaining the attributes of the given item
in a given window, HIToolbarItemGetAttributesInWindow obtains
information about which attributes are overridden for that window.
HIToolbar.hGets the command ID of a toolbar item.
OSStatus HIToolbarItemGetCommandID ( HIToolbarItemRef inItem, MenuCommand *outCommandID );
The item whose command ID is to be obtained.
On return, the item’s command ID.
An operating system result code.
HIToolbar.hObtains the toolbar associated with a toolbar item.
HIToolbarRef HIToolbarItemGetToolbar ( HIToolbarItemRef inItem );
The item in question.
The toolbar item reference
of the toolbar this item is bound to, or NULL if
this toolbar item is not attached to any toolbar.
HIToolbar.hDetermines if a toolbar item is enabled.
Boolean HIToolbarItemIsEnabled ( HIToolbarItemRef inItem );
The item in question.
A Boolean result indicating whether the item is enabled.
HIToolbar.hSets the command ID of a toolbar item.
OSStatus HIToolbarItemSetCommandID ( HIToolbarItemRef inItem, MenuCommand inCommandID );
The item whose command ID is to be set.
The command ID to set.
An operating system result code.
When an toolbar item is clicked, the default behavior is to
send out the command assigned to the item. This function lets you to set
that command ID. The command is sent out via the ProcessHICommand API.
HIToolbar.hEnables or disables a toolbar item.
OSStatus HIToolbarItemSetEnabled ( HIToolbarItemRef inItem, Boolean inEnabled );
The item in question.
The new enabled state.
An operating system result code.
HIToolbar.hSets the help tag text for a toolbar item.
OSStatus HIToolbarItemSetHelpText ( HIToolbarItemRef inItem, CFStringRef inShortText, CFStringRef inLongText );
The item in question.
The short help text. This is what is displayed normally by the help tag system when the user hovers over the toolbar item with the mouse.
The long help text. This is what is displayed
by the help tag system when the user hovers over the toolbar item
with the mouse and holds the command key down. This parameter is
optional, you may pass NULL.
An operating system result code.
HIToolbar.hSets the icon for a toolbar item.
OSStatus HIToolbarItemSetIconRef ( HIToolbarItemRef inItem, IconRef inIcon );
The item in question.
The icon reference. The IconRef is retained
by the toolbar item. You can release the reference for this icon
when HIToolbarItemSetIconRef returns.
An operating system result code.
HIToolbar.hSets the image for a toolbar item.
OSStatus HIToolbarItemSetImage ( HIToolbarItemRef inItem, CGImageRef inImage );
The item in question.
The image. This image is retained by the toolbar item. You should release the image when you are finished with it.
An operating system result code.
Currently, the image should be no higher than 32 pixels. This image is used both in the toolbar as well as the configuration sheet, if the toolbar is configurable.
HIToolbar.hSets the label of a toolbar item.
OSStatus HIToolbarItemSetLabel ( HIToolbarItemRef inItem, CFStringRef inLabel );
The item in question.
The label. The toolbox will copy the string passed in.
An operating system result code.
This is what the toolbar view will display underneath the image. It is also used in the configuration palette for configurable toolbars.
HIToolbar.hSets the submenu for a toolbar item.
OSStatus HIToolbarItemSetMenu ( HIToolbarItemRef inItem, MenuRef inMenu );
The item in question.
The menu. It is retained by the toolbar item,
so you can safely release it after calling this API. On Mac OS X
v10.3 and later, you can pass NULL for
this parameter to remove and release any menu that might be attached.
An operating system result code.
Normally, items do not have a submenu. You can attach one with this API. The submenu will, by default, show up both in the ‘more items’ indicator popup attached to the item name. It will also appear if the toolbar is in text only mode and the label is clicked. You should attach a Carbon Event handler to the menu to handle updating the menu items as appropriate before the menu is displayed.
HIToolbar.hRemoves an item at a given index from a toolbar.
OSStatus HIToolbarRemoveItemAtIndex ( HIToolbarRef inToolbar, CFIndex inIndex );
The toolbar you are removing the item from.
The index of the item to remove. This index is zero-based.
An operating system result code.
HIToolbar.hSets the delegate object for a toolbar.
OSStatus HIToolbarSetDelegate ( HIToolbarRef inToolbar, HIObjectRef inDelegate );
The toolbar whose delegate you want to set.
The HIObjectRef to act as the delegate.
An operating system result code.
If a toolbar has custom toolbar items, a delegate is required for the toolbar to work properly. The delegate is asked to create the toolbar items. If the delegate does not respond, the toolbar attempts to create the toolbar items, but it can only create standard items.
HIToolbar.hSets the current display mode of a toolbar.
OSStatus HIToolbarSetDisplayMode ( HIToolbarRef inToolbar, HIToolbarDisplayMode inDisplayMode );
The toolbar whose display mode you want to set.
The display mode. If the toolbar is visible, it will be redrawn as necessary.
An operating system result code.
HIToolbar.hSets the current display size of a toolbar.
OSStatus HIToolbarSetDisplaySize ( HIToolbarRef inToolbar, HIToolbarDisplaySize inSize );
The toolbar whose display size you want to set.
The display size. If the toolbar is visible, it will be redrawn as necessary.
An operating system result code.
HIToolbar.h
Sets a toolbar’s items all at once.
OSStatus HIToolbarSetItemsWithIdentifiers ( HIToolbarRef inToolbar, CFArrayRef inArray );
The toolbar whose items you want to set.
The array of toolbar items to create.
An operating system result code.
This function allows you to set a toolbar’s items all at
once. The entries in the array inArray must
be either CFStringRefs or CFDictionaryRefs. You do not need to use
the same type for all entries; different entries can be of different
types. If an array entry is a CFStringRef, the string must contain
a toolbar item identifier. If an array entry is a CFDictionaryRef,
the dictionary must contain a CFStringRef specifying a toolbar item
identifier and may optionally contain a CFTypeRef specifying the
toolbar item’s configuration data, if the item requires it. The
key for the identifier string is kHIToolbarIdentifierKey and
the key for the configuration data string is kHIToolbarDataKey.
HIToolbar.hSpecify constants for toolbar attributes.
enum {
kHIToolbarNoAttributes = 0,
kHIToolbarAutoSavesConfig = (1 << 0),
kHIToolbarIsConfigurable = (1 << 1),
kHIToolbarValidAttrs = kHIToolbarAutoSavesConfig | kHIToolbarIsConfigurable
};
kHIToolbarNoAttributesPass this to indicate no attributes at all.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHIToolbarAutoSavesConfigPass this attribute to allow the toolbar to save its configuration automatically to your application’s preferences. You must make sure to synchronize the preferences at some point to ensure it gets written to disk. The toolbar will also read its configuration from the preferences if this attribute is set.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHIToolbarIsConfigurableThis attribute indicates that the toolbar is configurable, that is, the user can drag items around and bring up the configuration palette, etc.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHIToolbarValidAttrsThe set of all valid toolbar attributes.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
Specify constants for toolbar Command IDs.
enum {
kHICommandCustomizeToolbar = 'tcfg',
kHICommandShowToolbar = 'tbsh',
kHICommandHideToolbar = 'tbhd',
kHIToolbarCommandPressAction = 'tbpr'
};
kHICommandCustomizeToolbarWhen sent to a window with a toolbar, this command causes the configuration sheet to appear. You can set a menu item’s command to this command ID and it will be handled and updated automatically for you. (Available in Mac OX X v10.2 and later.)
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHICommandShowToolbarSending this command causes a window’s toolbar to be shown. You can set a menu item’s command to this ID and it will be handled and updated automatically for you. (Available in Mac OX X v10.2 and later.)
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHICommandHideToolbarSending this command causes a window’s toolbar to be hidden. You can set a menu item’s command to this ID and it will be handled and updated automatically for you. (Available in Mac OX X v10.2 and later.)
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHIToolbarCommandPressActionThis command, when specified as a toolbar’s
command ID, causes a kEventToolbarItemPerformAction event
to be generated when the toolbar item’s menu item in the toolbar
overflow menu is selected. If the item has any other command ID,
a kEventCommandProcess event,
containing the item’s command ID, is generated instead. (Available
in Mac OX X v10.2.3 and later.)
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
Specify constants for toolbar display modes.
enum {
kHIToolbarDisplayModeDefault = 0,
kHIToolbarDisplayModeIconAndLabel = 1,
kHIToolbarDisplayModeIconOnly = 2,
kHIToolbarDisplayModeLabelOnly = 3
};
kHIToolbarDisplayModeDefaultUse the default display mode. Currently, this is defined as being both icon and label, but could change in the future.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHIToolbarDisplayModeIconAndLabelDisplay the image as well as the label of the toolbar items.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHIToolbarDisplayModeIconOnlyDisplay only the image.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHIToolbarDisplayModeLabelOnlyDisplay only the label.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
Specify constants for the display size of items in the toolbar.
enum {
kHIToolbarDisplaySizeDefault = 0,
kHIToolbarDisplaySizeNormal = 1,
kHIToolbarDisplaySizeSmall = 2
};
kHIToolbarDisplaySizeDefaultThis indicates to use the default display size. Currently, this is defined as using 32 x 32 icons (“normal” size).
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHIToolbarDisplaySizeNormalThis size uses a larger text and icon size.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHIToolbarDisplaySizeSmallThis size uses a smaller text and icon size.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
Specify toolbar Carbon event constants.
enum {
kEventToolbarGetDefaultIdentifiers = 1,
kEventToolbarGetAllowedIdentifiers = 2,
kEventToolbarCreateItemWithIdentifier = 3,
kEventToolbarCreateItemFromDrag = 4,
kEventToolbarItemAdded = 5,
kEventToolbarItemRemoved = 6,
kEventToolbarDisplayModeChanged = 7,
kEventToolbarDisplaySizeChanged = 8,
kEventToolbarLayoutChanged = 9,
kEventToolbarGetSelectableIdentifiers = 10,
kEventToolbarBeginMultiChange = 12,
kEventToolbarEndMultiChange = 13
};
kEventToolbarGetDefaultIdentifiersThis event is sent to the delegate to get a list of all of the default item identifiers that should be created for a toolbar. You are passed a mutable array to fill in with the identifiers. (
Available in Mac OS X v10.2.)
Declared in HIToolbar.h.
kEventToolbarGetAllowedIdentifiersThis event is sent to the delegate to get a list of all the items which could possibly be added to the toolbar. This is sent out when the configuration sheet is about to be displayed.You are passed a mutable array to fill in with the identifiers. (
Available in Mac OS X v10.2.)
Declared in HIToolbar.h.
kEventToolbarCreateItemWithIdentifierThis event is sent to the delegate to when the toolbar needs to create an item from an identifier. (
Available in Mac OS X v10.2.)
Declared in HIToolbar.h.
kEventToolbarCreateItemFromDragThis event is sent to the delegate to when the toolbar needs to create an item from a drag. This allows you to be able to drag items into a toolbar that aren’t normal toolbar items. You might use this to allow your toolbar to accept file system items, for example. (
Declared in HIToolbar.h.
Available in Mac OS X v10.2.)
kEventToolbarItemAddedThis event is sent when an item is added to the toolbar. The toolbar object sends this event to itself, so you need to install a handler on the toolbar to receive this event. (Available in Mac OS X v10.2 and later.)
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
kEventToolbarItemRemovedThis event is sent when an item is removed from toolbar. It is called after the item has already been removed. The toolbar object sends this event to itself, so you need to install a handler on the toolbar to receive this event. (Available in Mac OS X v10.2 and later.)
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
kEventToolbarDisplayModeChangedThis event is sent when the display mode is changed for a toolbar. The toolbar object sends this event to itself, so you need to install a handler on the toolbar to receive this event. (Available in Mac OS X v10.2 and later.)
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
kEventToolbarDisplaySizeChangedThis event is sent when the display size is changed for a toolbar. The toolbar object sends this event to itself, so you need to install a handler on the toolbar to receive this event. (Available in Mac OS X v10.2 and later.)
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
kEventToolbarLayoutChangedSent when the layout of a toolbar changes (either an item has been moved, or the entire contents have been replaced). Basically it is sent for changes that would require a total resync with the current state of things. The toolbar object sends this event to itself, so you must install a handler on the toolbar to receive this event. (Available in Mac OS X v10.2 and later.)
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
kEventToolbarBeginMultiChangeThis event is sent when multiple attributes
are going to be changed at the same time. For example, the display
mode and size can change at the same time. When this happens, instead
of reacting twice (once for a display mode change and once for a
display size change), you can listen to see if more than one attribute
is about to change and wait to redraw the toolbar until you receive
the kEventToolbarEndMultiChange event.
The toolbar object sends this event to itself, so you need to install
a handler on the toolbar to receive this event. (Available in Mac
OS X v10.2 and later.)
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
kEventToolbarEndMultiChangeThis event is sent when multiple changes in
the toolbar have been made. For details, see the description of kEventToolbarBeginMultiChange.
The toolbar object sends this event to itself, so you need to install
a handler on the toolbar to receive this event. (Available in Mac
OS X v10.2 and later.)
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
kEventToolbarGetSelectableIdentifiersThis event is sent to the delegate after the
user clicks a toolbar item in order to get a list of all the items
that can acquire a selection highlight when clicked. You are passed
a mutable array to fill in with the identifiers. If you pass back
a non-empty array and the clicked item’s identifier matches one of
the identifiers that is in the list, the toolbar automatically draws
that item with a selected highlight and removes highlighting from
the previously selected item. Note that the selection only changes
in the clicked window — it does not change in other windows that
share the same toolbar. To share the selection across all windows
that use the same toolbar, you need to manually change the kHIToolbarItemSelected attribute
for the clicked item using HIToolbarItemChangeAttributes.
In this case, you should not handle the kEventToolbarGetSelectableIdentifiers event.
(Available in Mac OS X v10.4 and later.)
Available in Mac OS X v10.4 and later.
Declared in HIToolbar.h.
Table 1 lists the parameters and types for toolbar events.
Event kind |
Parameter name |
Parameter type |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
None |
|
|
None |
|
|
None |
|
|
None |
|
|
None |
Specify constants for toolbar event parameters and types.
enum {
kEventParamToolbar = 'tbar',
kEventParamToolbarItem = 'tbit',
kEventParamToolbarItemIdentifier = 'tbii',
kEventParamToolbarItemConfigData = 'tbid',
typeHIToolbarRef = 'tbar',
typeHIToolbarItemRef = 'tbit'
};
kEventParamToolbarThe toolbar to which an event was sent.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kEventParamToolbarItemThe toolbar item to which an event was sent.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kEventParamToolbarItemIdentifierThe toolbar item’s identifier.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kEventParamToolbarItemConfigDataThe toolbar item’s configuration information.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
typeHIToolbarRefHIToolbarRef
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
typeHIToolbarItemRefHIToolbarItemRef
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
Specify constants for toolbar item attributes.
enum {
kHIToolbarItemNoAttributes = 0,
kHIToolbarItemAllowDuplicates = (1 << 0),
kHIToolbarItemCantBeRemoved = (1 << 1),
kHIToolbarItemAnchoredLeft = (1 << 2),
kHIToolbarItemIsSeparator = (1 << 3),
kHIToolbarItemSendCmdToUserFocus = (1 << 4),
kHIToolbarItemLabelDisabled = (1 << 5),
kHIToolbarItemDisabled = (1 << 6),
kHIToolbarItemSelected = (1 << 7),
kHIToolbarItemValidAttrs = kHIToolbarItemAllowDuplicates | kHIToolbarItemIsSeparator | kHIToolbarItemCantBeRemoved | kHIToolbarItemAnchoredLeft | kHIToolbarItemSendCmdToUserFocus | kHIToolbarItemLabelDisabled | kHIToolbarItemDisabled | kHIToolbarItemSelected,
kHIToolbarItemMutableAttrs = kHIToolbarItemCantBeRemoved | kHIToolbarItemAnchoredLeft | kHIToolbarItemLabelDisabled | kHIToolbarItemDisabled | kHIToolbarItemSelected
};
kHIToolbarItemNoAttributesPass this to indicate no attributes at all.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHIToolbarItemAllowDuplicatesThis indicates that an item can have more than one instance of itself in the toolbar. If this is not set, only one can be present. By default, the determining factor for what determines if two items are identical is the toolbar identifier.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHIToolbarItemCantBeRemovedThis item can be rearranged, but it cannot be removed from the toolbar by the user.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHIToolbarItemAnchoredLeftThis item cannot be moved at all by the user. It is anchored to the left of the toolbar. It is important that there not be any unanchored items to the left of this item, else dragging items around will be a bit wacky. You are responsible for making sure that anchored items are all on the left. This allows you to do toolbars like the one in the System Preferences app, where the first couple of items are stuck in place.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHIToolbarItemIsSeparatorThis indicates the item acts as a separator. This means two things at present. First, it means that it automatically shows up as a divider line in a menu representation of the toolbar, and second it means the view that represents this item can draw in the full top to bottom space that the toolbar item occupies in the toolbar.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHIToolbarItemSendCmdToUserFocusIf this attribute bit is set, the command that gets sent out will be directed at the user focus instead of at the window the toolbar is attached to.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHIToolbarItemLabelDisabledIf this attribute bit is set, clicking on the
label of an item does nothing. This attribute is only considered
when a custom view is present. When set, this attribute makes the
toolbar item view unresponsive to clicks while still allowing clicks
to be sent to the custom view. When the toolbar is in text-only
mode and this attribute is set, the label is displayed in a disabled (grayed)
appearance. You might want to change this attribute when switching
between display modes. For example, the view switcher in the Finder
does not respond to clicks on the label when in icon and text mode, but
it does respond to clicks when in text-only mode. To change this behavior
on the fly, listen for kEventToolbarItemViewConfigForMode in
your custom view and adjust this attribute as you want. (Available
in Mac OS X 10.3 and later.)
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
kHIToolbarItemDisabledIf this attribute bit is set, the item is disabled.
Setting this attribute is the same as calling HIToolbarItemSetEnabled on the item
with the inEnabled parameter
set to false. (Available
in Mac OS X v10.4 and later.)
Available in Mac OS X v10.4 and later.
Declared in HIToolbar.h.
kHIToolbarItemSelectedIf this attribute bit is set, the item is drawn with a selected appearance. (Available in Mac OS X v10.4 and later.)
Available in Mac OS X v10.4 and later.
Declared in HIToolbar.h.
kHIToolbarItemValidAttrsThe set of all valid toolbar item attributes.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kHIToolbarItemMutableAttrsThe set of toolbar item attributes that can
be changed by HIToolbarItemChangeAttributes and HIToolbarItemChangeAttributesInWindow.
Any other attribute must be specified when it is created.
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
Specify constants for toolbar item events.
enum {
kEventToolbarItemImageChanged = 1,
kEventToolbarItemLabelChanged = 2,
kEventToolbarItemHelpTextChanged = 3,
kEventToolbarItemCommandIDChanged = 4,
kEventToolbarItemGetPersistentData = 5,
kEventToolbarItemCreateCustomView = 6,
kEventToolbarItemEnabledStateChanged = 7,
kEventToolbarItemPerformAction = 8,
kEventToolbarItemWouldAcceptDrop = 10,
kEventToolbarItemAcceptDrop = 11,
kEventToolbarItemSelectedStateChanged = 12
};
kEventToolbarItemImageChangedThis event is sent to the item when the image changes. Any interested parties can install handlers on the toolbar item to receive notifications. (Available in Mac OS X v10.2 and later.)
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kEventToolbarItemLabelChangedThis event is sent to the item when the label changes. Any interested parties can install handlers on the toolbar item to receive notifications. (Available in Mac OS X v10.2 and later.)
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kEventToolbarItemHelpTextChangedThis event is sent to the item when the help text changes. Any interested parties can install handlers on the toolbar item to receive notifications. (Available in Mac OS X v10.2 and later.)
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kEventToolbarItemCommandIDChangedThis event is sent to the item when the command ID changes. Any interested parties can install handlers on the toolbar item to receive notifications. (Available in Mac OS X v10.2 and later.)
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kEventToolbarItemGetPersistentDataThis event is sent to the item when the toolbar is going to write out the configuration information for the item. Any custom items can listen for this event and add any extra information to what is written out into the config so that it can be reanimated later on from the same config data. Typically, you do not need to handle this event. (Available in Mac OS X v10.2 and later.)
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kEventToolbarItemCreateCustomViewThis event is sent to the toolbar item when it is time to create a view for it to display its contents. Implementors of custom toolbar items can install a handler for this event to create their own custom views for their items. (Available in Mac OS X v10.2 and later.)
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kEventToolbarItemEnabledStateChangedThis event is sent to the item when the enabled state changes. Any interested parties can install handlers on the toolbar item to receive notifications. (Available in Mac OS X v10.3 and later.)
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kEventToolbarItemPerformActionThis event is sent when a toolbar item is clicked. Subclasses of toolbar items can choose to do special actions by overriding this event. If this event is unhandled, the default action of sending a command event will occur. (Available in Mac OS X v10.2 and later.)
Available in Mac OS X v10.2 and later.
Declared in HIToolbar.h.
kEventToolbarItemWouldAcceptDropThis event is sent when a toolbar item is clicked. Subclasses of toolbar items can choose to do special actions by overriding this event. If this event is unhandled, the default action of sending a command event will occur. (Available in Mac OS X v10.3 and later.)
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
kEventToolbarItemAcceptDropThis event is sent when a drag enters a toolbar
item. If the toolbar item wants to accept drags, it should respond
to this event and return true in
the kEventParamResult parameter.
The toolbar item will be highlighted appropriately. If you are using
a custom view, you do not need to respond to this event because
the view system provides full drag and drop capability in order
to support custom items that use the standard view. (Available in Mac
OS X v10.3 and later.)
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
kEventToolbarItemSelectedStateChangedThis event is sent to the item itself when the selected state changes. Any interested parties can install handlers on the toolbar item to receive notifications. (Available in Mac OS X v10.4 and later.)
Available in Mac OS X v10.4 and later.
Declared in HIToolbar.h.
Table 2 lists the parameters and types for toolbar item events.
Event kind |
Parameter name |
Parameter type |
|
|
|
|
None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Specify constants for toolbar item view events.
enum {
kEventToolbarItemViewConfigForMode = 3,
kEventToolbarItemViewConfigForSize = 4,
kEventToolbarItemViewEnterConfigMode = 5,
kEventToolbarItemViewExitConfigMode = 6
};
kEventToolbarItemViewConfigForModeThis event notifies a toolbar item view that the toolbar’s display mode has changed. A custom toolbar item view can respond in any way it sees fit. Usually, responding to this is not necessary; for example, when the toolbar goes from icon to text only the view is automatically hidden, so there is not much to do. This event is for informational purposes only. (Available in Mac OS X v10.3 and later.)
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
kEventToolbarItemViewConfigForSizeThis event notifies a toolbar item view that the toolbar’s display size has changed. A custom toolbar item view can respond to this in any way it sees fit. Usually, responding to this is not necessary. Some custom views might need to flush metrics caches when the display size changes. (Available in Mac OS X v10.3 and later.)
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
kEventToolbarItemViewEnterConfigModeThis event notifies a toolbar item view that configure mode has been entered. A custom toolbar item view can respond to this in any way it sees fit. For example, the space and flexible space mark themselves to draw a rectangle and merely invalidate so they get redrawn so they can be seen during configuration. (Available in Mac OS X v10.3 and later.)
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
kEventToolbarItemViewExitConfigModeThis event notifies a toolbar item view that configure mode has been exited. A custom toolbar item view can respond to this event in any way it sees fit. (Available in Mac OS X v10.3 and later.)
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
Table 3 lists the parameters and types for toolbar item view events.
Event kind |
Parameter name |
Parameter type |
|
|
|
|
|
|
|
|
|
|
|
Specify constants for toolbar display event parameters and types.
enum {
kEventParamToolbarDisplayMode = 'tbdm',
kEventParamToolbarDisplaySize = 'tbds',
typeHIToolbarDisplayMode = 'tbdm',
typeHIToolbarDisplaySize = 'tbds'
};
kEventParamToolbarDisplayModeIndicates that the display mode changed.
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
kEventParamToolbarDisplaySizeIndicates that the display size changed.
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
typeHIToolbarDisplayModeHIToolbarDisplayMode.
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
typeHIToolbarDisplaySizeHIToolbarDisplaySize.
Available in Mac OS X v10.3 and later.
Declared in HIToolbar.h.
© 2003, 2005 Apple Computer, Inc. All Rights Reserved. (Last updated: 2005-09-08)