home *** CD-ROM | disk | FTP | other *** search
/ Nebula / nebula.bin / SourceCode / Palettes / Clocks / Inspectors.subproj / DigitalClockInspector.m < prev    next >
Text File  |  1992-12-05  |  4KB  |  130 lines

  1. //----------------------------------------------------------------------------------------------------
  2. //
  3. //    DigitalClockInspector
  4. //
  5. //    Inherits From:        ClockInspector
  6. //
  7. //    Declared In:        DigitalClockInspector.h
  8. //
  9. //    Disclaimer
  10. //
  11. //        You may freely copy, distribute and reuse this software and its
  12. //        associated documentation. I disclaim any warranty of any kind, 
  13. //        expressed or implied, as to its fitness for any particular use.
  14. //
  15. //----------------------------------------------------------------------------------------------------
  16. #import "DigitalClockInspector.h"
  17. #import "DigitalClock.h"
  18.  
  19.  
  20. @implementation DigitalClockInspector
  21.  
  22. //----------------------------------------------------------------------------------------------------
  23. //    Private Methods
  24. //----------------------------------------------------------------------------------------------------
  25. + (const char*) _nib
  26. {
  27.     return "DigitalClockInspector";
  28. }
  29.  
  30.  
  31. - _validateOptions
  32. {
  33.     if ([[options findCellWithTag: 0] state])
  34.         {
  35.         [[options findCellWithTag:1] setEnabled: YES];
  36.         [[options findCellWithTag:4] setEnabled: YES];
  37.         [[options findCellWithTag:5] setEnabled: YES];
  38.         if ([[options findCellWithTag: 5] state])
  39.             {
  40.             [[options findCellWithTag:2] setEnabled: NO];
  41.             [[options findCellWithTag:3] setEnabled: NO];
  42.             }
  43.         else
  44.             {
  45.             [[options findCellWithTag:2] setEnabled: YES];
  46.             if ([[options findCellWithTag: 2] state])
  47.                 [[options findCellWithTag:3] setEnabled: YES];
  48.             else
  49.                 [[options findCellWithTag:3] setEnabled: NO];
  50.             }
  51.         }
  52.     else
  53.         {
  54.         [[options findCellWithTag:1] setEnabled: NO];
  55.         [[options findCellWithTag:2] setEnabled: NO];
  56.         [[options findCellWithTag:3] setEnabled: NO];
  57.         [[options findCellWithTag:4] setEnabled: NO];
  58.         [[options findCellWithTag:5] setEnabled: NO];
  59.         }
  60.  
  61.     return self;
  62. }
  63.     
  64.  
  65. //----------------------------------------------------------------------------------------------------
  66. //    Reverting Attributes
  67. //----------------------------------------------------------------------------------------------------
  68. - revertOptions
  69. {
  70.     [[options findCellWithTag:0] setState:[object isDisplayEnabled]];
  71.     [[options findCellWithTag:1] setState:[object wantsSeconds]];
  72.     [[options findCellWithTag: 2] setState:[object wantsDate]];
  73.     [[options findCellWithTag: 3] setState:[object wantsYear]];
  74.     [[options findCellWithTag: 4] setState:[object wantsMilitaryTime]];
  75.     [[options findCellWithTag: 5] setState:[object style]];
  76.     [[options findCellWithTag: 6] setState:[object isDraggable]];
  77.     [[options findCellWithTag: 7] setState:[object willAcceptDrop]];
  78.     [[options findCellWithTag: 8] setState:[object _timerMode]];
  79.     [[options findCellWithTag: 9] setState:[object activateOnAwake]];
  80.     [self _validateOptions];
  81.     return self;
  82. }
  83.  
  84.  
  85. - revertDisplay
  86. {
  87.     [colorOrImage selectCellWithTag: [object _backgroundIsColor]];
  88.     [backgroundImage image: [object backgroundImage]];
  89.     [backgroundColor setColor: [object backgroundColor]];
  90.     [timecolor setColor: [object timeColor]];
  91.     [datecolor setColor: [object dateColor]];
  92.     return self;
  93. }
  94.     
  95.  
  96. //----------------------------------------------------------------------------------------------------
  97. //    Setting Attributes
  98. //----------------------------------------------------------------------------------------------------
  99. - setClockOptions: sender
  100. {
  101.     [object setDisplayEnabled: [[options findCellWithTag:0] state]];
  102.     [object wantsSeconds: [[options findCellWithTag:1] state]];
  103.     [object wantsDate: [[options findCellWithTag:2] state]];
  104.     [object wantsYear: [[options findCellWithTag:3] state]];
  105.     [object wantsMilitaryTime: [[options findCellWithTag:4] state]];
  106.     [object style: [[options findCellWithTag:5] state]];
  107.     [object isDraggable: [[options findCellWithTag:6] state]];
  108.     [object willAcceptDrop: [[options findCellWithTag:7] state]];
  109.     [object _timerMode: [[options findCellWithTag:8] state]];
  110.     [object activateOnAwake: [[options findCellWithTag:9] state]];
  111.     [self _validateOptions];
  112.     return [self ok:nil];
  113. }
  114.  
  115.  
  116. - setTimeColor: sender
  117. {
  118.     [object timeColor: [sender color]];
  119.     return [self ok:nil];
  120. }
  121.     
  122.  
  123. - setDateColor: sender
  124. {
  125.     [object dateColor: [sender color]];
  126.     return [self ok:nil];
  127. }
  128.     
  129.     
  130. @end