ftp.nice.ch/pub/next/developer/resources/palettes/PAThumbWheelPalette.NI.bs.tar.gz#/PAThumbWheelCell.h

This is PAThumbWheelCell.h in view mode; [Download] [Up]

#import <appkit/appkit.h>

/******************************************************************************
	PAThumbWheelCell
	
PAThumbWheel offers the functionality of Slider plus the features that you would expect from a real thumbwheel (including 2 3/4 D Graphics!).

PAThumbWheel has a linear display mode and a radial display mode and offers the ability to assign a value to the visible region of the control as well as an absolute value that the ThumbWheel will either ignore, bound to or wrap around.

PAThumbWheel can also return relative values via its -relativeIntValue & -relativeFloatValue methods. A snap back option allows mouse loops to start from and return to a base value.

Copyright 1992, Jeff Martin. (jmartin@next.com 415-780-3833)
******************************************************************************/
@interface PAThumbWheelCell : ActionCell
{
	int		displayMode;	// DISPLAY_MODE_LINEAR or DISPLAY_MODE_RADIAL
	int		direction;		// DIRECTION_HORIZONTAL or DIRECTION_VERTICAL

	float	floatValue;		// Float value of TW
	float	lastFloatValue;	// Used to calculate relative change in value

	float	visMax;			// Value at top or right point
	float	visMin;			// Value at bottom or left point

	int		absMode;		// ABSOLUTE_UNBOUNDED, _BOUNDED and _WRAPPED
	float	absMax;			// Max value (meaningless if unbounded)
	float	absMin;			// Min value (meaningless if unbounded)
	
	BOOL	snapsBack;		// Whether TW snaps back to a value when done
	float	snapBackValue;	// Value to snap back to (typically 0)

	int		dashInterval;	// How often to draw a dash (in points or degrees)	
	BOOL	showMainDash;	// Set this to NO if you only want relative values

	NXColor color;			// Color of the Thumbwheel
	NXImage	*image;			// Background of Thumbwheel in radial mode
	NXRect	cellFrame;		// Frame of the cell at track mouse time.
}

- init;

// Overridden Cell Methods
- (BOOL)continueTracking:(const NXPoint *)lastPoint 
    at:(const NXPoint *)currPoint inView:view;
- stopTracking:(const NXPoint *)lastPoint at:(const NXPoint *)stopPoint
    inView:view mouseIsUp:(BOOL)flag;

// The value that corresponds to a point relative to visible range and frame
- (float)floatValueAtPoint:(NXPoint)point forFrame:(NXRect)frame;

// Direction: vertical or horizontal
- (int)direction;
- setDirection:(int)dir;
- (BOOL)isVertical;
- setVertical;
- (BOOL)isHorizontal;
- setHorizontal;

// DisplayMode: radial or linear
- (int)displayMode;
- setDisplayMode:(int)mode;
- (BOOL)isRadial;
- setRadial;
- (BOOL)isLinear;
- setLinear;

// Visible min and max
- (float)visibleMax;
- setVisibleMax:(float)max;
- (float)visibleMin;
- setVisibleMin:(float)min;
- (float)visibleRange;
- (float)middleValue;

// Absolute mode: unbounded, bounded or wrapped
- (int)absoluteMode;
- setAbsoluteMode:(int)mode;
- (BOOL)isUnbounded;
- setUnbounded;
- (BOOL)isBounded;
- setBounded;
- (BOOL)isWrapped;
- setWrapped;
- (float)absoluteMax;
- setAbsoluteMax:(float)value;
- (float)absoluteMin;
- setAbsoluteMin:(float)value;
- (float)absoluteRange;

// Relative Values
- (int)relativeIntValue;
- (float)relativeFloatValue;
- resetRelativeValue;

// Snap back characteristic
- (BOOL)snapsBack;
- setSnapsBack:(BOOL)flag;
- (float)snapBackValue;
- setSnapBackValue:(float)val;

// Dash interval (set in degrees or points depending on displayMode)
- (float)dashInterval;
- setDashInterval:(float)val;

// Showing the main dash
- (BOOL)showMainDash;
- setShowMainDash:(BOOL)flag;

// Color of the ThumbWheel
- (NXColor)color;
- setColor:(NXColor)color;

// Shift calcs the shift of the dashes from the floatValue, visRange & frame
- (int)shift:(const NXRect *)frame;

// Override highlight:inView:lit: so that it does nothing
- highlight:(const NXRect *)frame inView:view lit:(BOOL)flag;

// Override this so that we track mouse whether or not it is on top of us.
+ (BOOL)prefersTrackingUntilMouseUp;

@end

#define DISPLAY_MODE_LINEAR		0
#define DISPLAY_MODE_RADIAL		1

#define DIRECTION_HORIZONTAL	0
#define DIRECTION_VERTICAL		1

#define ABSOLUTE_UNBOUNDED		0
#define ABSOLUTE_BOUNDED		1
#define ABSOLUTE_WRAPPED		2

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.