home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.mdf / SourceCode / MiscKit1.2.6 / Palettes / MiscCalendarPalette / MiscCalendarViewInspector.m < prev    next >
Encoding:
Text File  |  1994-05-12  |  2.6 KB  |  114 lines

  1. #import <appkit/NXColorWell.h>
  2. #import <appkit/Matrix.h>
  3.  
  4. #import "MiscCalendarView.subproj/MiscCalendarView.h"
  5. #import "MiscCalendarView.subproj/MiscCalendarViewConstants.h"
  6.  
  7. #import "MiscCalendarViewInspector.h"
  8.  
  9.  
  10. @interface MiscCalendarViewInspector (Private)
  11.  
  12. - cellColorMatrix;
  13.  
  14. @end
  15.  
  16. @implementation MiscCalendarViewInspector
  17.  
  18.  
  19. - init
  20. {
  21.     char     buf[MAXPATHLEN + 1];
  22.     id         bundle;
  23.  
  24.     [super init];
  25.     
  26.     bundle = [NXBundle bundleForClass:[MiscCalendarView class]];
  27.  
  28.     [bundle getPath:buf forResource:"MiscCalendarViewInspector" ofType:"nib"];
  29.  
  30.     [NXApp loadNibFile:buf owner:self withNames:NO fromZone:[self zone]];
  31.  
  32.     return self;
  33. }
  34.  
  35. - ok:sender
  36. {
  37.     BOOL    display;
  38.     id        date;
  39.  
  40.     if (sender == titleSwitchesMatrix)
  41.     {
  42.     display = [[sender selectedCell] state] ? YES : NO;
  43.  
  44.     [object forHeader:[[sender selectedCell] tag] display:display];
  45.     }
  46.  
  47.     else if (sender == setDateButton)
  48.     {
  49.     date = [calendar dateDelegate];
  50.  
  51.     [[object dateDelegate] setYear:[date year] month:[date month]
  52.      day:[date day]];
  53.  
  54.     [object displayDate:self];
  55.     }
  56.     else if (sender == matrixModeRadioMatrix)
  57.       [object setHighlightMode:[[sender selectedCell] tag]];
  58.  
  59.     else if (sender == matrixCellsColorWell)
  60.       [object setColorOf:[[cellColorRadioMatrix selectedCell] tag]
  61.        to:[sender color]];
  62.  
  63.     else if (sender == cellColorRadioMatrix)
  64.       [matrixCellsColorWell 
  65.        setColor:[object colorOf:[[cellColorRadioMatrix selectedCell] tag]]];
  66.  
  67.     return [super ok:sender];
  68. }
  69.  
  70. - revert:sender
  71. {
  72.     id    date;
  73.  
  74.     [matrixModeRadioMatrix selectCellWithTag:[object highlightMode]];
  75.  
  76.     date = [object dateDelegate];
  77.  
  78.     [[calendar dateDelegate] setYear:[date year] month:[date month]
  79.      day:[date day]];
  80.  
  81.     [calendar displayDate:self];
  82.     [calendar updateDate:self];
  83.  
  84.     [[titleSwitchesMatrix findCellWithTag:MISC_CV_DOWHEADER] 
  85.      setIntValue:[object isHeaderDisplayed:MISC_CV_DOWHEADER]];
  86.     [[titleSwitchesMatrix findCellWithTag:MISC_CV_MONTHHEADER]
  87.      setIntValue:[object isHeaderDisplayed:MISC_CV_MONTHHEADER]];
  88.     [[titleSwitchesMatrix findCellWithTag:MISC_CV_YEARHEADER] 
  89.      setIntValue:[object isHeaderDisplayed:MISC_CV_YEARHEADER]];
  90.     [[titleSwitchesMatrix findCellWithTag:MISC_CV_MONTHANDYEARHEADER] 
  91.      setIntValue:[object isHeaderDisplayed:MISC_CV_MONTHANDYEARHEADER]];
  92.  
  93.     [matrixCellsColorWell 
  94.      setColor:[object colorOf:[[cellColorRadioMatrix selectedCell] tag]]];
  95.  
  96.     return [super revert:sender];
  97. }
  98.  
  99. - (BOOL)wantsButtons
  100. {
  101.     return NO;
  102. }
  103.  
  104. @end
  105.  
  106. @implementation MiscCalendarViewInspector (Private)
  107.  
  108. - cellColorMatrix
  109. {
  110.     return cellColorRadioMatrix;
  111. }
  112.  
  113. @end
  114.