home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Palettes / MiscCircularSlider / MiscCircularSlider.subproj / MiscCircularSliderCell.h < prev    next >
Encoding:
Text File  |  1995-07-06  |  4.1 KB  |  114 lines

  1. //
  2. //    MiscCircularSliderCell.h -- a SliderCell for circular sliders
  3. //           Written by Vince DeMarco and Don Yacktman
  4. //            Copyright (c) 1994 by Vince DeMarco, Don Yacktman.
  5. //                Version 1.0  All rights reserved.
  6. //        This notice may not be removed from this source code.
  7. //
  8. //    This object is included in the MiscKit by permission from the author
  9. //    and its use is governed by the MiscKit license, found in the file
  10. //    "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  11. //    for a list of all applicable permissions and restrictions.
  12. //    
  13.  
  14. // This was created by modifying Vince's CircularSliderCell class and
  15. // merging it with Don's RotationSliderCell class.  Here's the info
  16. // from the original files.
  17. /*
  18.  *    Filename:    CircularSliderCell.h 
  19.  *    Created :    Sun Oct 18 16:56:22 1992 
  20.  *    Author  :    Vince DeMarco
  21.  *        <vince@whatnxt.cuc.ab.ca>
  22.  *    LastEditDate was "Sun Oct 25 13:47:43 1992"
  23.  */
  24. //    RotationSliderCell.h -- written by Don Yacktman
  25. //    Copyright 1993 by Don Yacktman.  All rights reserved.
  26.  
  27. //    Modified by Laurent Daudelin on Wed Sep 7 12:09:55 1994
  28. //    to add support for lower and upper stop values, and
  29. //    to support for knob width adjustment for the MISC_SHUTTLEWHEEL_STYLE slider.
  30.  
  31. //  Modified by Carl Lindberg   Wed Apr 19 02:01:15 EDT 1995
  32. //  Added support for border types
  33. //  Added support for background color
  34. //  Fixed boundary-check bug, fixed bug when view is taller than it is wide
  35. //  Reorganized the code to something approaching sanity
  36. //  Redid drawing of knobImage, no more glitchiness on larger sliders/knob widths.
  37. //    (Unless you get really, really big :-) )
  38.  
  39. #import <appkit/SliderCell.h>
  40.  
  41. typedef enum _MiscCircularSliderStyle {
  42.         MISC_PIECHART_STYLE = 0,    // this is obvious:  a pie chart.
  43.         MISC_SLIDER_STYLE,            // this looks NeXT-like (ring shape)
  44.         MISC_DIAL_STYLE,            // raised circle with a radial line
  45.         MISC_SHUTTLEWHEEL_STYLE        // raised circle with a dimple
  46. } MiscCircularSliderStyle;
  47.  
  48. // If you change the values of these, make sure to change the tags
  49. // of the corresponding cells in the inspector nib...  -Carl
  50. typedef enum _MiscCircularSliderBorder {
  51.         MISC_CSNONE = 0,
  52.         MISC_CSLINE,
  53.         MISC_CSBUTTON,
  54.         MISC_CSBEZEL,
  55.         MISC_CSGROOVE
  56. } MiscCircularSliderBorder;
  57.  
  58. @interface MiscCircularSliderCell:SliderCell
  59. {
  60.     MiscCircularSliderStyle style; // which rendering style is being used
  61.     BOOL jumpToMousePoint; // Does the position indicator jump to the
  62.                     // location of the first mouse down event or does it
  63.                     // move in relation to the mouse dragging?
  64.     BOOL hidden;     // Is the Cell Hidden?
  65.     float radius;    // The smallest radius of the Cell
  66.     float sliderPathWidth;    // width of ring if MISC_SLIDER_STYLE
  67.     float upperStopValue;    // maximum value angle allowed while tracking the mouse
  68.     float lowerStopValue;    // minimum value angle allowed while tracking the mouse
  69.     BOOL useBoundaries;    // do we use the upperStopValue and lowerStopValue?
  70.     NXPoint center; // The center point of the Cell--x,y coordinates
  71.     MiscCircularSliderBorder borderType;
  72.     NXColor backgroundColor;
  73.     float startAngle;    // Angle at which the minValue is
  74.     BOOL isClockwise;    // Do values increase as slider moved clockwise?
  75. @private
  76.     BOOL imFlipped;    // we need to keep track of our flippedness...
  77.     float _offsetAng;
  78.     NXRect _lastFrame;
  79.     NXRect _lastViewFrame;
  80.     id disabledBezelImage, enabledBezelImage, knobImage; // caches
  81. }
  82.  
  83. - init;
  84. - setSliderPathWidth:(float)val;
  85. - (float)sliderPathWidth;
  86. - setSliderStyle:(MiscCircularSliderStyle)aBOOL;
  87. - (MiscCircularSliderStyle)sliderStyle;
  88. //- renderAll;
  89. - setJumpToMousePoint:(BOOL)aBOOL;
  90. - (BOOL)jumpToMousePoint;
  91. - setHidden:(BOOL)flag;
  92. - (BOOL)hidden;
  93. - setUpperStopValue:(float)aValue;
  94. - (float)upperStopValue;
  95. - setLowerStopValue:(float)aValue;
  96. - (float)lowerStopValue;
  97. - setUseBoundaries:(BOOL)flag;
  98. - (BOOL)useBoundaries;
  99. - (float)startAngle;
  100. - setStartAngle:(float)ang;
  101. - (BOOL)isClockwise;
  102. - setClockwise:(BOOL)clockwise;
  103. - read:(NXTypedStream *)stream;
  104. - write:(NXTypedStream *)stream;
  105.  
  106. - setBackgroundColor:(NXColor)aColor;
  107. - (NXColor)backgroundColor;
  108. - setBorderType:(int)type;
  109. - (int)borderType;
  110. //- drawSelf:(const NXRect *)cellFrame inView:controlView;
  111. //- drawInside:(const NXRect *)cellFrame inView:controlView;
  112.  
  113. @end
  114.