home *** CD-ROM | disk | FTP | other *** search
- //
- // MiscCircularSliderCell.h -- a SliderCell for circular sliders
- // Written by Vince DeMarco and Don Yacktman
- // Copyright (c) 1994 by Vince DeMarco, Don Yacktman.
- // Version 1.0 All rights reserved.
- // This notice may not be removed from this source code.
- //
- // This object is included in the MiscKit by permission from the author
- // and its use is governed by the MiscKit license, found in the file
- // "LICENSE.rtf" in the MiscKit distribution. Please refer to that file
- // for a list of all applicable permissions and restrictions.
- //
-
- // This was created by modifying Vince's CircularSliderCell class and
- // merging it with Don's RotationSliderCell class. Here's the info
- // from the original files.
- /*
- * Filename: CircularSliderCell.h
- * Created : Sun Oct 18 16:56:22 1992
- * Author : Vince DeMarco
- * <vince@whatnxt.cuc.ab.ca>
- * LastEditDate was "Sun Oct 25 13:47:43 1992"
- */
- // RotationSliderCell.h -- written by Don Yacktman
- // Copyright 1993 by Don Yacktman. All rights reserved.
-
- // Modified by Laurent Daudelin on Wed Sep 7 12:09:55 1994
- // to add support for lower and upper stop values, and
- // to support for knob width adjustment for the MISC_SHUTTLEWHEEL_STYLE slider.
-
- // Modified by Carl Lindberg Wed Apr 19 02:01:15 EDT 1995
- // Added support for border types
- // Added support for background color
- // Fixed boundary-check bug, fixed bug when view is taller than it is wide
- // Reorganized the code to something approaching sanity
- // Redid drawing of knobImage, no more glitchiness on larger sliders/knob widths.
- // (Unless you get really, really big :-) )
-
- #import <appkit/SliderCell.h>
-
- typedef enum _MiscCircularSliderStyle {
- MISC_PIECHART_STYLE = 0, // this is obvious: a pie chart.
- MISC_SLIDER_STYLE, // this looks NeXT-like (ring shape)
- MISC_DIAL_STYLE, // raised circle with a radial line
- MISC_SHUTTLEWHEEL_STYLE // raised circle with a dimple
- } MiscCircularSliderStyle;
-
- // If you change the values of these, make sure to change the tags
- // of the corresponding cells in the inspector nib... -Carl
- typedef enum _MiscCircularSliderBorder {
- MISC_CSNONE = 0,
- MISC_CSLINE,
- MISC_CSBUTTON,
- MISC_CSBEZEL,
- MISC_CSGROOVE
- } MiscCircularSliderBorder;
-
- @interface MiscCircularSliderCell:SliderCell
- {
- MiscCircularSliderStyle style; // which rendering style is being used
- BOOL jumpToMousePoint; // Does the position indicator jump to the
- // location of the first mouse down event or does it
- // move in relation to the mouse dragging?
- BOOL hidden; // Is the Cell Hidden?
- float radius; // The smallest radius of the Cell
- float sliderPathWidth; // width of ring if MISC_SLIDER_STYLE
- float upperStopValue; // maximum value angle allowed while tracking the mouse
- float lowerStopValue; // minimum value angle allowed while tracking the mouse
- BOOL useBoundaries; // do we use the upperStopValue and lowerStopValue?
- NXPoint center; // The center point of the Cell--x,y coordinates
- MiscCircularSliderBorder borderType;
- NXColor backgroundColor;
- float startAngle; // Angle at which the minValue is
- BOOL isClockwise; // Do values increase as slider moved clockwise?
- @private
- BOOL imFlipped; // we need to keep track of our flippedness...
- float _offsetAng;
- NXRect _lastFrame;
- NXRect _lastViewFrame;
- id disabledBezelImage, enabledBezelImage, knobImage; // caches
- }
-
- - init;
- - setSliderPathWidth:(float)val;
- - (float)sliderPathWidth;
- - setSliderStyle:(MiscCircularSliderStyle)aBOOL;
- - (MiscCircularSliderStyle)sliderStyle;
- //- renderAll;
- - setJumpToMousePoint:(BOOL)aBOOL;
- - (BOOL)jumpToMousePoint;
- - setHidden:(BOOL)flag;
- - (BOOL)hidden;
- - setUpperStopValue:(float)aValue;
- - (float)upperStopValue;
- - setLowerStopValue:(float)aValue;
- - (float)lowerStopValue;
- - setUseBoundaries:(BOOL)flag;
- - (BOOL)useBoundaries;
- - (float)startAngle;
- - setStartAngle:(float)ang;
- - (BOOL)isClockwise;
- - setClockwise:(BOOL)clockwise;
- - read:(NXTypedStream *)stream;
- - write:(NXTypedStream *)stream;
-
- - setBackgroundColor:(NXColor)aColor;
- - (NXColor)backgroundColor;
- - setBorderType:(int)type;
- - (int)borderType;
- //- drawSelf:(const NXRect *)cellFrame inView:controlView;
- //- drawInside:(const NXRect *)cellFrame inView:controlView;
-
- @end
-