Scaling Custom Toolbar Items
Scaling Custom Toolbar Items
- Subject: Scaling Custom Toolbar Items
- From: "Ian G. Gillespie" <email@hidden>
- Date: Fri, 23 Jan 2004 20:40:39 -0800
I have a toolbar in which some of the toolbar items are built from
custom NSButtons so that I can over-ride things like mouseDown to show
a pop-up menu and such. Everything works fine except that the toolbar
items don't scale if the user chooses to have the toolbar show the
small icons.
When setting up my toolbar I make the calls below to set the min and
max size. My first thought was to change the min size, but this causes
my 32x32 image in my button to be cropped.
- (NSToolbarItem *) toolbar: (NSToolbar *)toolbar
itemForItemIdentifier: (NSString *) itemIdent
willBeInsertedIntoToolbar:(BOOL) willBeInserted
/*I call these methods to insert the "special" toolbar item:*/
NSToolbarItem *toolbarItem = [[[NSToolbarItem alloc]
initWithItemIdentifier: itemIdent] autorelease];
if ([itemIdent isEqual: kCustomToolbarItemIdentifier]) {
[toolbarItem setView: _aSubClassedButton];
// Use a custom view, a button, for the add job event custom
item item
[toolbarItem setMinSize:NSMakeSize(32, 32)];
[toolbarItem setMaxSize:NSMakeSize(32,32)];
/*set the names and such goes below */
...
I am starting to think that this isn't the best way to get the behavior
that I want. Any suggestions would be most welcome.
~Ian
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.