home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.mdf / SourceCode / MiscKit1.2.6 / Palettes / MiscValueFieldPalette / MiscValueField.subproj / MiscValueField.m < prev    next >
Encoding:
Text File  |  1994-02-21  |  3.0 KB  |  177 lines

  1. //
  2. //    MiscValueField.m -- a TextField subclass that specializes in using
  3. //                          the MiscValueCell.
  4. //       Written by David Fedchenko. Copyright 1994 by David Fedchenko.
  5. //                    Version 2.0  All rights reserved.
  6. //
  7. //        This notice may not be removed from this source code.
  8. //
  9. //    This object is included in the MiscKit by permission from the author
  10. //    and its use is governed by the MiscKit license, found in the file
  11. //    "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  12. //    for a list of all applicable permissions and restrictions.
  13. //    
  14.  
  15. #import "MiscValueField.h"
  16. #import "MiscValueCell.h"
  17.  
  18. @implementation MiscValueField
  19.  
  20. static id _idMiscValueCellClass;
  21.  
  22. + initialize
  23.     {
  24.     /* Class initialization code. */
  25.     if (self == [MiscValueField class])
  26.         {
  27.         _idMiscValueCellClass = [MiscValueCell class];  // Default class
  28.         }
  29.     
  30.     return self;
  31.     }
  32.  
  33. + setCellClass:classId
  34.     {
  35.     _idMiscValueCellClass = classId;
  36.     
  37.     return self;
  38.     }
  39.  
  40. - initFrame:(const NXRect *)frameRect
  41.     {
  42.     id oldCell;
  43.  
  44.     [super initFrame:frameRect];
  45.     oldCell = [self setCell:[[_idMiscValueCellClass alloc] initTextCell:"0"]];
  46.     [oldCell free];
  47.  
  48.     return self;
  49.     }
  50.  
  51. // the methods to communicate with the cell
  52. - setMinValue:(double)value
  53.     {
  54.     [cell setMinValue:value];
  55.  
  56.     return self;
  57.     }
  58.  
  59. - setMaxValue:(double)value
  60.     {
  61.     [cell setMaxValue:value];
  62.  
  63.     return self;
  64.     }
  65.  
  66. - setMinBoundary:(double)value
  67.     {
  68.     [cell setMinBoundary:value];
  69.  
  70.     return self;
  71.     }
  72.  
  73. - setMaxBoundary:(double)value
  74.     {
  75.     [cell setMaxBoundary:value];
  76.  
  77.     return self;
  78.     }
  79.  
  80. -(double) minValue
  81.     {
  82.     // there is casting here because the NeXT headers have a type conflict
  83.     // for these two methods.
  84.     return [(MiscValueCell *)cell minValue];
  85.     }
  86.  
  87. -(double) maxValue
  88.     {
  89.     return [(MiscValueCell *)cell maxValue];
  90.     }
  91.  
  92. -(double) minBoundary
  93.     {
  94.     return [cell minBoundary];
  95.     }
  96.  
  97. -(double) maxBoundary
  98.     {
  99.     return [cell maxBoundary];
  100.     }
  101.  
  102. - setStepSize:(double)size
  103.     {
  104.     [cell setStepSize:size];
  105.     
  106.     return self;
  107.     }
  108.  
  109. - setAltStepSize:(double)size
  110.     {
  111.     [cell setAltStepSize:size];
  112.     
  113.     return self;
  114.     }
  115.  
  116. -(double) stepSize
  117.     {
  118.     return [cell stepSize];
  119.     }
  120.  
  121. -(double) altStepSize
  122.     {
  123.     return [cell altStepSize];
  124.     }
  125.  
  126. - setExpandMin:(BOOL)flag
  127.     {
  128.     [cell setExpandMin:flag];
  129.     
  130.     return self;
  131.     }
  132.  
  133. - setExpandMax:(BOOL)flag
  134.     {
  135.     [cell setExpandMax:flag];
  136.     
  137.     return self;
  138.     }
  139.  
  140. -(BOOL) expandMin
  141.     {
  142.     return [cell expandMin];
  143.     }
  144.  
  145. -(BOOL) expandMax
  146.     {
  147.     return [cell expandMax];
  148.     }
  149.  
  150.  
  151. - setStringList:anObject
  152.     {
  153.     if (anObject && [anObject respondsTo:@selector(stringAt:)] &&
  154.         [anObject respondsTo:@selector(count)])
  155.         {
  156.     stringList = anObject;
  157.     
  158.     [cell setStringList:anObject];
  159.     }
  160.     
  161.     return self;
  162.     }
  163.  
  164. - stringList
  165.     {
  166.     if ([cell stringList])
  167.         {
  168.     return [cell stringList];
  169.     }
  170.     else
  171.         {
  172.     return stringList;
  173.     }
  174.     }
  175.  
  176. @end
  177.