2 // RBSplitViewPrivateDefines.h version 1.1.4
5 // Created by Rainer Brockerhoff on 19/11/2004.
6 // Copyright 2004-2006 Rainer Brockerhoff.
7 // Some Rights Reserved under the Creative Commons Attribution License, version 2.5, and/or the MIT License.
10 // These defines are used only locally; no sense exporting them in the main header file where they might
11 // conflict with something...
13 // This is the hysteresis value for collapsing/expanding subviews with the mouse. 0.05 (5%) works well.
14 #define HYSTERESIS (0.05)
16 // This selects the main horizontal or vertical coordinate according to the split view's orientation.
17 // It can be used as an lvalue, too. You need to have BOOL ishor declared to use it.
18 #define DIM(x) (((float*)&(x))[ishor])
20 // This selects the other coordinate.
21 #define OTHER(x) (((float*)&(x))[!ishor])
23 // This value for the view offsets is guaranteed to be out of view for quite some time and is used
24 // to mark the view as collapsed.
25 #define WAYOUT (1000000.0)
27 // This is the default framerate for collapse/expand animation.
28 #define FRAMETIME (1.0/60.0)
30 // This struct is used internally for speeding up adjustSubviews.
31 typedef struct subviewCache
{
32 NSRect rect
; // the subview's frame
33 double fraction
; // fractional extra
34 RBSplitSubview
* sub
; // points at the subview
35 float size
; // current dimension (integer)
36 BOOL constrain
; // set if constrained
39 // This struct is used internally for doing collapse/expand animation.
40 typedef struct animationData
{
41 RBSplitSubview
* owner
; // the subview being animated
42 float dimension
; // the subview's starting or ending dimension
43 int stepsDone
; // counts already done animation steps
44 NSTimeInterval elapsedTime
; // time already spent in resizing and adjusting subviews
45 NSTimeInterval finishTime
; // the animation should be finished at this time
46 NSTimeInterval totalTime
; // total time the animation should take
47 BOOL collapsing
; // YES if we're collapsing, NO if we're expanding
48 BOOL resizing
; // YES if we're resizing, NO if we're frozen
51 // The following methods are for internal use, and you should never call or override them.
52 // They'll probably vary wildy from version to version, too.
54 @interface
RBSplitSubview (RB___SubviewAdditions
)
56 - (void)RB___setHidden
:(BOOL
)flag
;
57 - (animationData
*)RB___animationData
:(BOOL
)start resize
:(BOOL
)resize
;
58 - (void)RB___stepAnimation
;
59 - (BOOL
)RB___stopAnimation
;
60 - (float)RB___visibleDimension
;
61 - (float)RB___setMinAndMaxTo
:(float)value savingMin
:(float*)oldmin andMax
:(float*)oldmax
;
62 - (float)RB___collapse
;
63 - (float)RB___expandAndSetToMinimum
:(BOOL
)setToMinimum
;
64 - (void)RB___finishCollapse
:(NSRect
)rect withFraction
:(double)value
;
65 - (void)RB___finishExpand
:(NSRect
)rect withFraction
:(double)value
;
66 - (void)RB___setFrameSize
:(NSSize
)size withFraction
:(double)value
;
67 - (void)RB___setFrame
:(NSRect
)rect withFraction
:(double)value notify
:(BOOL
)notify
;
68 - (double)RB___fraction
;
69 - (void)RB___copyIntoCache
:(subviewCache
*)cache
;
70 - (void)RB___updateFromCache
:(subviewCache
*)cache withTotalDimension
:(float)value
;
71 - (BOOL
)RB___clearResponder
;
75 @interface
RBSplitView (RB___ViewAdditions
)
77 - (void)RB___adjustOutermostIfNeeded
;
78 - (void)RB___setDragging
:(BOOL
)flag
;
79 - (float)RB___dividerOrigin
:(int)indx
;
80 - (NSArray
*)RB___subviews
;
81 - (unsigned int)RB___numberOfSubviews
;
82 - (void)RB___adjustSubviewsExcepting
:(RBSplitSubview
*)excepting
;
83 - (float)RB___dimensionWithoutDividers
;
84 - (float)RB___dividerThickness
;
85 - (NSRect
)RB___dividerRect
:(unsigned)indx relativeToView
:(RBSplitView
*)view
;
86 - (void)RB___setMustClearFractions
;
87 - (BOOL
)RB___shouldResizeWindowForDivider
:(unsigned int)indx betweenView
:(RBSplitSubview
*)leading andView
:(RBSplitSubview
*)trailing willGrow
:(BOOL
)grow
;
88 - (void)RB___tryToExpandLeading
:(RBSplitSubview
*)leading divider
:(unsigned int)indx trailing
:(RBSplitSubview
*)trailing delta
:(float)delta
;
89 - (void)RB___tryToShortenLeading
:(RBSplitSubview
*)leading divider
:(unsigned int)indx trailing
:(RBSplitSubview
*)trailing delta
:(float)delta always
:(BOOL
)always
;
90 - (void)RB___tryToExpandTrailing
:(RBSplitSubview
*)trailing leading
:(RBSplitSubview
*)leading delta
:(float)delta
;
91 - (void)RB___tryToShortenTrailing
:(RBSplitSubview
*)trailing divider
:(unsigned int)indx leading
:(RBSplitSubview
*)leading delta
:(float)delta always
:(BOOL
)always
;
92 - (void)RB___trackMouseEvent
:(NSEvent
*)theEvent from
:(NSPoint
)where withBase
:(NSPoint
)base inDivider
:(unsigned)indx
;
93 - (void)RB___addCursorRectsTo
:(RBSplitView
*)masterView forDividerRect
:(NSRect
)rect thickness
:(float)delta
;
94 - (unsigned)RB___dividerHitBy
:(NSPoint
)point relativeToView
:(RBSplitView
*)view thickness
:(float)delta
;
95 - (void)RB___drawDividersIn
:(RBSplitView
*)masterView forDividerRect
:(NSRect
)rect thickness
:(float)delta
;