API  1.0.0
CPSplitView Class Reference

#import <CPSplitView.h>

+ Inheritance diagram for CPSplitView:

Instance Methods

(void) - adjustSubviews
 
(CPString- autosaveName
 
(BOOL) - cursorAtPoint:hitDividerAtIndex:
 
(void) - cursorUpdate:
 
(void) - didAddSubview:
 
(float) - dividerThickness
 
(void) - drawDividerInRect:
 
(void) - drawRect:
 
(CGRect) - effectiveRectOfDividerAtIndex:
 
(void) - encodeWithCoder:
 
(CPView- hitTest:
 
(id) - initWithCoder:
 
(id) - initWithFrame:
 
(BOOL) - isPaneSplitter
 
(BOOL) - isSubviewCollapsed:
 
(BOOL) - isVertical
 
(void) - layoutSubviews
 
(float) - maxPossiblePositionOfDividerAtIndex:
 
(float) - minPossiblePositionOfDividerAtIndex:
 
(void) - mouseDown:
 
(CGRect) - rectOfDividerAtIndex:
 
(void) - resizeSubviewsWithOldSize:
 
(void) - setAutosaveName:
 
(void) - setButtonBar:forDividerAtIndex:
 
(void) - setDelegate:
 
(void) - setFrameSize:
 
(void) - setIsPaneSplitter:
 
(void) - setPosition:ofDividerAtIndex:
 
(void) - setVertical:
 
(void) - trackDivider:
 
(void) - updateTrackingAreas
 
(void) - viewDidMoveToWindow
 
(void) - viewWillDraw
 
(void) - willRemoveSubview:
 
- Instance Methods inherited from CPView
(BOOL) - acceptsFirstMouse:
 
(void) - addSubview:
 
(void) - addSubview:positioned:relativeTo:
 
(void) - addTrackingArea:
 
(CGRect) - adjustScroll:
 
(float) - alphaValue
 
(CAAnimation- animationForKey:
 
(CPDictionary- animations
 
(id) - animator
 
(BOOL) - autoresizesSubviews
 
(unsigned) - autoresizingMask
 
(BOOL) - autoscroll:
 
(CPColor- backgroundColor
 
(BOOL) - becomeFirstResponder
 
(CGRect) - bounds
 
(CGPoint) - boundsOrigin
 
(CGSize) - boundsSize
 
(BOOL) - canBecomeKeyView
 
(CGPoint) - center
 
(BOOL) - clipsToBounds
 
(CGPoint) - convertPoint:fromView:
 
(CGPoint) - convertPoint:toView:
 
(CGPoint) - convertPointFromBase:
 
(CGPoint) - convertPointToBase:
 
(CGRect) - convertRect:fromView:
 
(CGRect) - convertRect:toView:
 
(CGRect) - convertRectFromBase:
 
(CGRect) - convertRectToBase:
 
(CGSize) - convertSize:fromView:
 
(CGSize) - convertSize:toView:
 
(CPView- createEphemeralSubviewNamed:
 
(CPString- debug_description
 
(void) - display
 
(void) - displayIfNeeded
 
(void) - displayIfNeededInRect:
 
(void) - displayRect:
 
(void) - displayRectIgnoringOpacity:inContext:
 
(void) - dragImage:at:offset:event:pasteboard:source:slideBack:
 
(void) - dragView:at:offset:event:pasteboard:source:slideBack:
 
(CPAppearance- effectiveAppearance
 
(CPMenuItem- enclosingMenuItem
 
(CPScrollView- enclosingScrollView
 
(BOOL) - enterFullScreenMode
 
(BOOL) - enterFullScreenMode:withOptions:
 
(CPView- ephemeralSubviewNamed:
 
(void) - exitFullScreenMode
 
(void) - exitFullScreenModeWithOptions:
 
(CGRect) - frame
 
(CGPoint) - frameOrigin
 
(CGRect) - frameRectOfView:inSuperviewSize:
 
(CGSize) - frameSize
 
(CGRect) - frameWithNewSuperviewSize:
 
(BOOL) - hasCustomDrawRect
 
(BOOL) - hasCustomLayoutSubviews
 
(BOOL) - hitTests
 
(id) - init
 
(BOOL) - inLiveResize
 
(BOOL) - isDescendantOf:
 
(BOOL) - isFlipped
 
(BOOL) - isHidden
 
(BOOL) - isHiddenOrHasHiddenAncestor
 
(BOOL) - isInFullScreenMode
 
(BOOL) - isOpaque
 
(CALayer- layer
 
(void) - layout
 
(CPView- layoutEphemeralSubviewNamed:positioned:relativeToEphemeralSubviewNamed:
 
(void) - layoutIfNeeded
 
(void) - lockFocus
 
(CPMenu- menuForEvent:
 
(BOOL) - mouseDownCanMoveWindow
 
(BOOL) - needsDisplay
 
(BOOL) - needsLayout
 
(BOOL) - needsPanelToBecomeKey
 
(CPView- nextKeyView
 
(CPView- nextValidKeyView
 
(void) - objectDidChangeTheme
 
(BOOL) - performKeyEquivalent:
 
(BOOL) - postsBoundsChangedNotifications
 
(BOOL) - postsFrameChangedNotifications
 
(CPView- previousKeyView
 
(CPView- previousValidKeyView
 
(CGRect) - rectForEphemeralSubviewNamed:
 
(void) - reflectScrolledClipView:
 
(CPArray) - registeredDraggedTypes
 
(void) - registerForDraggedTypes:
 
(void) - removeFromSuperview
 
(void) - removeTrackingArea:
 
(void) - replaceSubview:with:
 
(BOOL) - resignFirstResponder
 
(void) - resizeWithOldSuperviewSize:
 
(void) - rightMouseDown:
 
(CGSize) - scaleSize
 
(void) - scaleUnitSquareToSize:
 
(void) - scrollClipView:toPoint:
 
(void) - scrollPoint:
 
(void) - scrollRect:by:
 
(BOOL) - scrollRectToVisible:
 
(void) - setAlphaValue:
 
(void) - setAnimations:
 
(void) - setAppearance:
 
(void) - setAutoresizesSubviews:
 
(void) - setAutoresizingMask:
 
(void) - setBackgroundColor:
 
(void) - setBounds:
 
(void) - setBoundsOrigin:
 
(void) - setBoundsSize:
 
(void) - setCenter:
 
(void) - setClipsToBounds:
 
(void) - setDOMClassName:
 
(void) - setFrame:
 
(void) - setFrameOrigin:
 
(void) - setHidden:
 
(void) - setHitTests:
 
(void) - setLayer:
 
(void) - setNeedsDisplay:
 
(void) - setNeedsDisplayInRect:
 
(void) - setNeedsLayout
 
(void) - setNeedsLayout:
 
(void) - setNextKeyView:
 
(void) - setPostsBoundsChangedNotifications:
 
(void) - setPostsFrameChangedNotifications:
 
(void) - setScaleSize:
 
(void) - setSubviews:
 
(void) - setTag:
 
(void) - setThemeClass:
 
(BOOL) - setThemeState:
 
(void) - setToolTip:
 
(void) - setValue:forThemeAttribute:
 
(void) - setValue:forThemeAttribute:inState:
 
(void) - setWantsLayer:
 
(CPArray) - subviews
 
(CPView- superview
 
(CPInteger) - tag
 
(void) - unlockFocus
 
(void) - unregisterDraggedTypes
 
(BOOL) - unsetThemeState:
 
(void) - viewDidEndLiveResize
 
(void) - viewDidHide
 
(void) - viewDidLayout
 
(void) - viewDidMoveToSuperview
 
(void) - viewDidUnhide
 
(void) - viewWillLayout
 
(void) - viewWillMoveToSuperview:
 
(void) - viewWillMoveToWindow:
 
(void) - viewWillStartLiveResize
 
(CPView- viewWithTag:
 
(CGRect) - visibleRect
 
(BOOL) - wantsLayer
 
(CPWindow- window
 

Class Methods

(CPString+ defaultThemeClass
 
(CPDictionary+ themeAttributes
 
- Class Methods inherited from CPView
(Class) + animatorClass
 
(CAAnimation+ defaultAnimationForKey:
 
(CPMenu+ defaultMenu
 
(void) + initialize
 
(BOOL) + isHighDPIDrawingEnabled
 
(CPSet) + keyPathsForValuesAffectingBounds
 
(CPSet) + keyPathsForValuesAffectingFrame
 
(void) + setHighDPIDrawingEnabled:
 

Detailed Description

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.

Method Documentation

◆ adjustSubviews()

- (void) adjustSubviews
implementation

Definition at line 794 of file CPSplitView.j.

◆ autosaveName()

- (CPString) autosaveName
implementation

Get the name under which the split view divider position is automatically saved to CPUserDefaults.

Returns
the name to save under or nil if no autosave is active

Definition at line 1075 of file CPSplitView.j.

◆ cursorAtPoint:hitDividerAtIndex:()

- (BOOL) cursorAtPoint: (CGPoint)  aPoint
hitDividerAtIndex: (int)  anIndex 
implementation

Definition at line 424 of file CPSplitView.j.

◆ cursorUpdate:()

- (void) cursorUpdate: (CPEvent anEvent
implementation

Provided by category CPSplitView(CPTrackingArea).

Definition at line 1228 of file CPSplitView.j.

◆ defaultThemeClass()

+ (CPString) defaultThemeClass
implementation

Reimplemented from CPView.

Definition at line 127 of file CPSplitView.j.

◆ didAddSubview:()

- (void) didAddSubview: (CPView aSubview
implementation

Called when the receiver has added aSubview to it's child views.

Parameters
aSubviewthe view that was added

Reimplemented from CPView.

Definition at line 263 of file CPSplitView.j.

◆ dividerThickness()

- (float) dividerThickness
implementation

Returns the thickness of the divider.

Returns
float - the thickness of the divider.

Definition at line 167 of file CPSplitView.j.

◆ drawDividerInRect:()

- (void) drawDividerInRect: (CGRect)  aRect
implementation

Draws the divider at a given rect.

Parameters
aRect- the rect of the divider to draw.

Definition at line 353 of file CPSplitView.j.

◆ drawRect:()

- (void) drawRect: (CGRect)  aRect
implementation

Draws the receiver into aRect. This method should be overridden by subclasses.

Parameters
aRectthe area that should be drawn into

Reimplemented from CPView.

Definition at line 313 of file CPSplitView.j.

◆ effectiveRectOfDividerAtIndex:()

- (CGRect) effectiveRectOfDividerAtIndex: (int)  aDivider
implementation

Returns the rect of the divider which the user is able to drag to resize.

Parameters
int- The index of the divider.
Returns
CGRect - The rect the user can drag.

Definition at line 302 of file CPSplitView.j.

◆ encodeWithCoder:()

- (void) encodeWithCoder: (CPCoder aCoder
implementation

Archives the view to a coder.

Parameters
aCoderthe object into which the view's data will be archived.

Reimplemented from CPView.

Provided by category CPSplitView(CPCoding).

Definition at line 1492 of file CPSplitView.j.

◆ hitTest:()

- (CPView) hitTest: (CGPoint)  aPoint
implementation

Tests whether a point is contained within this view, or one of its subviews.

Parameters
aPointthe point to test
Returns
returns the containing view, or nil if the point is not contained

Reimplemented from CPView.

Definition at line 447 of file CPSplitView.j.

◆ initWithCoder:()

- (id) initWithCoder: (CPCoder aCoder
implementation

Initializes the view from an archive.

Parameters
aCoderthe coder from which to initialize
Returns
the initialized view

Reimplemented from CPView.

Provided by category CPSplitView(CPCoding).

Definition at line 1426 of file CPSplitView.j.

◆ initWithFrame:()

- (id) initWithFrame: (CGRect)  aFrame
implementation

Initializes the receiver for usage with the specified bounding rectangle

Returns
the initialized view

Reimplemented from CPView.

Definition at line 143 of file CPSplitView.j.

◆ isPaneSplitter()

- (BOOL) isPaneSplitter
implementation

Use to find if the divider is a larger pane splitter.

Returns
BOOL - YES if the dividers are the larger pane splitters. Otherwise NO.

Definition at line 237 of file CPSplitView.j.

◆ isSubviewCollapsed:()

- (BOOL) isSubviewCollapsed: (CPView subview
implementation

Returns YES if the supplied subview is collapsed, otherwise NO.

Parameters
aSubview- the subview you are interested in.
Returns
BOOL - YES if the subview is collapsed, otherwise NO.

Definition at line 273 of file CPSplitView.j.

◆ isVertical()

- (BOOL) isVertical
implementation

Returns YES if the dividers are vertical, otherwise NO.

Returns
YES if vertical, otherwise NO.

Definition at line 176 of file CPSplitView.j.

◆ layoutSubviews()

- (void) layoutSubviews
implementation

Reimplemented from CPView.

Definition at line 344 of file CPSplitView.j.

◆ maxPossiblePositionOfDividerAtIndex:()

- (float) maxPossiblePositionOfDividerAtIndex: (int)  dividerIndex
implementation

Returns the maximum possible position of a divider at a given index.

Parameters
theindex of the divider.
Returns
float - the max possible position.

Definition at line 640 of file CPSplitView.j.

◆ minPossiblePositionOfDividerAtIndex:()

- (float) minPossiblePositionOfDividerAtIndex: (int)  dividerIndex
implementation

Returns the minimum possible position of a divider at a given index.

Parameters
theindex of the divider.
Returns
float - the min possible position.

Definition at line 655 of file CPSplitView.j.

◆ mouseDown:()

- (void) mouseDown: (CPEvent anEvent
implementation

Reimplemented from CPView.

Definition at line 558 of file CPSplitView.j.

◆ rectOfDividerAtIndex:()

- (CGRect) rectOfDividerAtIndex: (int)  aDivider
implementation

Returns the CGRect of the divider at a given index.

Parameters
int- The index of a divider.
Returns
CGRect - The rect of a divider.

Definition at line 284 of file CPSplitView.j.

◆ resizeSubviewsWithOldSize:()

- (void) resizeSubviewsWithOldSize: (CGSize)  aSize
implementation

Initiates -superviewSizeChanged: messages to subviews.

Parameters
aSizethe size for the subviews

Reimplemented from CPView.

Definition at line 783 of file CPSplitView.j.

◆ setAutosaveName:()

- (void) setAutosaveName: (CPString autosaveName
implementation

Set the name under which the split view divider positions is automatically saved to CPUserDefaults.

Parameters
autosaveNamethe name to save under or nil to not save

Definition at line 1062 of file CPSplitView.j.

◆ setButtonBar:forDividerAtIndex:()

- (void) setButtonBar: (CPButtonBar aButtonBar
forDividerAtIndex: (CPUInteger)  dividerIndex 
implementation

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.

Parameters
CPButtonBar- The supplied button bar.
unsignedint - The divider index the button bar will be assigned to.

Definition at line 1014 of file CPSplitView.j.

◆ setDelegate:()

- (void) setDelegate: (id <CPSplitViewDelegate>)  aDelegate
implementation

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;

Allows the delegate to specify which of the CPSplitView's subviews should adjust if the window is resized.

- (BOOL)splitView:(CPSplitView)aSplitView shouldAdjustSizeOfSubview:(CPView)aSubView

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;
Parameters
delegate- The delegate of the splitview.

Definition at line 955 of file CPSplitView.j.

◆ setFrameSize:()

- (void) setFrameSize: (CGSize)  aSize
implementation

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.

Parameters
aSizethe new size for the frame

Reimplemented from CPView.

Definition at line 768 of file CPSplitView.j.

◆ setIsPaneSplitter:()

- (void) setIsPaneSplitter: (BOOL)  shouldBePaneSplitter
implementation

Used to set if the split view dividers should be the larger pane splitter.

Parameters
shouldBePaneSplitter- YES if the dividers should be the thicker pane splitter, otherwise NO.

Definition at line 247 of file CPSplitView.j.

◆ setPosition:ofDividerAtIndex:()

- (void) setPosition: (float)  position
ofDividerAtIndex: (int)  dividerIndex 
implementation

Sets the position of a divider at a given index.

Parameters
position- The float value of the position to place the divider.
dividerIndex- The index of the divider to position.

Definition at line 711 of file CPSplitView.j.

◆ setVertical:()

- (void) setVertical: (BOOL)  shouldBeVertical
implementation

Sets if the splitview dividers are vertical.

Parameters
shouldBeVertical- YES if the splitview dividers should be vertical, otherwise NO.

Definition at line 185 of file CPSplitView.j.

◆ themeAttributes()

+ (CPDictionary) themeAttributes
implementation

Reimplemented from CPView.

Definition at line 132 of file CPSplitView.j.

◆ trackDivider:()

- (void) trackDivider: (CPEvent anEvent
implementation

Definition at line 477 of file CPSplitView.j.

◆ updateTrackingAreas()

- (void) updateTrackingAreas
implementation

Invoked automatically when the view’s geometry changes such that its tracking areas need to be recalculated.

You should override this method to remove out of date tracking areas, add recomputed tracking areas and then call super;

Cocoa calls this on every view, whereas they have tracking area(s) or not. Cappuccino behaves differently :

  • updateTrackingAreas is called during initWithFrame
  • updateTrackingAreas is also called when placing a view in the view hierarchy (that is in a window)
  • if you have only CPTrackingInVisibleRect tracking areas attached to a view, it will not be called again (until you move the view in the hierarchy)
  • if you have at least one non-CPTrackingInVisibleRect tracking area attached, it will be called every time the view geometry could be modified You don't have to touch to CPTrackingInVisibleRect tracking areas, they will be automatically updated

Please note that it is the owner of a tracking area who is called for updateTrackingAreas. But, if a view without any tracking area is inserted in the view hierarchy (that is, in a window), the view is called for updateTrackingAreas. This enables you to use updateTrackingArea to initially attach your tracking areas to the view.

Reimplemented from CPView.

Provided by category CPSplitView(CPTrackingArea).

Definition at line 1201 of file CPSplitView.j.

◆ viewDidMoveToWindow()

- (void) viewDidMoveToWindow
implementation

Called when the receiver has been moved to a new CPWindow.

Reimplemented from CPView.

Definition at line 567 of file CPSplitView.j.

◆ viewWillDraw()

- (void) viewWillDraw
implementation

Reimplemented from CPView.

Definition at line 386 of file CPSplitView.j.

◆ willRemoveSubview:()

- (void) willRemoveSubview: (CPView aView
implementation

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 329 of file CPSplitView.j.


The documentation for this class was generated from the following files: