activeControllerShowsFocus |
+ ( BOOL ) activeControllerShowsFocus;
Returns whether MOViewController will visibly show a ring around the controller that contains the first responder in its window. The default is NO. If set to YES, then MOViewController will draw a focus ring around the first view controller in the responder chain that returns YES for -showsControllerFocus.
addSubcontroller: |
- ( void ) addSubcontroller: (MOViewController *) subcontroller;
Adds the given controller as a subcontroller of the receiver. This method calls -insertSubcontroller:atIndex: to insert the new controller at the end of the subcontroller array.
- subcontroller
- The new subcontroller.
contentView |
- ( id ) contentView;
Returns the receiver's contentView, loading it if necessary. Calls to this method should be avoided until it is time to actually install the view into a view hierarchy in order to preserve laziness. Use -isViewLoaded to avoid asking for the view if you do not want it to be loaded.
controller:didInsertSubcontroller:atIndex: |
- ( void ) controller: (MOViewController *) controller didInsertSubcontroller: (MOViewController *) subcontroller atIndex: (unsigned ) index;
Called when subcontrollers are inserted into the hierarchy. This method is purely for overriding by controller subclasses that need to be aware of changes in the controller hierarchy. Right after a controller has a new subcontroller inserted this method is sent to the controller, to all its ancestors, to the subcontroller and to all the subcontroller's descendants. Overrides should call super. This method should never be called directly.
- controller
- The controller that had a new subcontroller inserted.
- subcontroller
- The subcontroller that was inserted.
- index
- The index of the subcontroller.
controller:willRemoveSubcontroller:atIndex: |
- ( void ) controller: (MOViewController *) controller willRemoveSubcontroller: (MOViewController *) subcontroller atIndex: (unsigned ) index;
Called when subcontrollers are removed from the hierarchy. This method is purely for overriding by controller subclasses that need to be aware of changes in the controller hierarchy. Right before a controller has a subcontroller removed this method is sent to the controller, to all its ancestors, to the subcontroller and to all the subcontroller's descendants. Overrides should call super. This method should never be called directly.
- controller
- The controller that had a new subcontroller inserted.
- subcontroller
- The subcontroller that was inserted.
- index
- The index of the subcontroller.
controllerDidChangeLabel: |
- ( void ) controllerDidChangeLabel: (MOViewController *) controller;
Sent when a controller's label, icon, or representedFilename changes. This method is sent to the controller and all its ancestors. Overrides should call super. This method should never be called directly.
- controller
- The controller whose label changed.
controllerViewWasInstalled: |
- ( void ) controllerViewWasInstalled: (MOViewController *) controller;
Called when a controller's view has been installed. This method is purely for overriding by controller subclasses that need to be aware when views are installed. Right after a controller's view is installed this method is sent to the controller, to all its ancestors, and to all the controller's descendants. Overrides should call super. This method should never be called directly.
- controller
- The controller whose view was installed.
controllerViewWillBeUninstalled: |
- ( void ) controllerViewWillBeUninstalled: (MOViewController *) controller;
Called when a controller's view is about to be uninstalled. This method is purely for overriding by controller subclasses that need to be aware when views are uninstalled. Right before a controller's view is uninstalled this method is sent to the controller, to all its ancestors, and to all the controller's descendants. Overrides should call super. This method should never be called directly.
- controller
- The controller whose view will be uninstalled.
controllerWindowClass |
- ( Class ) controllerWindowClass;
Returns the NSWindow subclass that should be used when the receiver creates its own window. MOViewController's implementation returns [NSWindow class].
controllerWindowStyleMask |
- ( unsigned ) controllerWindowStyleMask;
Returns the NSWindow style mask that should be used when the receiver creates its own window. MOViewController's implementation returns (NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask).
defaultViewNibName |
+ ( NSString *) defaultViewNibName;
Returns the name of the nib file containing the view for the receiving class. By default, this returns the name of the class which means that this method does not need to be overridden normally if you name your nib files and classes with the same names.
firstKeyView |
- ( id ) firstKeyView;
Returns the controller's firstKeyView. This method will cause the controller's view to be loaded if necessary. Usually the firstKeyView is set via an outlet connection in Interface Builder. For proper functioning, there should be a complete tab-loop defined in the controller's nib file (if there is more than one view that should be able to get focus).
focusRingColor |
+ ( NSColor *) focusRingColor;
Returns the color to use to draw the controller focus ring. If +activeControllerShowsFocus returns YES, then the focus ring will be drawn with the color returned by this method. The default is [NSColor keyboardFocusIndicatorColor].
focusRingWidth |
+ ( float ) focusRingWidth;
Returns the width of the line used to draw the controller focus ring. If +activeControllerShowsFocus returns YES, then the focus ring will be drawn with the width returned by this method. The default is 3.0.
icon |
- ( NSImage *) icon;
Returns the icon of the receiver.
init |
- ( id ) init;
Designated initializer. Note that ALL the inherited initializers from NSWindowController are explicitly disallowed for MOViewController except for -init. This method initializes the controller so that it will load the nib file returned by +defaultViewNibName.
insertSubcontroller:atIndex: |
- ( void ) insertSubcontroller: (MOViewController *) subcontroller atIndex: (unsigned ) index;
Inserts the given controller as a subcontroller of the receiver. This is the primitive method for adding a subcontroller. The controller is inserted at the given index.
- subcontroller
- The new subcontroller.
- index
- The index for insertion.
isAncestorOfController: |
- ( BOOL ) isAncestorOfController: (MOViewController *) descendant;
Returns whether the receiver is an ancestor of the given controller.
- descendant
- The potential descendant.
isViewInstalled |
- ( BOOL ) isViewInstalled;
Returns whether the controller's view is currently installed in a view hierarchy.
isViewLoaded |
- ( BOOL ) isViewLoaded;
Returns whether the receiver's view has been loaded (or created). If the controller has loaded its nib or has had an explicit call to -setContentView: (even -setContentView:nil), this will reutrn YES. This is often used to avoid asking questions or to postpone work that would cause the view to be loaded in order to keep nib file loading as lazy as possible.
label |
- ( NSString *) label;
Returns the label of the receiver. If the label has never been set, MOViewController returns the class' name by default.
lastKeyView |
- ( id ) lastKeyView;
Returns the controller's lastKeyView. This method will cause the controller's view to be loaded if necessary. This method returns the firstKeyView's previousKeyView or the firstKeyView if it has no previousKeyView. This property is not directly settable. Instead it is calculated from the firstKeyView at the time it is set (or after the controller's nib has loaded).
loadControllerWindow |
- ( NSWindow *) loadControllerWindow;
Called when the window that the controller will live in needs to be created. When a controller is set to have its own window, this method is called when that window actually needs to be created. MOViewController's implementation allocates a new window of the class returned by -controllerWindowClass with the style mask returned by -controllerWindowStyleMask.
loadView |
- ( void ) loadView;
Loads (or creates) the controller's view. MOViewController's implementation attempts to load the controller's nib file. Subclasses may override if they create their view programmatically instead of through loading a nib. In this case, the override should create the view and call -setContentView: to give ownership of it to the controller. This method should never be called directly.
maxContentSize |
- ( NSSize ) maxContentSize;
Returns the max size for the content view.
minContentSize |
- ( NSSize ) minContentSize;
Returns the minimum size for the content view. If the containing view (or window) is smaller than the content view's minimum size, the content view will clip on the right/lower edges
removeSubcontroller: |
- ( void ) removeSubcontroller: (MOViewController *) subcontroller;
Removes the given subcontroller of the receiver. This method calls -removeSubcontrollerAtIndex: after finding the index for the given subcontroller.
- subcontroller
- The subcontroller to be removed.
removeSubcontrollerAtIndex: |
- ( void ) removeSubcontrollerAtIndex: (unsigned ) index;
Removes the subcontroller of the receiver at the given index. This is the primitive method for removing a subcontroller.
- index
- The index of the subcontroller to be removed.
representedFilename |
- ( NSString *) representedFilename;
Returns the representedFilename of the receiver.
savesSubcontrollerState |
- ( BOOL ) savesSubcontrollerState;
Returns whether subcontroller state should be saved. This controls whether -stateDictionaryIgnoringContentState: will generate configuration state for subcontrollers. It also controls whether -takeStateDictionary:ignoringContentState: will attempt to restore state for subcontrollers if it exists in the dictionaries they are given. The default is YES.
setActiveControllerShowsFocus: |
+ ( void ) setActiveControllerShowsFocus: (BOOL ) flag;
Sets whether MOViewController will visibly show a ring around the controller that contains the first responder in its window. The default is NO. If set to YES, then MOViewController will draw a focus ring around the first view controller in the responder chain that returns YES for -showsControllerFocus.
- flag
- Whether MOViewController will visibly show focus.
setContentView: |
- ( void ) setContentView: (NSView *) aView;
Sets the receiver's contentView. There is one common direct use of this method: it is often called from the -loadView of a subclass that programmatically constructs its view instead of loading it from a nib file. This method is called implicitly when loading the nib file of a controller to estabnlish the view outlet connection. It is rare to need to override this method and it is rare to call it directly other than from an override of -loadView.
- aView
- The contentView.
setFirstKeyView: |
- ( void ) setFirstKeyView: (id ) aFirstKeyView;
Sets the controller's firstKeyView. Usually this is called during nib loading to connect the outlet. The firstKeyView should be a view within the controller's owned view hierarchy. It is not directly retained by the controller. At the time this method is called, the given firstKeyView should already be a member of a complete tab-loop (or, if there's only one interesting view, it should have no nextKeyView). The controller's lastKeyView will be calculated when this method is called (actually, because there's no order guarantee of any order for IB outlet conenctions, the lastKeyView will also be computed at -viewDidLoad time). The firstKeyView MUST be set prior to the controller's view ever being installed. Practically speaking this means that it should be set through an outlet connection in Interface Builder or in a subclasses' override of -loadView for subclasses that programmatically create their views.
setFocusRingColor: |
+ ( void ) setFocusRingColor: (NSColor *) color;
Sets the color to use to draw the controller focus ring. If +activeControllerShowsFocus returns YES, then the focus ring will be drawn with the color set through this method. The default is [NSColor keyboardFocusIndicatorColor].
- color
- The color to use to draw the controller focus ring.
setFocusRingWidth: |
+ ( void ) setFocusRingWidth: (float ) width;
Sets the width of the line used to draw the controller focus ring. If +activeControllerShowsFocus returns YES, then the focus ring will be drawn with the width set through this method. The default is 3.0.
- width
- The width of the line used to draw the controller focus ring.
setIcon: |
- ( void ) setIcon: (NSImage *) label;
Sets the icon of the receiver. The preserves the existing label and representedFilename.
- icon
- The icon, may be nil.
setLabel: |
- ( void ) setLabel: (NSString *) label;
Sets the label of the receiver. The clears the existing representedFilename. It preserves any existing icon.
- label
- The label, this must be non-nil.
setLabel:icon:representedFilename: |
- ( void ) setLabel: (NSString *) label icon: (NSImage *) icon representedFilename: (NSString *) path;
Sets the label, icon, and representedFilename of the receiver. This is the primitive method for setting the label, icon, and representedFilename. The other related set methods simply call this one.
- label
- The label, this must be non-nil.
- icon
- The icon, may be nil.
- path
- The representedFilename, may be nil.
setLabelAsFilename: |
- ( void ) setLabelAsFilename: (NSString *) path;
Sets the label, icon, and representedFilename of the receiver. The label and icon are calculated from the given representedFilename.
- path
- The representedFilename, may be nil.
setMaxContentSize: |
- ( void ) setMaxContentSize: (NSSize ) maxContentSize;
Sets the max size for the content view.
setMinContentSize: |
- ( void ) setMinContentSize: (NSSize ) minContentSize;
Sets the minimum size for the content view. If the containing view (or window) is smaller than the content view's minimum size, the content view will clip on the right/lower edges
setRepresentedFilename: |
- ( void ) setRepresentedFilename: (NSString *) path;
Sets the representedFilename of the receiver. The preserves the existing label and icon.
- path
- The representedFilename, may be nil.
setSupercontroller: |
- ( void ) setSupercontroller: (MOViewController *) supercontroller;
Sets the receiver's supercontroller. This method is invoked automatically when a controller is added to or removed from its supercontroller. Overrides should call super. This method should never be called directly.
- supercontroller
- The new supercontroller.
setViewControllerClassLoader: |
+ ( void ) setViewControllerClassLoader: (id ) classLoader;
Sets the object to use to load unknown controller classes. +viewControllerWithStateDictionary:ignoringContentState: will send this object a -viewControllerClassFromString: message whenever it encounters a controller class name in a state dictionary. The object may do whatever it needs to do to locate and load the code for the requested class. It can even return a different class, but doing so is potentially dangerous unless the substitution is part of an overall design.
Similarly, -stateDictionaryIgnoringContentState: will call -stringFromViewControllerClass: for each controller being saved to get the name to use within the state dictionary.
If no MOViewControllerClassLoader is set then MOViewController will use NSClassFromString() and NSStringFromClass() to map classes back and forth from their names.
- classLoader
- The object to use to resolve controller class names.
setWantsOwnWindow: |
- ( void ) setWantsOwnWindow: (BOOL ) flag;
Used to give a controller its own window (or take it away). If the flkag is YES then the receiver will be a top-level controller that owns and manages its own window. If the flag is NO, the controller will not have its own window (and will generally be inserted as a subcontroller within a larger controller hierarchy.)
- flag
- Whether the controller should own and manage its own window.
showWindow: |
- ( void ) showWindow: (id ) sender;
Tells the NSWindowController that manages the window the receiver is in to show itself. If the receiver owns its own window then this sends -showWindow: to the NSWindowController it uses to manage it. Otherwise it sends [[self supercontroller] showWindow:sender].
- sender
- Action sender, ignored.
showsControllerFocus |
- ( BOOL ) showsControllerFocus;
Returns whether this controller should show a focus ring. When +activeControllerShowsFocus is set to YES, this method is called to see if any particular controller should or should not show a focus ring. The default is YES. If this is overridden to return NO, then the focus ring will be drawn around this controller's supercontroller (if it returns YES for -showsControllerFocus... otherwise its supercontroller, and so on). This is provided as an override point for controller classes that may not want to ever be drawn with a focus ring, preferring instead to let their supercontrollers reflect focus
stateDictionaryIgnoringContentState: |
- ( NSMutableDictionary *) stateDictionaryIgnoringContentState: (BOOL ) ignoreContentFlag;
Returns the state dictionary for the receiver. MOViewController saves its view's frame and, if [self savesSubcontrollerState] is YES, it recursively saves info about all its subcontrollers. Subclasses may override this method to store their own additional state. The ignoreContentFlag argument indicates whether state that relies on the current content of the controller should be saved. Non-content state should be limited to state that does not depend on the data being displayed. Content state can be used to store state that depends on the data being displayed. For example, if a controller contains an outline that always shows three columns and shows data from a document, the column order and sizes are non-content state, but the expansion state of the outline contents and the selected items should be considered content state. On the other hand, if the outline always shows the same hierarchy, then the expansion state could be considered non-content state. Sometimes generic controller subclasses may need to provide API to allow clients to decide whether a particular piece of information is content state or not based on how they are used. See MOTabViewController for an example of this.
Subclasses should always call super. Subclasses should take care not to cause view loading when overriding this method. If the view has not been loaded, this method should not cause it to be loaded simply to gather and return the (default) geometry configuration.
- ignoreContentFlag
- If this is YES then any content-specific state should not be added to the result dictionary.
subcontrollers |
- ( NSArray *) subcontrollers;
Returns the receiver's array of subcontrollers.
supercontroller |
- ( id ) supercontroller;
Returns the receiver's supercontroller.
takeStateDictionary:ignoringContentState: |
- ( void ) takeStateDictionary: (NSDictionary *) dict ignoringContentState: (BOOL ) ignoreContentFlag;
Restores the receiver's state from the state dictionary. MOViewController restores its view's frame and, if [self savesSubcontrollerState] is YES, it recursively restores info for all its subcontrollers. Subclasses may override this method to restore their own additional state. The ignoreContentFlag argument indicates whether state that relies on the current content of the controller should be restored. Non-content state should be limited to state that does not depend on the data being displayed. Content state can be used to store state that depends on the data being displayed. For example, if a controller contains an outline that always shows three columns and shows data from a document, the column order and sizes are non-content state, but the expansion state of the outline contents and the selected items should be considered content state. On the other hand, if the outline always shows the same hierarchy, then the expansion state could be considered non-content state. Sometimes generic controller subclasses may need to provide API to allow clients to decide whether a particular piece of information is content state or not based on how they are used. See MOTabViewController for an example of this.
Subclasses should always call super. Subclasses should take care not to cause view loading when overriding this method. In some cases this may require storing away some of the information until the view loads and it can be applied.
- dict
- The state dictionary to be restored.
- ignoreContentFlag
- If this is YES then any content-specific state in the dictionary should be ignored.
update |
- ( void ) update;
Sent to any installed controllers after their window is updated. This method is automatically invoked on any controllers that are currently (fully) installed at the end of each event loop. View controllers are updated immediately following the -update of the window that contains them. "Fully" installed means that the controller must be installed in its supercontroller and its supercontroller and all its ancestor controllers must also be installed. It is also required that the top-level ancestor controller owns the window that contains the controller (in the -setWantsOwnWindow:YES sense).
Note that -update is not responsible for recursing and sending update messages to the receiver's subcontrollers. This is handled elsewhere. If you invoke -update directly it will update the receiver only, not its subcontrollers.
view |
- ( id ) view;
Returns the receiver's base view, loading the content view if necessary. Calls to this method should be avoided until it is time to actually install the view into a view hierarchy in order to preserve laziness. Use -isViewLoaded to avoid asking for the view if you do not want it to be loaded.
viewControllerClassLoader |
+ ( id ) viewControllerClassLoader;
Gets the object to use to load unknown controller classes. +viewControllerWithStateDictionary:ignoringContentState: will send this object a -viewControllerClassFromString: message whenever it encounters a controller class name in a state dictionary. The object may do whatever it needs to do to locate and load the code for the requested class. It can even return a different class, but doing so is potentially dangerous unless the substitution is part of an overall design.
Similarly, -stateDictionaryIgnoringContentState: will call -stringFromViewControllerClass: for each controller being saved to get the name to use within the state dictionary.
If no MOViewControllerClassLoader is set then MOViewController will use NSClassFromString() and NSStringFromClass() to map classes back and forth from their names.
viewControllerWithStateDictionary:ignoringContentState: |
+ ( id ) viewControllerWithStateDictionary: (NSDictionary *) dict ignoringContentState: (BOOL ) ignoreContentFlag;
Create a controller hierarchy from a saved state dictionary. This method uses the information in the given state dictionary to recreate a controller hierarchy. Contrast this with -takeStateDictionary:ignoringContentState: which applies a state dictionary to an existing controller hierarchy. Actually, this method first builds the controller hierarchy, given the information in the state dictionary, and then simply calls -takeStateDictionary:ignoringContentState: on the root controller of the hierarchy it has created.
If no MOViewControllerClassLoader has been set, then this method will use NSClassFromString to locate the classes to use for each controller in the dictionary. If there is a MOViewControllerClassLoader, then it will be asked to resolve controller class names into classes.
- dict
- The state dictionary.
- ignoreContentFlag
- If this is YES then any content-specific state in the dictionary should be ignored.
viewDidLoad |
- ( void ) viewDidLoad;
Sent immediately after the receiver loads its view. Subclasses may override to finish setting up after the view is loaded. Overrides should call super. This method should never be called directly.
viewNibName |
- ( NSString *) viewNibName;
Returns the name of the nib file that this controller loads. This is basically a rename of the inherited -windowNibName (and -windowNibName will also return the same name).
viewNibPath |
- ( NSString *) viewNibPath;
Returns the path of the nib file that this controller loads. This is basically a rename of the inherited -windowNibPath (and -windowNibPath will also return the same name).
viewWasInstalled |
- ( void ) viewWasInstalled;
Notifies the controller that its view was installed in a view hierarchy. This method MUST be sent to the controller AFTER its view has been installed. Usually it is the controller's supercontroller that installs the view and then sends this message. This method should not be overridden. Instead, override the -controllerViewWasInstalled: method if you need to do anything when your controller's view has been installed.
viewWillBeUninstalled |
- ( void ) viewWillBeUninstalled;
Notifies the controller that its view is about to be uninstalled from a view hierarchy. This method MUST be sent to the controller BEFORE its view has been uninstalled. Usually it is the controller's supercontroller that sends this message and then uninstalls the view. This method should not be overridden. Instead, override the -controllerViewWillBeUninstalled: method if you need to do anything when your controller's view is about to be uninstalled.
viewWillLoad |
- ( void ) viewWillLoad;
Sent immediately before the receiver loads its view. Subclasses may override to prepare for the view to be loaded. Overrides should call super. This method should never be called directly.
wantsOwnWindow |
- ( BOOL ) wantsOwnWindow;
Returns whether the controller should own and manage its own window.
windowController |
- ( NSWindowController *) windowController;
Returns the NSWindowController that manages the window the receiver is in. If the receiver owns its own window then this returns the NSWindowController it uses to manage it. Otherwise it returns [[self supercontroller] windowController].
(Last Updated 3/20/2005)