/* * RBSplitViewPrivateDefines.h version 1.0.4 * RBSplitView * * Created by Rainer Brockerhoff on 19/11/2004. * Copyright 2004,2005 Rainer Brockerhoff. All rights reserved. * */ // These defines are used only locally; no sense exporting them in the main header file where they might // conflict with something... // This is the hysteresis value for collapsing/expanding subviews with the mouse. 0.05 (5%) works well. #define HYSTERESIS (0.05) // This selects the main horizontal or vertical coordinate according to the split view's orientation. // It can be used as an lvalue, too. You need to have BOOL ishor declared to use it. #define DIM(x) (((float*)&(x))[ishor]) // This selects the other coordinate. #define OTHER(x) (((float*)&(x))[!ishor]) // This value for the view offsets is guaranteed to be out of view for quite some time and is used // to mark the view as collapsed (NSSplitView seems to use the same value). #define WAYOUT (1000000.0) // This is the default framerate for collapse/expand animation. #define FRAMETIME (1.0/60.0) // This struct is used internally for speeding up adjustSubviews. typedef struct subviewCache { NSRect rect; // the subview's frame double fraction; // fractional extra RBSplitSubview* sub; // points at the subview float size; // current dimension (integer) BOOL constrain; // set if constrained } subviewCache; // This struct is used internally for doing collapse/expand animation. typedef struct animationData { RBSplitSubview* owner; // the subview being animated float dimension; // the subview's starting or ending dimension int stepsDone; // counts already done animation steps NSTimeInterval elapsedTime; // time already spent in resizing and adjusting subviews NSTimeInterval finishTime; // the animation should be finished at this time NSTimeInterval totalTime; // total time the animation should take BOOL collapsing; // YES if we're collapsing, NO if we're expanding } animationData; // The following methods are for internal use, and normally you'll never call or override them. @interface RBSplitSubview (RB___SubviewAdditions) - (animationData*)RB___animationData:(BOOL)start; - (void)RB___stepAnimation; - (BOOL)RB___stopAnimation; - (float)RB___visibleDimension; - (float)RB___setMinAndMaxTo:(float)value savingMin:(float*)oldmin andMax:(float*)oldmax; - (float)RB___collapse; - (float)RB___expandAndSetToMinimum:(BOOL)setToMinimum; - (void)RB___finishCollapse:(NSSize)size withFraction:(double)value; - (void)RB___finishExpand; - (void)RB___setFrameSize:(NSSize)size withFraction:(double)value; - (void)RB___setFrame:(NSRect)rect withFraction:(double)value; - (double)RB___fraction; - (void)RB___copyIntoCache:(subviewCache*)cache; - (void)RB___updateFromCache:(subviewCache*)cache withTotalDimension:(float)value; @end @interface RBSplitView (RB___ViewAdditions) - (void)RB___adjustSubviews; - (float)RB___dimensionWithoutDividers; - (float)RB___dividerThickness; - (void)RB___drawDivider:(NSImage*)anImage inRect:(NSRect)rect betweenView:(RBSplitSubview*)leading andView:(RBSplitSubview*)trailing; - (NSRect)RB___dividerRect:(unsigned)index relativeToView:(RBSplitView*)view; - (void)RB___setMustClearFractions; - (void)RB___trackMouseEvent:(NSEvent*)theEvent from:(NSPoint)where withBase:(NSPoint)base inDivider:(unsigned)index; - (void)RB___addCursorRectsTo:(RBSplitView*)masterView forDividerRect:(NSRect)rect thickness:(float)delta; - (unsigned)RB___dividerHitBy:(NSPoint)point relativeToView:(RBSplitView*)view thickness:(float)delta; - (void)RB___drawDividersIn:(RBSplitView*)masterView forDividerRect:(NSRect)rect thickness:(float)delta; @end