home *** CD-ROM | disk | FTP | other *** search
- //
- // MiscSliderField.m -- a TextField subclass that specializes in using
- // the MiscSliderCell.
- // Written by David Fedchenko. Copyright 1994 by David Fedchenko.
- // 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.
- //
-
- #import "MiscSliderField.h"
- #import "MiscSliderCell.h"
-
- @implementation MiscSliderField
-
- static id _idMiscSliderCellClass;
-
- + initialize
- {
- /* Class initialization code. */
- if (self == [MiscSliderField class])
- {
- _idMiscSliderCellClass = [MiscSliderCell class]; // Default class
- }
-
- return self;
- }
-
- + setCellClass:classId
- {
- _idMiscSliderCellClass = classId;
-
- return self;
- }
-
- - initFrame:(const NXRect *)frameRect
- {
- id oldCell;
-
- [super initFrame:frameRect];
- oldCell = [self setCell:[[_idMiscSliderCellClass alloc] initTextCell:"0"]];
- [oldCell free];
-
- return self;
- }
-
- // the methods to communicate with the cell
- - setMinValue:(double)value
- {
- [cell setMinValue:value];
-
- return self;
- }
-
- - setMaxValue:(double)value
- {
- [cell setMaxValue:value];
-
- return self;
- }
-
- - setMinBoundary:(double)value
- {
- [cell setMinBoundary:value];
-
- return self;
- }
-
- - setMaxBoundary:(double)value
- {
- [cell setMaxBoundary:value];
-
- return self;
- }
-
- -(double) minValue
- {
- return [(MiscSliderCell *)cell minValue];
- }
-
- -(double) maxValue
- {
- return [(MiscSliderCell *)cell maxValue];
- }
-
- -(double) minBoundary
- {
- return [cell minBoundary];
- }
-
- -(double) maxBoundary
- {
- return [cell maxBoundary];
- }
-
- - setExpandMin:(BOOL)flag
- {
- [cell setExpandMin:flag];
-
- return self;
- }
-
- - setExpandMax:(BOOL)flag
- {
- [cell setExpandMax:flag];
-
- return self;
- }
-
- -(BOOL) expandMin
- {
- return [cell expandMin];
- }
-
- -(BOOL) expandMax
- {
- return [cell expandMax];
- }
-
- - setPosition:(int)where
- {
- [cell setPosition:where];
-
- return self;
- }
-
- - setSplit:(int)percent
- {
- [cell setSplit:percent];
-
- return self;
- }
-
- - setIntegerOnly:(BOOL)flag
- {
- [cell setIntegerOnly:flag];
-
- return self;
- }
-
- -(int) position
- {
- return [cell position];
- }
-
- -(int) split
- {
- return [cell split];
- }
-
- -(BOOL) integerOnly
- {
- return [cell integerOnly];
- }
-
-
- - setStringList:anObject
- {
- stringList = anObject;
-
- [cell setStringList:anObject];
-
- return self;
- }
-
- - stringList
- {
- if ([cell stringList])
- {
- return [cell stringList];
- }
- else
- {
- return stringList;
- }
- }
-
- @end
-