home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1994 June / NEBULA_SE.ISO / SourceCode / MiscKit / Palettes / MiscDragViews / MiscDVInspector.m < prev    next >
Encoding:
Text File  |  1994-02-18  |  2.4 KB  |  113 lines

  1. /***************************************************************************
  2.  * CLASS:        MiscDVInspector (MiscDragViewInspector)
  3.  * 
  4.  *    See the header file for more info about this class.
  5.  ***************************************************************************/
  6.  
  7. #import "MiscViews.subproj/MiscIconWell.h"
  8. #import "MiscDVInspector.h"
  9.  
  10.  
  11. @implementation MiscDVInspector
  12.  
  13. // Load the Inspector.
  14.  
  15. - init
  16. {
  17.     char buf[MAXPATHLEN + 1];
  18.     id bundle;
  19.     
  20.     [super init];
  21.     
  22.     bundle = [NXBundle bundleForClass:[MiscDragView class]];
  23.  
  24.     [bundle getPath: buf forResource: "MiscDVInspector" ofType:"nib"];
  25.  
  26.     [NXApp loadNibFile:buf owner:self withNames:NO fromZone:[self zone]];
  27.            
  28.     return self;
  29. }
  30.  
  31.  
  32.  
  33. // This is called to set the options located on the inspector to
  34. // be the same as the current selected object.
  35.  
  36. - revert: sender
  37. {    
  38.     // set all the radio buttons for dragging options
  39.     
  40.     [ [optionMatrix cellAt: 0 :0] setState:[object allowSourceDragging] ];    
  41.        [ [optionMatrix cellAt: 1 :0] setState:[object allowDestinationDragging] ];    
  42.       [ [optionMatrix cellAt: 2 : 0] setState: [object acceptForeignDrag] ];
  43.     [ [optionMatrix cellAt: 3 : 0] setState: [object acceptLocalDrag] ];    
  44.     [ [optionMatrix cellAt: 4 : 0] setState: [object acceptSelfDrag] ];        
  45.     [ [optionMatrix cellAt: 5 : 0] setState: [object retainData] ];    
  46.     
  47.     [optionMatrix display];    // get matrix to redisplay values
  48.     
  49.     // set the border type
  50.     
  51.     [borderMatrix selectCellWithTag: [object borderType] ];
  52.     
  53.     [borderMatrix display];
  54.         
  55.     return [super revert:sender];
  56. }
  57.  
  58.  
  59.  
  60. // This method is called when one of the buttons in the inspector
  61. // is clicked. The object is then notified of the change so that
  62. // it can change it's state.
  63.  
  64. - optionsChanged: sender
  65. {
  66.   BOOL  state = [ [sender selectedCell] state];
  67.   
  68.       switch ([ [sender selectedCell] tag])
  69.     {
  70.       case 0:                    
  71.           [object setAllowSourceDragging: state];
  72.         break;
  73.       case 1:                     
  74.           [object setAllowDestinationDragging: state];
  75.         break;
  76.       case 2:
  77.           [object setAcceptForeignDrag: state];
  78.         break;
  79.       case 3:
  80.           [object setAcceptLocalDrag: state];
  81.         break;
  82.       case 4:
  83.           [object setAcceptSelfDrag: state];
  84.         break;
  85.       case 5:
  86.           [object setRetainData: state];
  87.      }
  88.      
  89.     return [super ok: sender];
  90. }
  91.  
  92.  
  93.  
  94. - borderChanged: sender
  95. {
  96.     [object setBorderType: [ [borderMatrix selectedCell] tag] ];
  97.     
  98.     return [super ok: sender];
  99. }
  100.  
  101.  
  102.  
  103. // Determines whether the inspector panel will have an "OK" and
  104. // "Revert" button. 
  105.  
  106. - (BOOL)wantsButtons
  107. {
  108.     return NO;
  109. }
  110.  
  111.  
  112. @end
  113.