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

  1. //
  2. //    MiscThreeStateButton.m -- three state button class
  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 "MiscThreeStateButton.h"
  19. #import "MiscThreeStateButtonCell.h"
  20. #import <apps/InterfaceBuilder.h>
  21.  
  22. static id threeStateCellClass = nil;
  23.  
  24. @implementation MiscThreeStateButton
  25.  
  26. + initialize
  27. { // need to set up to use our new cell subclass
  28.     if (self == [MiscThreeStateButton class]) {
  29.         threeStateCellClass = [MiscThreeStateButtonCell class];
  30.     }
  31.     return [super initialize];
  32. }
  33.  
  34. + setCellClass:classId
  35. {
  36.     threeStateCellClass = classId;
  37.     return self;
  38. }
  39.  
  40. - initFrame:(const NXRect *)frameRect
  41. {
  42.     id oldCell;
  43.     [super initFrame:frameRect];
  44.     oldCell = [self setCell:[[threeStateCellClass alloc] init]];
  45.     [oldCell free];
  46.     doSuper = NO;
  47.     return self;
  48. }
  49.  
  50. // These all just forward to the cell for it to deal with...
  51. - (const char *)thirdTitle { return [cell thirdTitle]; } 
  52. - setThirdTitle:(const char *)aString { return [cell setThirdTitle:aString]; }
  53. - (const char *)thirdIcon { return [cell thirdIcon]; }
  54. - setThirdIcon:(const char *)iconName { return [cell setThirdIcon:iconName]; }
  55. - thirdImage { return [cell thirdImage]; }
  56. - setThirdImage:image { return [cell setThirdImage:image]; }
  57. - setType:(int)aType { return [cell setType:aType]; }
  58. - (int)state { return [cell intValue]; }
  59. - setState:(int)value { return [cell setIntValue:value]; }
  60. - performAltClick:sender { return [cell performAltClick:sender]; }
  61.  
  62. - (const char *)getInspectorClassName
  63. {    // alt-click to bring up the button class inspector instead...
  64.     NXEvent *ev = [NXApp currentEvent];
  65.     if (ev->flags & NX_ALTERNATEMASK) return [super getInspectorClassName];
  66.     else return "MiscTriStateInspector";
  67. }
  68.  
  69.  
  70. @end
  71.