EDToolbarDefinition


Inherits From:
NSObject
Declared In:
EDToolbarDefinition.h


Class Description

EDToolbarDefinitions provide a convenient way to define window toolbars in external text files.

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!


Instance Variables

NSDictionary *toolbarDefinition;
NSString *name;
id targetForActions;

toolbarDefinitionAll instance variables are private.
name
targetForActions


Method Types

Creating (loading) toolbar definitions
+ toolbarDefinitionWithName:
- initWithName:
Retrieving the name
- name
Assigning a target for the toolbar items
- setTargetForActions:
- targetForActions
Creating toolbar objects
- toolbar
- defaultItemIdentifiers
- allowedItemIdentifiers
- itemWithIdentifier:
Toolbar delegate methods
- toolbarAllowedItemIdentifiers:
- toolbarDefaultItemIdentifiers:
- toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:


Class Methods

toolbarDefinitionWithName:

+ (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.


Instance Methods

allowedItemIdentifiers

- (NSArray *)allowedItemIdentifiers

Returns the identifiers of all items that can be part of the toolbar.


defaultItemIdentifiers

- (NSArray *)defaultItemIdentifiers

Returns the identifiers of all items that are part of the default toolbar.


initWithName:

- (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.


itemWithIdentifier:

- (NSToolbarItem *)itemWithIdentifier:(NSString *)identifier

Returns the NSToolbarItem for the given identifier.


name

- (NSString *)name

Returns the name of the toolbar definition.


setTargetForActions:

- (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.


targetForActions

- (id)targetForActions

Returns the target that will be used for the toolbar items.


toolbar

- (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.


toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:

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

NSToolbar delegate method. Returns [self itemWithIdentifier:itemIdentifier]


toolbarAllowedItemIdentifiers:

- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar

NSToolbar delegate method. Returns [self allowedItemIdentifiers]


toolbarDefaultItemIdentifiers:

- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar

NSToolbar delegate method. Returns [self defaultItemIdentifiers]


Version 2.0 Copyright ©2002. All Rights Reserved.