home *** CD-ROM | disk | FTP | other *** search
- //
- // MiscCircularSlider.m -- a cover for the MiscCircularSliderCell class
- // Written by Vince DeMarco and Don Yacktman,
- // Copyright (c) 1994 by Vince DeMarco and 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 CircularSlider class and
- // merging it with Don's RotationSlider class. Here's the info
- // from the original files.
- /*
- * Filename: CircularSlider.m
- * Created : Sat 24 21:25:44 1991
- * Author : Vince DeMarco <vince@whatnxt.cuc.ab.ca>
- * LastEditDate Was "Mon Sep 6 16:32:15 1993"
- *
- * Version 2.0
- */
- // RotationSlider.m -- written by Don Yacktman
- // Copyright 1993 by Don Yacktman. All rights reserved.
-
- #import "MiscCircularSlider.h"
-
- static id MiscCircularSliderCellClass;
-
- @implementation MiscCircularSlider
-
- + initialize
- {
- if (self == [MiscCircularSlider class]) {
- MiscCircularSliderCellClass = [MiscCircularSliderCell class];
- // the default class
- }
- return self;
- }
-
- + setCellClass:classId
- {
- MiscCircularSliderCellClass = classId;
- return self;
- }
-
- - initFrame:(NXRect *)nf
- {
- [super initFrame:nf];
- [[self setCell:[[MiscCircularSliderCellClass alloc] init]] free];
- return self;
- }
-
- - setBezeled:(BOOL)value
- {
- BOOL old = [cell isBezeled];
- [cell setBezeled:value];
- if (old != value) [self display];
- return self;
- }
-
- - (BOOL)isBezeled
- {
- return [cell isBezeled];
- }
-
- - setBordered:(BOOL)value
- {
- BOOL old = [cell isBordered];
- [cell setBordered:value];
- if (old != value) [self display];
- return self;
- }
-
- - (BOOL)isBordered
- {
- return [cell isBordered];
- }
-
- - setJumpToMousePoint:(BOOL)aBOOL
- {
- [cell setJumpToMousePoint:aBOOL];
- return self;
- }
-
- - (BOOL)jumpToMousePoint
- {
- return [cell jumpToMousePoint];
- }
-
- - setHidden:(BOOL)aBOOL
- {
- BOOL old = [cell hidden];
- [cell setHidden:aBOOL];
- if (aBOOL != old) [self display];
- return self;
- }
-
- - (BOOL)hidden
- {
- return (BOOL)[cell hidden];
- }
-
- - setSliderStyle:(MiscCircularSliderStyle)style
- {
- MiscCircularSliderStyle old = [cell sliderStyle];
- [cell setSliderStyle:style];
- if (style != old) [self display];
- return self;
- }
-
- - (MiscCircularSliderStyle)sliderStyle
- {
- return (MiscCircularSliderStyle)[cell sliderStyle];
- }
-
- - setSliderPathWidth:(float)value
- {
- [cell setSliderPathWidth:value];
- return self;
- }
-
- - (float)sliderPathWidth
- {
- return [cell sliderPathWidth];
- }
-
- @end
-
-
- @implementation MiscCircularSlider(Compatability)
-
- // Two covers to make sure we implement the methods that were used by Vince's
- // CircularSlider. This way, code that used that slider will still work as
- // it did before with this new class dropped in instead.
-
- - setDrawAsPieChart:(BOOL)aBOOL
- {
- return [self setSliderStyle:
- (aBOOL ? MISC_PIECHART_STYLE : MISC_DIAL_STYLE)];
- }
-
- - (BOOL)drawAsPieChart
- {
- return (BOOL)([self sliderStyle] == MISC_PIECHART_STYLE);
- }
-
- @end
-