home *** CD-ROM | disk | FTP | other *** search
/ Nebula / nebula.bin / SourceCode / Palettes / CircularSliderPalette / CircularSliderInspector.m < prev    next >
Text File  |  1992-10-01  |  2KB  |  98 lines

  1. /*
  2.  *    Filename:    CircularSliderInspector.m 
  3.  *    Created :    Sat Aug 24 21:25:44 1991
  4.  *    Author  :    Vince DeMarco
  5.  *        <vince@whatnxt.cuc.ab.ca>
  6.  * 
  7.  *    Version 1.0.1
  8.  */
  9.  
  10.  
  11. /* Generated by Interface Builder */
  12.  
  13. #import "CircularSliderInspector.h"
  14. #import "CircularSlider.h"
  15. #import <appkit/Application.h>
  16. #import <appkit/TextFieldCell.h>
  17. #import <appkit/TextField.h>
  18. #import <appkit/Button.h>
  19.  
  20. #import <stdio.h>
  21.  
  22. @implementation CircularSliderInspector
  23.  
  24. - init
  25. {
  26.    char buf[MAXPATHLEN + 1];
  27.  
  28.     if (maxField == nil){
  29.     [super init];
  30.     
  31.    [[NXBundle bundleForClass:[CircularSlider class]] getPath:buf forResource:"CircularSliderInspector" ofType:"nib"];
  32.  
  33.    [NXApp loadNibFile:buf owner:self withNames:NO fromZone:[self zone]];
  34.  
  35.    }
  36.     [maxField setIntValue:(int)[object theMaxValue]];
  37.     [tagField setIntValue:[object tag]];
  38.  
  39.     [continuousButton setState:(currentcontinuous == 1 ? YES : NO)];
  40.     [disabledButton setState:(currentdisabled == 1 ? YES : NO)];
  41.     [maxField setIntValue:currentMax];
  42.     [tagField setIntValue:currentTag];
  43.     [currentField setIntValue:currentValue];
  44.     return self;
  45. }
  46.  
  47. - continuous:sender
  48. {
  49.     currentcontinuous = ([sender state] ? 1: 0);
  50.     return(self);
  51. }    
  52.  
  53. - disabled:sender
  54. {
  55.     currentdisabled = ([sender state] ? 1: 0);
  56.     return(self);
  57. }
  58.  
  59. - ok:sender
  60. {
  61.     currentMax   = [maxField intValue];
  62.     currentTag   = [tagField intValue];
  63.     currentValue = [currentField intValue];
  64.  
  65.     [object setContinuous: (currentcontinuous == 1 ? YES : NO)];
  66.     [object setTag: currentTag];
  67.  
  68.     [object setTheMaxValue:currentMax];
  69.     [object setIntValue:currentValue];
  70.     [object setEnabled:(currentdisabled == 0 ? YES : NO)];
  71.     return [super ok:sender];
  72. }
  73.  
  74. - revert:sender
  75.     currentTag   = [object tag];
  76.     currentMax   = (int)[object theMaxValue];
  77.     currentValue = [object intValue];
  78.  
  79.     [maxField setIntValue:currentMax];
  80.     [currentField setIntValue:currentValue];
  81.     [tagField setIntValue:currentTag];
  82.     [continuousButton setState:[object isContinuous]];
  83.     if ([object isContinuous])
  84.     currentcontinuous =1;
  85.     else
  86.     currentcontinuous =0;
  87.  
  88.     [disabledButton setState:([object isEnabled] ? NO: YES)];
  89.     if ([object isEnabled])
  90.     currentdisabled =0;
  91.     else
  92.     currentdisabled =1;
  93.  
  94.     return [super revert:sender];
  95. }
  96. @end
  97.