/**
PKPreferencePane Description
*/ @implementation PKPane /**Returns the bundle instance which the preference pane stored.
*/ - (NSBundle *) bundle { return _bundle; } /**Loads preference pane's view by loading the nib file which contains it.
Related nib file is known by -mainNibName.
*/ - (NSView *) loadMainView { // NOTE: Paranoid check which eliminates the possibility to reload the nib // when the mainView is possibly still in use. if ([self mainView] != nil) return nil; ASSIGN(_topLevelObjects, AUTORELEASE([[NSMutableArray alloc] init])); NSDictionary* ent = [NSDictionary dictionaryWithObjectsAndKeys: self, @"NSOwner", _topLevelObjects, @"NSTopLevelObjects", nil]; if ( ![_bundle loadNibFile: [self mainNibName] externalNameTable: ent withZone: [self zone]] ) { NSLog(@"Failed to load main view bundle"); return nil; } [self assignMainView]; [self mainViewDidLoad]; return _mainView; } /**Assigns the main view loaded with -loadMainView.
By default this method, retrieves the main view by calling
-contentView on window referenced in the nib file by
_window
outlet.
Overrides this method if your preference pane
view is located in different place within the nib file. Takes note that when
assignement is done, _window
is released and sets to
nil. Finally this method returns -mainView if no
errors occured, otherwise nil.
Returns the nib name advertised as main in enclosing bundle's property list.
Related nib file is known by mainNibName.
*/ - (NSString *) mainNibName { return [[_bundle infoDictionary] objectForKey: @"NSMainNibFile"]; } /**Notifies the preference pane that everything is set up and ready to be displayed, similarly to -windowDidLoad when the main nib file has been awaken. It is called by -loadMainView when the main view is correctly set. By default this method does nothing.
Override this method to have extra preference pane view set up according to its stored settings.
*/ - (void) mainViewDidLoad {} /**Returns a value to state if the preference pane accepts to be
deselected right now. Various values may be returned, look at
NSPreferencePaneUnselectReply
constants.
Overrides this method when you want to delay or cancel a deselect
request, but take note that you will have to call -replyToShouldUnselect:
later (when deselection is processed) if you return
NSUnselectLater
.
Asks the preference pane to know if it accepts to be deselected.
Take care to invoke this method yourself when you have overriden
-shouldUnselect to return NSUnselectLater
(it
implies you know when the preference should be unselected).
Sets the preference pane view which is presented to the user.
Take note, you should avoid to call this method in your code unless you have already overriden -loadMainView and -assignMainView.
*/ -(void) setMainView: (NSView *) view { ASSIGN(_mainView, view); } /**Returns the preference pane view which is presented to the user.
*/ - (NSView *) mainView { return _mainView; } /**Returns the view which initially owns the focus in the responder chain when the preference pane view is loaded.
*/ - (NSView *) initialKeyView { return _initialKeyView; } /**Sets the view which initially owns the focus in the responder chain when the preference pane view is loaded.
*/ - (void) setInitialKeyView: (NSView *) view { ASSIGN(_initialKeyView, view); } /**Returns the view which starts the responder chain bound to the preference pane view.
*/ - (NSView *) firstKeyView { return _firstKeyView; } /**Sets the view which starts the responder chain bound to the preference pane view.
*/ - (void) setFirstKeyView: (NSView *) view { ASSIGN(_firstKeyView, view); } /**Returns the view which ends the responder chain bound to the preference pane view.
*/ - (NSView *) lastKeyView { return _lastKeyView; } /**Sets the view which ends the responder chain bound to the preference pane view.
*/ - (void) setLastKeyView: (NSView *) view { ASSIGN(_lastKeyView, view); } /**Returns YES when text fields are asked to resign their responder status when -shouldUnselect is going to be called, otherwise returns NO if the preference pane must itself request each text field resigning its responder status (to have their content saved).
By default this method returns YES, but it is possible to override it to alter the returned value.
*/ - (BOOL) autoSaveTextFields { return YES; } /**Returns YES when the receiver is the currently selected preference pane, otherwise returns NO.
*/ - (BOOL) isSelected { return( [_owner selectedPane] == self ); } /**Not implemented.
*/ -(void) updateHelpMenuWithArray:(NSArray *)inArrayOfMenuItems { NSLog(@"PKPane: updateHelpMenuWithArray: not yet implemented."); } /* Private */ -(void) setOwner: (id