File: programming/cocoa/UKToolbarFactory.zip/UKToolbarFactory/UKToolbarFactory.m


//
//  UKToolbarFactory.m
//  UKToolbarFactory
//
//  Created by Uli Kusterer on Sat Jan 17 2004.
//  Copyright (c) 2004 M. Uli Kusterer. All rights reserved.
//
 
// -----------------------------------------------------------------------------
//	Headers:
// -----------------------------------------------------------------------------
 
#import "UKToolbarFactory.h"
#import "UKFirstResponder.h"
//-(BOOL)		tryToPerform: (SEL)itemAction with: (id)sender onObject: (NSResponder*)resp;
// -----------------------------------------------------------------------------
//	* DESTRUCTOR:
//		Get rid of the objects we created.
//
//	REVISIONS:
//		2004-01-19	witness Documented.
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//	awakeFromNib:
//		We were created from a NIB file. Add the toolbar to our window.
//
//	REVISIONS:
//		2004-01-19	witness Documented.
// -----------------------------------------------------------------------------
// Create toolbar.
}
 
 
// -----------------------------------------------------------------------------
//	setToolbarIdentifier:
//		Lets you change the toolbar identifier at runtime. This will recreate
//		the toolbar from the item definition .plist file for that identifier.
//
//	REVISIONS:
//		2004-01-19	witness Documented.
// -----------------------------------------------------------------------------
// Recreate toolbar.
}
 
 
// -----------------------------------------------------------------------------
//	toolbarIdentifier:
//		Returns the toolbar identifier this object manages. Defaults to the
//		application's bundle identifier with the autosave name of the owning
//		window appended to it.
//
//	REVISIONS:
//		2004-01-19	witness Documented.
// -----------------------------------------------------------------------------
"%@.%@"// -----------------------------------------------------------------------------
//	toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:
//		Creates the appropriate toolbar item for the specified identifier.
//		This simply lets NSToolbarItem handle system-defined toolbar items,
//		while setting up all others according to the dictionaries from the
//		.plist file.
//
//	REVISIONS:
//		2004-01-19	witness Documented.
// -----------------------------------------------------------------------------
"Items"// One of the system-provided items?
// Otherwise, look it up in our list of custom items:
"Action""ViewClass""MaxWidth""MinWidth""Label""CustomizationLabel""ToolTip"// ... and create an NSToolbarItem for it and set that up:
// This isn't a regular item? It's a view?
// -----------------------------------------------------------------------------
//	toolbarDefaultItemIdentifiers:
//		Returns the list of item identifiers we want to be in this toolbar by
//		default. The list is loaded from the .plist file's "DefaultItems" array.
//
//	REVISIONS:
//		2004-01-19	witness Documented.
// -----------------------------------------------------------------------------
"DefaultItems"];
}
 
 
// -----------------------------------------------------------------------------
//	toolbarAllowedItemIdentifiers:
//		Returns the list of item identifiers that may be in the toolbar. This
//		simply returns the identifiers of all the items in our "Items"
//		dictionary, plus a few sensible defaults like separators and spacer
//		items the user may want to add as well.
//
//		If this function doesn't return the item identifier, it *can't* be in
//		the toolbar. Though if this returns it, that doesn't mean it currently
//		is in the toolbar.
//
//	REVISIONS:
//		2004-01-19	witness Documented.
// -----------------------------------------------------------------------------
"Items""Items"// View items aren't selectable, but make all others selectable:
"ViewClass""Options""Selectable"// -----------------------------------------------------------------------------
//	setupToolbar:
//		(Re)create our toolbar. This loads the .plist file whose name is the
//		toolbar identifier and loads it. Then it adds the toolbar to our
//		window.
//
//	REVISIONS:
//		2004-01-19	witness Documented.
// -----------------------------------------------------------------------------
// Load list of items:
"plist"// (Re-) create toolbar:
"DefaultItems"] objectAtIndex: 0]];
}
 
 
// -----------------------------------------------------------------------------
//	itemClicked:
//		Toolbar action if we have selectable items. This selects the item, then
//		sends the actual action that the item has.
//
//	REVISIONS:
//		2004-10-03	witness Documented.
// -----------------------------------------------------------------------------
"Items""Action"

This code uses the PclZip Zip File reading code, which is subject to the GNU LGPL. It also uses the GeSHi syntax highlighter, subject to the GPL. Ask if you want this for your own web site, it's free.