KFSplitView


Inherits from:
NSSplitView : NSView : NSResponder : NSObject
Conforms to:
NSCoding (NSResponder)
NSObject (NSObject)
Declared in:
KFSplitView.h




Class Description


A KFSplitView object is an NSSplitView object with additional features relating to collapsing and expanding subviews. It also allows saving and autosaving of position, like NSWindow. 'Position' here means the orientation of the splitview and the frames and collapsed states of all the subviews - all the data needed to make the split view look the same across launches. Lastly, an instance of KFSplitView can inform its delegate if the user double clicks or drags a divider.

Method Types


Collapsing subviews
– setSubview:isCollapsed:

Saving the split view's position to user defaults
– removePositionUsingName:
– savePositionUsingName:
– setPositionUsingName:
– setPositionAutosaveName:
– positionAutosaveName
– setPositionFromPlistObject:
– plistObjectWithSavedPosition

Delegate Method Types


Double-clicks
– splitView:didDoubleClickInDivider:

Collapsing subviews
– splitViewDidCollapseSubview:
– splitViewDidExpandSubview:

Dragging
– splitView:didFinishDragInDivider:



Instance Methods



setSubview:isCollapsed:

- (void)setSubview:(NSView *)subview isCollapsed:(BOOL)flag

Collapses or uncollapses subview based on flag. A KFSplitViewDidCollapseSubviewNotification or KFSplitViewDidExpandSubviewNotification will be sent if the collapse state of subview changes due to this call.

It's important to realize that the collapse state of a subview is completely distinct from its frame. An uncollapsed subview's frame may have 0 height, and collapsed subview's frame might have positive height and width. This is true when the split view is an NSSplitView object as well.

This method only changes the collapse state of a subview, it doesn't change the frame of it or any other subviews. The splitview will not draw correctly until the frames of the subviews have been properly updated, so you need to call - resizeSubviewsWithOldSize: sometime after calling this method.

See Also: KFSplitViewDidCollapseSubviewNotification, KFSplitViewDidExpandSubviewNotification, - resizeSubviewsWithOldSize: (NSView)



removePositionUsingName:

+ (void)removePositionUsingName:(NSString *)name

Please see - removeFrameUsingName: (NSWindow).

See Also:



savePositionUsingName:

- (void)savePositionUsingName:(NSString *)name

Please see - saveFrameUsingName: (NSWindow).

See Also:



setPositionUsingName:

- (BOOL)setPositionUsingName:(NSString *)name

Please see - setFrameUsingName: (NSWindow).

See Also:



setPositionAutosaveName:

- (BOOL)setPositionAutosaveName:(NSString *)name

Please see - setFrameAutosaveName: (NSWindow).

If you'd like to use an autosave name, call this method from the awakeFromNib method of a controller class.

See Also:



positionAutosaveName

- (NSString *)positionAutosaveName

Please see - frameAutosaveName (NSWindow).

See Also:



setPositionFromPlistObject:

- (void)setPositionFromPlistObject:(NSString *)string

Please see - setFrameFromString (NSWindow).

See Also:



plistObjectWithSavedPosition

- (NSString *)plistObjectWithSavedPosition

Please see - stringWithSavedFrame (NSWindow).

See Also:




Methods Implemented by the Delegate


splitView:didDoubleClickInDivider:

- (void)splitView:(id)sender didDoubleClickInDivider:(int)offset

See Also:


splitView:didFinishDragInDivider:

- (void)splitView:(id)sender didFinishDragInDivider:(int)offset

See Also:



splitViewDidCollapseSubview:

- (void)splitViewDidCollapseSubview:(NSNotification *)aNotification

Sent by the default notification center to the delegate; aNotification is always a KFSplitViewDidCollapseSubviewNotification. If the delegate implements this method, the delegate is automatically registered to receive this notification. This method is invoked after the KFSplitView expands a subview, either in response to a programmatic directive (-setSubview:isCollapsed:) or because the user dragged a divider.

See Also: KFSplitViewDidCollapseSubviewNotification, -setSubview:isCollapsed:



splitViewDidExpandSubview:

- (void)splitViewDidExpandSubview:(NSNotification *)aNotification

Sent by the default notification center to the delegate; aNotification is always a KFSplitViewDidExpandSubviewNotification. If the delegate implements this method, the delegate is automatically registered to receive this notification. This method is invoked after the KFSplitView expands a subview, either in response to a programmatic directive (-setSubview:isCollapsed:) or because the user dragged a divider.

See Also: KFSplitViewDidExpandSubviewNotification, -setSubview:isCollapsed:




Notifications


NSSplitView declares and posts the following notifications. In addition, it posts notifications declared by its superclasses, NSSplitView and NSView. See the NSSplitView and NSView class specifications for more information.

KFSplitViewDidCollapseSubviewNotification

Posted after a KFSplitView collapses one of its subviews. The notification object is the KFSplitView that collapsed a subview. The userInfo dictionary contains the following information:


Key Value
@"subview" The subview that collapsed (NSView *).

KFSplitViewDidExpandSubviewNotification

Posted after a KFSplitView expands one of its subviews. The notification object is the KFSplitView that collapsed a subview. The userInfo dictionary contains the following information:


Key Value
@"subview" The subview that expanded (NSView *).