INDockableWindowController Class Reference
Inherits from | NSWindowController |
Conforms to | NSSplitViewDelegate |
Declared in | INDockableWindowController.h INDockableWindowController.m |
Tasks
Other Methods
-
delegate
The window controller’s delegate.
property -
primaryWindow
The primary window that the auxiliary windows dock to.
property -
windowStyleMask
Style mask to use when creating the primary and auxiliary windows.
property -
auxiliaryWindows
Array of INDockableAuxiliaryWindow’s that are detached from the primary window
property -
configureAuxiliaryWindowBlock
Block that is called to configure a new auxiliary window
property -
viewControllers
Array of INDockabieViewController’s (both attached and detached from the primary window)
property -
attachedViewControllers
Array of INDockableViewController’s that are attached to the primary window
property -
primaryViewController
The primary view controller that should always be visible. Auxiliary view controllers are added to the right of this primary view.
property -
splitView
The split view that displays each of the view controllers. You can use this reference to the split view to set divider width, color, and a custom divider drawing block.
property -
titleBarHeight
The title bar height to use for all the windows (primary and auxiliary). Default is 22.f.
property -
minimumWindowHeight
The minimum height for the primary and auxiliary windows. Default is 0px.
property -
maximumWindowHeight
The maximum height for the primary and auxiliary windows. Default is FLT_MAX.
property -
attachmentProximity
The minimum distance (in pixels) that a window needs to be dragged near the right edge of the primary window to attach it to the window. Default is 8px.
property -
autosaveName
Autosave name for saving information to user defaults.
property -
animatesFrameChange
Set to YES to animate the addition and removal of view controllers by animating the frame change of the window. Default is NO.
property
Retrieving View Controllers
-
– attachedViewControllerAtIndex:
Returns the attached view controller at the specified index.
-
– viewControllerWithIdentifier:
Returns the view controller with the specified identifier (attached or not).
Positioning Attached View Controllers
-
– setIndex:forAttachedViewController:
Moves an attached view controller to a new index.
-
– indexOAttachedfViewController:
Returns the index of the specified attached view controller.
Adding and Removing View Controllers
-
– addViewController:attached:
Adds the specified view controller to the end of the view controller array.
-
– insertViewController:atIndex:
Adds the specified view controller to the window at the specified index.
-
– insertViewController:positioned:relativeTo:
Adds the specified view controller to the window positioned relative to another attached view controller.
-
– removeViewController:
Removes the specified view controller.
Attaching and Detaching View Controllers
-
– detachViewController:
Detaches the specified view controller from the primary window.
-
– attachViewController:
Attaches the specified view controller to the primary window.
Managing Resizing of View Controllers
-
– setMinimumWidth:forViewController:
Set a minimum width for the specified view controller.
-
– setMaximumWidth:forViewController:
Set a maximum width for the specified view controller.
-
– setShouldAdjustSize:ofViewController:
Controls whether the view controller’s view should be resized when the primary window is resized.
Properties
animatesFrameChange
Set to YES to animate the addition and removal of view controllers by animating the frame change of the window. Default is NO.
@property (nonatomic, assign, readonly) BOOL animatesFrameChange
Discussion
Warning: This feature is experimental because NSWindow animation is terrible. Unexpected behaviour may result.
Declared In
INDockableWindowController.h
attachedViewControllers
Array of INDockableViewController’s that are attached to the primary window
@property (nonatomic, strong, readonly) NSArray *attachedViewControllers
Discussion
The order of this array indicates the order in which the view controllers are displayed, from left to right.
Declared In
INDockableWindowController.h
attachmentProximity
The minimum distance (in pixels) that a window needs to be dragged near the right edge of the primary window to attach it to the window. Default is 8px.
@property (nonatomic, assign) CGFloat attachmentProximity
Declared In
INDockableWindowController.h
autosaveName
Autosave name for saving information to user defaults.
@property (nonatomic, copy) NSString *autosaveName
Discussion
Setting an autosave name will enable the window controller to automatically save and restore the frames of view controllers and the primary window. The autossave data is keyed using the identifiers of the view controllers.
Declared In
INDockableWindowController.h
auxiliaryWindows
Array of INDockableAuxiliaryWindow’s that are detached from the primary window
@property (nonatomic, strong, readonly) NSSet *auxiliaryWindows
Discussion
Windows in this array should not be modified. Set the configureAuxiliaryWindowBlock
block to
implement custom configuration for auxiliary windows.
Declared In
INDockableWindowController.h
configureAuxiliaryWindowBlock
Block that is called to configure a new auxiliary window
@property (nonatomic, copy) void ( ^ ) ( INDockableAuxiliaryWindow *window ) configureAuxiliaryWindowBlock
Declared In
INDockableWindowController.h
delegate
The window controller’s delegate.
@property (nonatomic, assign) id<INDockableWindowControllerDelegate> delegate
Declared In
INDockableWindowController.h
maximumWindowHeight
The maximum height for the primary and auxiliary windows. Default is FLT_MAX.
@property (nonatomic, assign) CGFloat maximumWindowHeight
Discussion
Set to FLT_MAX to allow an unlimited window height.
Declared In
INDockableWindowController.h
minimumWindowHeight
The minimum height for the primary and auxiliary windows. Default is 0px.
@property (nonatomic, assign) CGFloat minimumWindowHeight
Declared In
INDockableWindowController.h
primaryViewController
The primary view controller that should always be visible. Auxiliary view controllers are added to the right of this primary view.
@property (nonatomic, strong) INDockableViewController *primaryViewController
Declared In
INDockableWindowController.h
primaryWindow
The primary window that the auxiliary windows dock to.
@property (nonatomic, strong, readonly) INDockablePrimaryWindow *primaryWindow
Discussion
Warning: The titleBarHeight
of the window should not be set directly,
and should be set via the titleBarHeight
property of the INDockableWindowController
Declared In
INDockableWindowController.h
splitView
The split view that displays each of the view controllers. You can use this reference to the split view to set divider width, color, and a custom divider drawing block.
@property (nonatomic, strong, readonly) INDockableSplitView *splitView
Discussion
Warning: Do not set the delegate of the split view. The delegate is automatically set to the INDockableWindowController. To override split view delegate methods, subclass the INDockableWindowController and override the split view delegate methods. INDockableWindowController implements all of the methods documented in the NSSplitViewDelegate protocol. Always call super in any overriden implementations of delegate methods.
Declared In
INDockableWindowController.h
titleBarHeight
The title bar height to use for all the windows (primary and auxiliary). Default is 22.f.
@property (nonatomic, assign) CGFloat titleBarHeight
Declared In
INDockableWindowController.h
Instance Methods
addViewController:attached:
Adds the specified view controller to the end of the view controller array.
- (void)addViewController:(INDockableViewController *)viewController attached:(BOOL)attached
Parameters
- viewController
The view controller to add
- attached
If YES, the view controller will be attached to the main window. If NO, the view controller will be placed inside an auxiliary window and the window will be shown.
Discussion
Does nothing if viewController
has already been added.
Declared In
INDockableWindowController.h
attachViewController:
Attaches the specified view controller to the primary window.
- (void)attachViewController:(INDockableViewController *)viewController
Parameters
- viewController
The view controller to attach
Discussion
If viewController
is already attached to the primary window, this method does nothing.
Declared In
INDockableWindowController.h
attachedViewControllerAtIndex:
Returns the attached view controller at the specified index.
- (INDockableViewController *)attachedViewControllerAtIndex:(NSUInteger)index
Parameters
- index
The index of the attached view controller (indicies are ordered from left to right).
Return Value
The attached view controller at the specified index.
Discussion
Throws an exception if index
is not within the valid range of indices.
Declared In
INDockableWindowController.h
detachViewController:
Detaches the specified view controller from the primary window.
- (void)detachViewController:(INDockableViewController *)viewController
Parameters
- viewController
The view controller to detach.
Discussion
If viewController
is not attached to the primary window, this method does nothing.
Declared In
INDockableWindowController.h
indexOAttachedfViewController:
Returns the index of the specified attached view controller.
- (NSUInteger)indexOAttachedfViewController:(INDockableViewController *)viewController
Parameters
- viewController
The attached view controller to get the index of.
Return Value
The index of the attached view controller, or NSNotFound if the view controller is nil or has not been attached
Declared In
INDockableWindowController.h
insertViewController:atIndex:
Adds the specified view controller to the window at the specified index.
- (void)insertViewController:(INDockableViewController *)viewController atIndex:(NSUInteger)index
Parameters
- viewController
The view controller to add and attach to the primary window
- index
The index that the view controller will be placed at
Discussion
Throws an exception if index
if out of bounds. If viewController
is already attached to the window,
this will just call setIndex:forAttachedViewController: with the specified index.
Declared In
INDockableWindowController.h
insertViewController:positioned:relativeTo:
Adds the specified view controller to the window positioned relative to another attached view controller.
- (void)insertViewController:(INDockableViewController *)viewController positioned:(INDockableViewRelativePosition)position relativeTo:(INDockableViewController *)anotherViewController
Parameters
- viewController
The view controller to add and attach to the primary window.
- position
The relative position of the view controller
- anotherViewController
The existing attached view controller to position the new view controller relative to
Discussion
This method does nothing if viewController
is nil, position
is not one of the defined values, or if anotherViewController
is not attached to the primary window.
Declared In
INDockableWindowController.h
removeViewController:
Removes the specified view controller.
- (void)removeViewController:(INDockableViewController *)viewController
Parameters
- viewController
The view controller to remove.
Discussion
If viewController
is attached to the primary window, it will be removed from the window. If it is
inside an auxiliary window, the window will be closed and removed.
Declared In
INDockableWindowController.h
setIndex:forAttachedViewController:
Moves an attached view controller to a new index.
- (void)setIndex:(NSUInteger)index forAttachedViewController:(INDockableViewController *)viewController
Parameters
- index
The index to move the view controller to.
- viewController
The view controller to move.
Discussion
If viewController
is not attached to the window, this method does nothing. If index
is out of bounds,
an exception will be thrown
Declared In
INDockableWindowController.h
setMaximumWidth:forViewController:
Set a maximum width for the specified view controller.
- (void)setMaximumWidth:(CGFloat)width forViewController:(INDockableViewController *)viewController
Parameters
- width
The maximum width.
- viewController
The view controller to set the maximum width for.
Discussion
This method affects both the width of the view when its attached to the main window in the split view, and also affects the minimum size of any auxiliary window its in.
Declared In
INDockableWindowController.h
setMinimumWidth:forViewController:
Set a minimum width for the specified view controller.
- (void)setMinimumWidth:(CGFloat)width forViewController:(INDockableViewController *)viewController
Parameters
- width
The minimum width.
- viewController
The view controller to set the minimum width for.
Discussion
This method affects both the width of the view when its attached to the main window in the split view, and also affects the minimum size of any auxiliary window its in.
Declared In
INDockableWindowController.h
setShouldAdjustSize:ofViewController:
Controls whether the view controller’s view should be resized when the primary window is resized.
- (void)setShouldAdjustSize:(BOOL)shouldAdjust ofViewController:(INDockableViewController *)viewController
Parameters
- shouldAdjust
YES if the view controller should resize with the primary window, NO otherwise.
- viewController
The view controller.
Discussion
This method only has any effect when the view controller is attached to the primary window. When detached
in an auxiliary window, the view will always resize with the window unless maximum/minimum size constraints
have been set on the auxiliary window (can be set in the configureAuxiliaryWindowBlock
block).
Declared In
INDockableWindowController.h
viewControllerWithIdentifier:
Returns the view controller with the specified identifier (attached or not).
- (INDockableViewController *)viewControllerWithIdentifier:(NSString *)identifier
Parameters
- identifier
The identifier of the view controller (set using the
identifier
property of INDockableViewController)
Return Value
The view controller with the specified identifier.
Discussion
Returns nil if no view controller with the identifier is found.
Declared In
INDockableWindowController.h