Re: creating a preference window safari style
Re: creating a preference window safari style
- Subject: Re: creating a preference window safari style
- From: Nicko van Someren <email@hidden>
- Date: Sun, 5 Feb 2006 12:23:01 +0000
On Feb 3, 2006, at 6:54 PM, Andrea Salomoni wrote:
I need to create a simple preference window with a toolbar.
I know how to do it, but I would like to add the window resizing
behavior like in the safari preference win.
How have I to start?
You should take a look at the NSWindow method -
setFrame:display:animate: You can then draw out each preference of
the panes in a separate NSView at at whatever size you need. In the
target action for each toolbar button you can call both –
setContentView: and -setFrame:display:animate: and the body of the
preference window will smoothly resize to fit the view. For
instance, if the target method of all the toolbar items is something
in the preference panel window controller you might have something
like this (caveat: typed in Mail):
// Assumes you have a dictionary of NSView objects for each
preference pane, keyed by toolbar item identifier
- (IBAction) selectPrefPane: (id) sender {
NSToolbarItem *tb = (NSToolbarItem *) sender;
NSView *prefView = [dictionaryOfPreferenceViews objectForKey: [tb
itemIdentifier]];
[window setContentView: prefView];
[window setFrame: [prefView frame] display: YES animate: YES];
}
Depending on what model you want to use for acting upon changes to
preference settings you might want to add something in there to look
at anything that had changed on the old preference pane before
removing it, but the basic idea should be the same.
I hope this helps,
Nicko
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden