Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
RBSplitSubview.h
Go to the documentation of this file.
1//
2// RBSplitSubview.h version 1.2
3// RBSplitView
4//
5// Created by Rainer Brockerhoff on 19/11/2004.
6// Copyright 2004-2009 Rainer Brockerhoff.
7// Some Rights Reserved under the Creative Commons Attribution License, version 2.5, and/or the MIT License.
8//
9
10#import <Cocoa/Cocoa.h>
11
12@class RBSplitView;
13
14// These values are used to inquire about the status of a subview.
21
22@interface RBSplitSubview : NSView {
23// Subclasses normally should use setter methods instead of changing instance variables by assignment.
24// Most getter methods simply return the corresponding instance variable, so with some care, subclasses
25// could reference them directly.
26 NSString* identifier; // An identifier string for the subview, default is @"".
27 NSInteger tag; // A tag integer for the subview, default is 0.
28 CGFloat minDimension; // The minimum dimension. Must be 1.0 or any larger integer.
29 CGFloat maxDimension; // The maximum dimension. Must be at least equal to the minDimension.
30 // Set to a large number if there's no maximum.
31 double fraction; // A fractional part of the dimension, used for proportional resizing.
32 // Normally varies between -0.999... and 0.999...
33 // When collapsed, holds the proportion of the RBSplitView's dimension
34 // the view was occupying before collapsing.
35 NSRect previous; // Holds the frame rect for the last delegate notification.
36 NSSize savedSize; // This holds the size the subview had before it was resized beyond
37 // its minimum or maximum limits. Valid if notInLimits is YES.
38 NSUInteger actDivider; // This is set temporarily while an alternate drag view is being dragged.
39 BOOL canDragWindow; // This is set temporarily during a mouseDown on a non-opaque subview.
40 BOOL canCollapse; // YES if the subview can be collapsed.
41 BOOL notInLimits; // YES if the subview's dimensions are outside the set limits.
42}
43
44// This class method returns YES if some RBSplitSubview is being animated.
45+ (BOOL)animating;
46
47// This is the designated initializer for creating extra subviews programmatically.
48- (id)initWithFrame:(NSRect)frame;
49
50// Returns the immediately containing RBSplitView, or nil if there is none.
51// couplingSplitView returns nil if we're a non-coupled RBSplitView.
52// outermostSplitView returns the outermost RBSplitView.
53- (RBSplitView*)splitView;
54- (RBSplitView*)couplingSplitView;
55- (RBSplitView*)outermostSplitView;
56
57// Returns self if we're a RBSplitView, nil otherwise. Convenient for testing or calling methods.
58// coupledSplitView returns nil if we're a non-coupled RBSplitView.
59- (RBSplitView*)asSplitView;
60- (RBSplitView*)coupledSplitView;
61
62// Sets and gets the coupling between the view and its containing RBSplitView (if any). Coupled
63// RBSplitViews take some parameters, such as divider images, from the containing view. The default
64// for RBSplitView is YES. However, calling setCoupled: on a RBSplitSubview will have no effect,
65// and isCoupled will always return false.
66- (void)setCoupled:(BOOL)flag;
67- (BOOL)isCoupled;
68
69// Returns YES if the containing RBSplitView is horizontal.
70- (BOOL)splitViewIsHorizontal;
71
72// Returns the number of subviews. Just a convenience method.
73- (NSUInteger)numberOfSubviews;
74
75// Sets and gets the tag.
76- (void)setTag:(NSInteger)theTag;
77- (NSInteger)tag;
78
79// Sets and gets the identifier string. Will never be nil.
80- (void)setIdentifier:(NSString*)aString;
81- (NSString*)identifier;
82
83// Position means the subview's position within the RBSplitView - counts from zero left to right
84// or top to bottom. Setting it will move the subview to another position without changing its size,
85// status or attributes. Set position to 0 to move it to the start, or to some large number to move it
86// to the end of the RBSplitView.
87- (NSUInteger)position;
88- (void)setPosition:(NSUInteger)newPosition;
89
90// Returns YES if the subview is collapsed. Collapsed subviews are squashed down to zero but never
91// made smaller than the minimum dimension as far as their own subviews are concerned. If the
92// subview is being animated this will return NO.
93- (BOOL)isCollapsed;
94
95// This will return the current status of the subview. Negative values mean the subview is
96// being animated.
97- (RBSSubviewStatus)status;
98
99// Sets and gets the ability to collapse the subview. However, this can be overridden by the delegate.
100- (BOOL)canCollapse;
101- (void)setCanCollapse:(BOOL)flag;
102
103// Tests whether the subview can shrink or expand further.
104- (BOOL)canShrink;
105- (BOOL)canExpand;
106
107// Sets and gets the minimum and maximum dimensions. They're set at the same time to make sure values
108// are consistent. Despite being floats, they'll always have integer values. The minimum value for the
109// minimum is 1.0. Pass 0.0 for the maximum to set it to some huge number.
110- (CGFloat)minDimension;
111- (CGFloat)maxDimension;
112- (void)setMinDimension:(CGFloat)newMinDimension andMaxDimension:(CGFloat)newMaxDimension;
113
114// Call this to expand a subview programmatically. It will return the subview's dimension after
115// expansion.
116- (CGFloat)expand;
117
118// Call this to collapse a subview programmatically. It will return the negative
119// of the subview's dimension _before_ collapsing, or 0.0 if the subview can't be collapsed.
120- (CGFloat)collapse;
121
122// These calls collapse and expand subviews with animation. They return YES if animation
123// startup was successful.
124- (BOOL)collapseWithAnimation;
125- (BOOL)expandWithAnimation;
126
127// These methods collapse and expand subviews with animation, depending on the parameters.
128// They return YES if animation startup was successful. If resize is NO, the subview is
129// collapsed/expanded without resizing it during animation.
130- (BOOL)collapseWithAnimation:(BOOL)animate withResize:(BOOL)resize;
131- (BOOL)expandWithAnimation:(BOOL)animate withResize:(BOOL)resize;
132
133// Returns the current dimension of the subview.
134- (CGFloat)dimension;
135
136// Sets the current dimension of the subview, subject to the current maximum and minimum.
137// If the subview is collapsed, this has no immediate effect.
138- (void)setDimension:(CGFloat)value;
139
140// This method is used internally when a divider is dragged. It tries to change the subview's dimension
141// and returns the actual change, collapsing or expanding whenever possible. You usually won't need
142// to call this directly.
143- (CGFloat)changeDimensionBy:(CGFloat)increment mayCollapse:(BOOL)mayCollapse move:(BOOL)move;
144
145@end
146
RBSSubviewStatus
@ RBSSubviewCollapsing
@ RBSSubviewNormal
@ RBSSubviewExpanding
@ RBSSubviewCollapsed
NSUInteger actDivider
NSString * identifier