Return to the Alphabetic Index
Return to the Class Browser
Return to the Picture Browser
Copyright (c) 1994 by NeXT Computer, Inc. All Rights
Reserved.
NSSplitView
Inherits From: NSView : NSResponder : NSObject
Conforms To: NSCoding (NSResponder)
NSObject (NSObject)
Declared In: AppKit/NSSplitView.h
Class Description
An NSSplitView object lets several views share a region within a window. The
NSSplitView resizes its subviews so that each subview is the same width as the
NSSplitView, and the total of the subviews' heights is equal to the height of
the NSSplitView. The NSSplitView positions its subviews so that the first
subview is at the top of the NSSplitView, and each successive subview is
positioned below the previous one. The user can set the height of two subviews
by moving a horizontal bar called the divider, which makes one subview
smaller and the other larger.
To add a view to an NSSplitView, you use the NSView method addSubview:.
When the NSSplitView is displayed, it checks to see if its subviews are
properly tiled. If not, it invokes the delegate method
splitView:resizeSubviewsWithOldSize:, allowing the delegate to specify the
heights of specific subviews. If the delegate doesn't implement this method,
the NSSplitView sends adjustSubviews to itself to yield the
default tiling behavior.
When a mouse-down occurs in an NSSplitView's divider, the NSSplitView
determines the limits of the divider's travel and tracks the mouse to allow the
user to drag the divider within these limits. With the following mouse-up, the
NSSplitView resizes the two affected subviews, informs the delegate that the
subviews were resized, and displays the affected views and divider. The
NSSplitView's delegate can constrain the travel of specific dividers by
implementing the method
splitView:constrainMinCoordinate:maxCoordinate:ofSubviewAt:.
Managing Component Views
- - (void)adjustSubviews Adjusts the heights of the subviews.
- - (float)dividerThickness Returns the thickness of the divider.
- - (void)drawDividerInRect:(NSRect)aRect Draws the divider in
aRect.
Assigning a Delegate
- - (id)delegate Returns the NSSplitView's delegate.
- - (void)setDelegate:(id)anObject Sets the NSSplitView's delegate.
Implemented by the Delegate
- - (void)splitView:(NSSplitView *)splitView Sent directly by
splitView to the delegate. Allows the
constrainMinCoordinate:(float *)min delegate to constrain
further min and max
maxCoordinate:(float *)max vertical travel of a divider.
offset is an index that
ofSubviewAt:(int)offset identifies the dividers in a
NSSplitView from top to bottom starting with divider 0.
- - (void)splitView:(NSSplitView *)sender Sent directly by
splitView to the delegate. Allows the
resizeSubviewsWithOldSize:(NSSize)oldSize delegate to add
custom resizing behavior after users resize an NSSplitView. oldSize is
the size of the NSSplitView before the user resized it.
- - (void)splitViewDidResizeSubviews:(NSNotification *)notification
Sent by the default notification center to the delegate; aNotification
is always NSSplitViewDidResizeSubviewsNotification. If the delegate implements
this method, it's automatically registered to receive this notification.
- - (void)splitViewWillResizeSubviews:(NSNotification
*)notification
Sent by the default notification center to the delegate; aNotification
is always NSSplitViewWillResizeSubviewsNotification. If the delegate implements
this method, it's automatically registered to receive this notification.