Copyright ©1995 by NeXT Computer, Inc.  All Rights Reserved.

NXSplitView



Inherits From: View : Responder : Object
Declared In: appkit/NXSplitView.h



Class Description

An NXSplitView object lets several Views share a region within a window.  The NXSplitView resizes its subviews so that each subview is the same width as the NXSplitView, and the total of the subviews' heights is equal to the height of the NXSplitView.  The NXSplitView positions its subviews so that the first subview is at the top of the NXSplitView, and each successive subview is positioned below.  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 NXSplitView, you use the addSubview: View method.  When the NXSplitView is displayed, it checks to see if its subviews are properly tiled.  If not, it invokes the splitView:resizeSubviews: delegate method, allowing the delegate to specify the heights of specific subviews.  If the delegate doesn't implement a splitView:resizeSubviews: method, the NXSplitView sends adjustSubviews to itself to yield the default tiling behavior.

When a mouse-down occurs in an NXSplitView's divider, the NXSplitView 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 NXSplitView resizes the two affected subviews, informs the delegate that the subviews were resized, and displays the affected Views and divider.  The NXSplitView's delegate can constrain the travel of specific dividers by implementing the splitView:getMinY:maxY:ofSubviewAt: method.



Instance Variables

id delegate;


delegate The object that receives notification messages from the NXSplitView.



Method Types

Initializing an NXSplitView initFrame:
Handling Events mouseDown:
acceptsFirstMouse
Managing component Views adjustSubviews
resizeSubviews:
dividerHeight
drawSelf::
drawDivider:
setAutoresizeSubviews:
Assigning a delegate delegate
setDelegate:



Instance Methods

acceptsFirstMouse
(BOOL)acceptsFirstMouse

Returns YES, thus allowing the NXSplitView to respond to the mouse event that made its Window the key window.

See also:  acceptsFirstMouse (View)



adjustSubviews
adjustSubviews

Adjusts the heights of the NXSplitView's subviews so the total height fills the NXSplitView.  The subviews are resized proportionally; the size of a subview relative to the other subviews doesn't change.  This method is invoked if the NXSplitView's delegate doesn't respond to a splitView:resizeSubviews: message.  Returns self.

See also:  setDelegate:, splitView:resizeSubviews: (delegate method), setFrame: (View)



delegate
delegate

Returns the NXSplitView's delegate.

See also:  setDelegate:



dividerHeight
(NXCoord)dividerHeight

Returns the height of the divider.  You can override this method to change the divider's height, if necessary.

See also:  drawDivider:



drawDivider:
drawDivider:(const NXRect *)aRect

Draws a divider between two of the NXSplitView's subviews.  aRect describes the entire divider rectangle in the NXSplitView's coordinates, which are flipped.  The default implementation composites a default image to the center of aRect; if you override this method and use a different icon to identify the divider, you may want to change the height of the divider. Returns self.

See also:  dividerHeight composite:toPoint: (NXImage)



drawSelf::
drawSelf:(const NXRect *)rects :(int)rectCount

Draws the NXSplitView.  You never invoke this method directly; it's invoked by the display mechanism.  Returns self.

See also:  drawDivider:, resizeSubviews:, display: (View)



initFrame:
initFrame:(const NXRect *)frameRect

Initializes the NXSplitView, which must be a newly allocated NXSplitView instance, setting its frame rectangle to the argument.  The NXSplitView's coordinate system is flipped, and it's set to autoresize its subviews.  This method is the designated initializer for the NXSplitView class.  Returns self.

See also:  setAutoresizeSubviews: (View)



mouseDown:
mouseDown:(NXEvent *)theEvent

You never invoke this method; it's invoked when the user clicks in the NXSplitView.  Returns self.

See also:  splitView:getMinY:maxY:ofSubviewAt: (delegate), splitViewDidResizeSubviews: (delegate), setFrame: (View)



resizeSubviews:
resizeSubviews:(const NXSize *)oldSize

Ensures that the NXSplitView's subviews are properly sized to fill the NXSplitView.  If the delegate implements the splitView:resizeSubviews: method, that method is invoked to resize the subviews; otherwise, the adjustSubviews method is invoked to resize the subviews.  In either case, this method then informs the delegate that the subviews were resized.  oldSize is the previous bounds rectangle size.  Returns self.

See also:  splitView:resizeSubviews: (delegate), adjustSubviews, splitViewDidResizeSubviews: (delegate), resizeSubviews: (View)



setAutoresizeSubviews:
setAutoresizeSubviews:(BOOL)flag

Overrides View's setAutoresizeSubviews: method to ensure that automatic resizing of subviews will not be disabled.  You should never invoke this method.  Returns self.



setDelegate:
setDelegate:anObject

Makes anObject the NXSplitView's delegate.  The notification messages that the delegate can expect to receive are listed at the end of the NXSplitView class specifications.  The delegate doesn't need to implement all the delegate methods.  Returns self.

See also:  delegate



Methods Implemented by the Delegate

splitView:getMinY:maxY:ofSubviewAt:
splitView:sender
getMinY:(NXCoord *)minY
maxY:(NXCoord *)maxY
ofSubviewAt:(int)offset

Allows the delegate to constrain the y coordinate limits of a divider when the user drags the mouse.  This method is invoked before the NXSplitView begins tracking the mouse to position a divider.  When this method is invoked, the limits have already been set and are stored in minY (the topmost limit) and maxY (the bottommost limit).  You may further constrain the limits by setting the variables indicated by minY and maxY, but you cannot extend the divider limits.  minY and maxY are specified in the NXSplitView's flipped coordinate system.  The divider to be repositioned is indicated by offset, an index that counts the dividers from top to bottom starting with divider 0.

See also:  mouseDown:



splitView:resizeSubviews:
splitView:sender resizeSubviews:(const NXSize *)oldSize

Allows the delegate to specify custom sizing behavior for the subviews of the NXSplitView.  If the delegate implements this method, splitView:resizeSubviews: is invoked after the NXSplitView is resized; otherwise, adjustSubviews is invoked to retile the subviews.  The old size of the NXSplitView is indicated by oldSize; the subviews should be resized such that the sum of the heights of the subviews plus the sum of the heights of the dividers equals the height of the NXSplitView's new frame. You can get the height of a divider through the dividerHeight method.

See also:  adjustSubviews, dividerHeight, setFrame: (View)



splitViewDidResizeSubviews:
splitViewDidResizeSubviews:sender

Informs the delegate that the sizes of some or all of the NXSplitView's subviews were changed.  This method is invoked when the NXSplitView resizes all its subviews because its frame rectangle changed, and also after the NXSplitView resizes two subviews in response to the repositioning of a divider.

See also:  resizeSubviews:, mouseDown: