Posted by nomothetis on Thu 3 Jul 03:18 (modification of post by nomothetis view diff)
report abuse | View followups from Matt | download | new post
- /*
- * This is the implementaiton of the header file that at
- * http://pastebin.com/m27607663.
- */
- #import "ITToolbarDelegate.h"
- /*
- * All item identifiers are strings; we define the identfier for the search
- * toolbar item as a static string for convenience.
- */
- @implementation ITToolbarDelegate
- /* The toolbar parameter is ignored in this method, because this
- * delegate is associated with just one toolbar. */
- NSToolbarShowFontsItemIdentifier,
- NSToolbarShowColorsItemIdentifier,
- NSToolbarSpaceItemIdentifier,
- NSToolbarFlexibleSpaceItemIdentifier,
- NSToolbarSeparatorItemIdentifier,
- NSToolbarCustomizeToolbarItemIdentifier,
- ITToolbarSearchItemIdentifier, nil];// nil is the last item as per API.
- }
- /* The toolbar parameter is ignored in this method, because this
- * delegate is associated with just one toolbar. */
- ITToolbarSearchItemIdentifier, nil];// nil is the last item as per API.
- }
- willBeInsertedIntoToolbar:(BOOL)flag {
- /*
- * This method only needs to implement the logic for returning the
- * item corresponding to the ITToolbarSearchItemIdentifier, because
- * the other identifiers are handled by the corresponding method
- * defined in NSToolbar. Note that the NSToolbar method is called
- * first.
- *
- * This method ignores the <code>flag</code> parameter, as it does
- * not affect what is returned.
- */
- if ([itemIdentifier isEqual: ITToolbarSearchItemIdentifier]) {
- initWithItemIdentifier:ITToolbarSearchItemIdentifier];
- /* Set the required labeling information. In a production
- * application, this would be externalized. */
- [newToolbarItem setLabel:@"Search"];
- [newToolbarItem setPaletteLabel:@"Search"];
- [newToolbarItem setToolTip:@"Search for Packages"];
- /* Now set the view that will represent this item, along with
- * its sizing information. */
- [newToolbarItem setView:searchToolbarItemView];
- CGFloat height = NSHeight([searchToolbarItemView frame]);
- [newToolbarItem setMinSize:NSMakeSize(100, height)];
- [newToolbarItem setMaxSize:NSMakeSize(200, height)];
- /* No need for autorelease, as we are using Objective-C 2.0,
- * which has garbage collection. */
- return newToolbarItem;
- } else {
- /*
- * If control gets here, there is nothing to return, because
- * the passed item descriptor is not supported.
- */
- return nil;
- }
- }
- @end
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.