home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1994 June / NEBULA_SE.ISO / SourceCode / MiscKit / Palettes / MiscThreeStateButton / MiscTriStateInspector.m < prev    next >
Encoding:
Text File  |  1994-01-06  |  1.7 KB  |  58 lines

  1. //
  2. //    MiscTriStateInspector.m -- inspector class for the three state button
  3. //        Written by Don Yacktman (c) 1993 by Don Yacktman.
  4. //                Version 1.0.  All rights reserved.
  5. //
  6. //        This notice may not be removed from this source code.
  7. //
  8. //        This is a free object!  Contact the author for the latest version.
  9. //        Don Yacktman, 4279 N. Ivy Lane, Provo, UT, 84604
  10. //        e-mail:  Don_Yacktman@byu.edu
  11. //
  12. //    This object is included in the MiscKit by permission from the author
  13. //    and its use is governed by the MiscKit license, found in the file
  14. //    "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  15. //    for a list of all applicable permissions and restrictions.
  16. //    
  17.  
  18. #import "MiscTriStateInspector.h"
  19. #import <appkit/appkit.h>
  20. #import "MiscThreeStateButton.subproj/MiscThreeStateButtonCell.h"
  21. #import "MiscThreeStateButton.subproj/MiscThreeStateButton.h"
  22.  
  23. @implementation MiscTriStateInspector
  24.  
  25. - init
  26. {
  27.     char buf[MAXPATHLEN + 1];
  28.     id bundle;
  29.     
  30.     [super init];
  31.     bundle = [NXBundle bundleForClass:[MiscThreeStateButton class]];
  32.     [bundle getPath:buf forResource:"TriStateInspector" ofType:"nib"];
  33.     [NXApp loadNibFile:buf owner:self withNames:NO fromZone:[self zone]];
  34.     return self;
  35. }
  36.  
  37. - (BOOL)wantsButtons { return YES; }
  38.  
  39. - revert:sender
  40. {
  41.     // Put string in text object
  42.     [thirdTitle setStringValue:[object thirdTitle]];
  43.     [thirdIcon setStringValue:[object thirdIcon]];
  44.     [cyclic setIntValue:[[object cell] isCyclic]];
  45.     return [super revert:sender];
  46. }
  47.  
  48. - ok:sender
  49. {
  50.     [object setThirdTitle:[thirdTitle stringValue]];
  51.     [object setThirdIcon:[thirdIcon stringValue]];
  52.     [object setType:([cyclic intValue] ?
  53.             MISC_CYCLIC_THREE_STATE : MISC_PLAIN_THREE_STATE)];
  54.     return [super ok:sender];
  55. }
  56.  
  57. @end
  58.