- Inherits From:
- NSObject
- Declared In:
- EDToolbarDefinition.h
The following code fragment shows how a toolbar can be created and assigned to a window:
toolbarDefinition = [EDToolbarDefinition toolbarDefinitionWithName: ... ];
[toolbarDefinition setTargetForActions:self];
[[self window] setToolbar:[toolbarDefinition toolbar]];
Toolbars request their items lazily from their delegate, the toolbar definition by default. If the window controller wants to receive other delegate methods it must set itself as the delegate and then forward the appropriate methods!
NSDictionary *toolbarDefinition;
NSString *name;
id targetForActions;
toolbarDefinition All instance variables are private. name targetForActions
Creating (loading) toolbar definitionsRetrieving the name
- + toolbarDefinitionWithName:
- - initWithName:
Assigning a target for the toolbar items
- - name
Creating toolbar objects
- - setTargetForActions:
- - targetForActions
Toolbar delegate methods
- - toolbar
- - defaultItemIdentifiers
- - allowedItemIdentifiers
- - itemWithIdentifier:
- - toolbarAllowedItemIdentifiers:
- - toolbarDefaultItemIdentifiers:
- - toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:
+ (id)toolbarDefinitionWithName:(NSString *)aName
Creates and returns a toolbar by reading the file named aName with the extension toolbar in the main bundle. See class description for an explanation of the file format.
- (NSArray *)allowedItemIdentifiers
Returns the identifiers of all items that can be part of the toolbar.
- (NSArray *)defaultItemIdentifiers
Returns the identifiers of all items that are part of the default toolbar.
- (id)initWithName:(NSString *)aName
Initialises a newly created toolbar definition by reading the file named aName with the extension toolbar in the main bundle. See class description for an explanation of the file format.
- (NSToolbarItem *)itemWithIdentifier:(NSString *)identifier
Returns the NSToolbarItem for the given identifier.
- (NSString *)name
Returns the name of the toolbar definition.
- (void)setTargetForActions:(id)anObject
Sets anObject as the target that will be used for the toolbar items. The selector is set in the text file but this cannot be done in the text file as there is no way to reference an instance.
- (id)targetForActions
Returns the target that will be used for the toolbar items.
- (NSToolbar *)toolbar
Returns an NSToolbar instance for the definition. Note that setTargetForActions: should be called before. The toolbar's delegate is set to the receive but this is not neccessarily required and can be changed afterwards.
- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag
NSToolbar delegate method. Returns [self itemWithIdentifier:itemIdentifier]
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar
NSToolbar delegate method. Returns [self allowedItemIdentifiers]
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar
NSToolbar delegate method. Returns [self defaultItemIdentifiers]