home *** CD-ROM | disk | FTP | other *** search
- //
- // MiscValueField.m -- a TextField subclass that specializes in using
- // the MiscValueCell.
- // Written by David Fedchenko. Copyright 1994 by David Fedchenko.
- // Version 2.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 "MiscValueField.h"
- #import "MiscValueCell.h"
-
- @implementation MiscValueField
-
- static id _idMiscValueCellClass;
-
- + initialize
- {
- /* Class initialization code. */
- if (self == [MiscValueField class])
- {
- _idMiscValueCellClass = [MiscValueCell class]; // Default class
- }
-
- return self;
- }
-
- + setCellClass:classId
- {
- _idMiscValueCellClass = classId;
-
- return self;
- }
-
- - initFrame:(const NXRect *)frameRect
- {
- id oldCell;
-
- [super initFrame:frameRect];
- oldCell = [self setCell:[[_idMiscValueCellClass 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
- {
- // there is casting here because the NeXT headers have a type conflict
- // for these two methods.
- return [(MiscValueCell *)cell minValue];
- }
-
- -(double) maxValue
- {
- return [(MiscValueCell *)cell maxValue];
- }
-
- -(double) minBoundary
- {
- return [cell minBoundary];
- }
-
- -(double) maxBoundary
- {
- return [cell maxBoundary];
- }
-
- - setStepSize:(double)size
- {
- [cell setStepSize:size];
-
- return self;
- }
-
- - setAltStepSize:(double)size
- {
- [cell setAltStepSize:size];
-
- return self;
- }
-
- -(double) stepSize
- {
- return [cell stepSize];
- }
-
- -(double) altStepSize
- {
- return [cell altStepSize];
- }
-
- - 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];
- }
-
-
- - setStringList:anObject
- {
- if (anObject && [anObject respondsTo:@selector(stringAt:)] &&
- [anObject respondsTo:@selector(count)])
- {
- stringList = anObject;
-
- [cell setStringList:anObject];
- }
-
- return self;
- }
-
- - stringList
- {
- if ([cell stringList])
- {
- return [cell stringList];
- }
- else
- {
- return stringList;
- }
- }
-
- @end
-