![]() |
API 0.9.5
|
#import <CPSplitView.h>
CPSplitView is a view that allows you to stack several subviews vertically or horizontally. The user is given divider to resize the subviews. The divider indices are zero-based. So the divider on the top (or left for vertical dividers) will be index 0.
CPSplitView can be supplied a delegate to provide control over the resizing of the splitview and subviews. Those methods are documented in setDelegate:
CPSplitView will add dividers for each subview you add. So just like adding subviews to a CPView you should call addSubview: to add new resizable subviews in your splitview.
Definition at line 2 of file CPSplitView.h.
- (CPString) autosaveName |
Get the name under which the split view divider position is automatically saved to CPUserDefaults.
Definition at line 992 of file CPSplitView.j.
- (BOOL) cursorAtPoint: | (CPPoint) | aPoint | |
hitDividerAtIndex: | (int) | anIndex | |
Definition at line 391 of file CPSplitView.j.
+ (CPString) defaultThemeClass |
Reimplemented from CPView.
Definition at line 97 of file CPSplitView.j.
- (void) didAddSubview: | (CPView) | aSubview |
Called when the receiver has added aSubview
to it's child views.
aSubview | the view that was added |
Reimplemented from CPView.
Definition at line 234 of file CPSplitView.j.
- (float) dividerThickness |
Returns the thickness of the divider.
Definition at line 144 of file CPSplitView.j.
- (void) drawDividerInRect: | (CGRect) | aRect |
Draws the divider at a given rect.
aRect | - the rect of the divider to draw. |
Definition at line 325 of file CPSplitView.j.
- (void) drawRect: | (CGRect) | rect |
Definition at line 285 of file CPSplitView.j.
- (CGRect) effectiveRectOfDividerAtIndex: | (int) | aDivider |
Returns the rect of the divider which the user is able to drag to resize.
int | - The index of the divider. |
Definition at line 274 of file CPSplitView.j.
- (void) encodeWithCoder: | (CPCoder) | aCoder |
Archives the view to a coder.
aCoder | the object into which the view's data will be archived. |
Reimplemented from CPView.
Definition at line 1129 of file CPSplitView.j.
- (CPView) hitTest: | (CGPoint) | aPoint |
Definition at line 417 of file CPSplitView.j.
+ (void) initialize |
Reimplemented from CPView.
Definition at line 111 of file CPSplitView.j.
- (id) initWithCoder: | (CPCoder) | aCoder |
Initializes the view from an archive.
aCoder | the coder from which to initialize |
Reimplemented from CPView.
Definition at line 1093 of file CPSplitView.j.
- (id) initWithFrame: | (CGRect) | aFrame |
Initializes the receiver for usage with the specified bounding rectangle
Reimplemented from CPView.
Definition at line 121 of file CPSplitView.j.
- (BOOL) isPaneSplitter |
Use to find if the divider is a larger pane splitter.
Definition at line 208 of file CPSplitView.j.
- (BOOL) isSubviewCollapsed: | (CPView) | subview |
Returns YES if the supplied subview is collapsed, otherwise NO.
aSubview | - the subview you are interested in. |
Definition at line 244 of file CPSplitView.j.
- (BOOL) isVertical |
Returns YES if the dividers are vertical, otherwise NO.
Definition at line 153 of file CPSplitView.j.
- (void) layoutSubviews |
Reimplemented from CPView.
Definition at line 316 of file CPSplitView.j.
- (float) maxPossiblePositionOfDividerAtIndex: | (int) | dividerIndex |
Returns the maximum possible position of a divider at a given index.
the | index of the divider. |
Definition at line 616 of file CPSplitView.j.
- (float) minPossiblePositionOfDividerAtIndex: | (int) | dividerIndex |
Returns the minimum possible position of a divider at a given index.
the | index of the divider. |
Definition at line 631 of file CPSplitView.j.
- (void) mouseDown: | (CPEvent) | anEvent |
Notifies the receiver that the user has clicked the mouse down in its area.
anEvent | contains information about the click |
Reimplemented from CPView.
Definition at line 515 of file CPSplitView.j.
- (void) mouseEntered: | (CPEvent) | anEvent |
Reimplemented from CPResponder.
Definition at line 527 of file CPSplitView.j.
- (void) mouseExited: | (CPEvent) | anEvent |
Notifies the receiver that the mouse exited the receiver's area.
anEvent | contains information about the exit |
Reimplemented from CPResponder.
Definition at line 540 of file CPSplitView.j.
- (void) mouseMoved: | (CPEvent) | anEvent |
Notifies the receiver that the user has moved the mouse (with no buttons down).
anEvent | contains information about the movement |
Reimplemented from CPResponder.
Definition at line 534 of file CPSplitView.j.
- (CGRect) rectOfDividerAtIndex: | (int) | aDivider |
Returns the CGRect of the divider at a given index.
int | - The index of a divider. |
Definition at line 255 of file CPSplitView.j.
- (void) resizeSubviewsWithOldSize: | (CPSize) | oldSize |
Definition at line 765 of file CPSplitView.j.
- (void) setAutosaveName: | (CPString) | autosaveName |
Set the name under which the split view divider positions is automatically saved to CPUserDefaults.
autosaveName | the name to save under or nil to not save |
Definition at line 980 of file CPSplitView.j.
- (void) setButtonBar: | (CPButtonBar) | aButtonBar | |
forDividerAtIndex: | (unsigned) | dividerIndex | |
Set the button bar who's resize control should act as a control for this splitview. Each divider can have at most one button bar assigned to it, and that button bar must be a subview of one of the split view's subviews.
Calling this method with nil as the button bar will remove any currently assigned button bar for the divider at that index. Indexes will not be adjusted as new subviews are added, so you should usually call this method after adding all the desired subviews to the split view.
This method will automatically configure the hasResizeControl and resizeControlIsLeftAligned parameters of the button bar, and will override any currently set values.
CPButtonBar | - The supplied button bar. |
unsigned | int - The divider index the button bar will be assigned to. |
Definition at line 935 of file CPSplitView.j.
- (void) setDelegate: | (id) | delegate |
Sets the delegate of the receiver. Possible delegate methods to implement are listed below.
Notifies the delegate when the subviews have resized.
- (void)splitViewDidResizeSubviews:(CPNotification)aNotification;
Notifies the delegate when the subviews will be resized.
- (void)splitViewWillResizeSubviews:(CPNotification)aNotification;
Lets the delegate specify a different rect for which the user can drag the splitView divider.
- (CGRect)splitView:(CPSplitView)aSplitView effectiveRect:(CGRect)aRect forDrawnRect:(CGRect)aDrawnRect ofDividerAtIndex:(int)aDividerIndex;
Lets the delegate specify an additional rect for which the user can drag the splitview divider.
- (CGRect)splitView:(CPSplitView)aSplitView additionalEffectiveRectOfDividerAtIndex:(int)indexOfDivider;
Notifies the delegate that the splitview is about to be collapsed. This usually happens when the user Double clicks on the divider. Return YES if the subview can be collapsed, otherwise NO.
- (BOOL)splitView:(CPSplitView)aSplitView canCollapseSubview:(CPView)aSubview;
Notifies the delegate that the subview at indexOfDivider is about to be collapsed. This usually happens when the user Double clicks on the divider. Return YES if the subview should be collapsed, otherwise NO.
- (BOOL)splitView:(CPSplitView)aSplitView shouldCollapseSubview:(CPView)aSubview forDoubleClickOnDividerAtIndex:(int)indexOfDivider;
Allows the delegate to constrain the subview beings resized. This method is called continuously as the user resizes the divider. For example if the subview needs to have a width which is a multiple of a certain number you could return that multiple with this method.
- (float)splitView:(CPSplitView)aSpiltView constrainSplitPosition:(float)proposedPosition ofSubviewAt:(int)subviewIndex;
Allows the delegate to constrain the minimum position of a subview.
- (float)splitView:(CPSplitView)aSplitView constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)subviewIndex;
Allows the delegate to constrain the maximum position of a subview.
- (float)splitView:(CPSplitView)aSplitView constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)subviewIndex;
Allows the splitview to specify a custom resizing behavior. This is called when the splitview is resized. The sum of the views and the sum of the dividers should be equal to the size of the splitview.
- (void)splitView:(CPSplitView)aSplitView resizeSubviewsWithOldSize:(CGSize)oldSize;
delegate | - The delegate of the splitview. |
Definition at line 898 of file CPSplitView.j.
- (void) setFrameSize: | (CGSize) | aSize |
Sets the receiver's frame size. If aSize
is the same as the frame's current dimensions, this method simply returns. The method posts a CPViewFrameDidChangeNotification to the default notification center if the receiver is configured to do so.
aSize | the new size for the frame |
Reimplemented from CPView.
Definition at line 746 of file CPSplitView.j.
- (void) setIsPaneSplitter: | (BOOL) | shouldBePaneSplitter |
Used to set if the split view dividers should be the larger pane splitter.
shouldBePaneSplitter | - YES if the dividers should be the thicker pane splitter, otherwise NO. |
Definition at line 218 of file CPSplitView.j.
- (void) setPosition: | (float) | position | |
ofDividerAtIndex: | (int) | dividerIndex | |
Sets the position of a divider at a given index.
position | - The float value of the position to place the divider. |
dividerIndex | - The index of the divider to position. |
Definition at line 699 of file CPSplitView.j.
- (void) setVertical: | (BOOL) | shouldBeVertical |
Sets if the splitview dividers are vertical.
shouldBeVertical | - YES if the splitview dividers should be vertical, otherwise NO. |
Definition at line 162 of file CPSplitView.j.
+ (id) themeAttributes |
Reimplemented from CPView.
Definition at line 102 of file CPSplitView.j.
- (void) trackDivider: | (CPEvent) | anEvent |
Definition at line 438 of file CPSplitView.j.
- (void) viewDidMoveToWindow |
Called when the receiver has been moved to a new CPWindow.
Reimplemented from CPView.
Definition at line 521 of file CPSplitView.j.
- (void) viewWillDraw |
Reimplemented from CPView.
Definition at line 358 of file CPSplitView.j.
- (void) willRemoveSubview: | (CPView) | aView |
Because we're use drawRect: to draw the dividers, but use DOM elements instead of CoreGraphics We must remove those DOM elements (the splitters) when the subview is removed.
Reimplemented from CPView.
Definition at line 301 of file CPSplitView.j.