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

  1. //
  2. //    MiscSliderField.m -- a TextField subclass that specializes in using
  3. //                           the MiscSliderCell.
  4. //       Written by David Fedchenko. Copyright 1994 by David Fedchenko.
  5. //                    Version 1.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 "MiscSliderField.h"
  16. #import "MiscSliderCell.h"
  17.  
  18. @implementation MiscSliderField
  19.  
  20. static id _idMiscSliderCellClass;
  21.  
  22. + initialize
  23.     {
  24.     /* Class initialization code. */
  25.     if (self == [MiscSliderField class])
  26.         {
  27.         _idMiscSliderCellClass = [MiscSliderCell class];  // Default class
  28.         }
  29.     
  30.     return self;
  31.     }
  32.  
  33. + setCellClass:classId
  34.     {
  35.     _idMiscSliderCellClass = 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:[[_idMiscSliderCellClass 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.     return [(MiscSliderCell *)cell minValue];
  83.     }
  84.  
  85. -(double) maxValue
  86.     {
  87.     return [(MiscSliderCell *)cell maxValue];
  88.     }
  89.  
  90. -(double) minBoundary
  91.     {
  92.     return [cell minBoundary];
  93.     }
  94.  
  95. -(double) maxBoundary
  96.     {
  97.     return [cell maxBoundary];
  98.     }
  99.  
  100. - setExpandMin:(BOOL)flag
  101.     {
  102.     [cell setExpandMin:flag];
  103.     
  104.     return self;
  105.     }
  106.  
  107. - setExpandMax:(BOOL)flag
  108.     {
  109.     [cell setExpandMax:flag];
  110.     
  111.     return self;
  112.     }
  113.  
  114. -(BOOL) expandMin
  115.     {
  116.     return [cell expandMin];
  117.     }
  118.  
  119. -(BOOL) expandMax
  120.     {
  121.     return [cell expandMax];
  122.     }
  123.  
  124. - setPosition:(int)where
  125.     {
  126.     [cell setPosition:where];
  127.     
  128.     return self;
  129.     }
  130.  
  131. - setSplit:(int)percent
  132.     {
  133.     [cell setSplit:percent];
  134.     
  135.     return self;
  136.     }
  137.  
  138. - setIntegerOnly:(BOOL)flag
  139.     {
  140.     [cell setIntegerOnly:flag];
  141.     
  142.     return self;
  143.     }
  144.  
  145. -(int) position
  146.     {
  147.     return [cell position];
  148.     }
  149.  
  150. -(int) split
  151.     {
  152.     return [cell split];
  153.     }
  154.  
  155. -(BOOL) integerOnly
  156.     {
  157.     return [cell integerOnly];
  158.     }
  159.  
  160.  
  161. - setStringList:anObject
  162.     {
  163.     stringList = anObject;
  164.     
  165.     [cell setStringList:anObject];
  166.     
  167.     return self;
  168.     }
  169.  
  170. - stringList
  171.     {
  172.     if ([cell stringList])
  173.         {
  174.     return [cell stringList];
  175.     }
  176.     else
  177.         {
  178.     return stringList;
  179.     }
  180.     }
  181.  
  182. @end
  183.