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

  1. //
  2. //    MiscThreeStateButtonCell.h -- cell 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 <appkit/appkit.h>
  19.  
  20. // The three state button...
  21.  
  22. // the values of these are arbitrary and chosen to avoid conflict
  23. // with the NeXT #defines in ButtonCell.h...  use them with -setType:
  24. #define MISC_CYCLIC_THREE_STATE    100    // cycles through three states
  25. #define MISC_PLAIN_THREE_STATE    101    // alt click for third state
  26.  
  27. @interface MiscThreeStateButtonCell:ButtonCell
  28. {
  29.     char *thirdTitle;    // title for the third state
  30.     id _thirdImage;        // image for the third state
  31.     char *trueAltTitle;    // title for the third state
  32.     id _trueAltImage;    // image for the third state
  33.     BOOL isCyclic;        // if not, ALT click gives third state.
  34.     BOOL thirdState;    // if we're in the third state.
  35. }
  36.  
  37. // the basics
  38. - init;
  39. - copyFromZone:(NXZone *)zone;
  40. - free;
  41.  
  42. // override to set the "true" instance variables...
  43. - (const char *)altTitle;
  44. - setAltTitle:(const char *)aString;
  45. - (const char *)altIcon;
  46. - setAltIcon:(const char *)iconName;
  47. - altImage;
  48. - setAltImage:image;
  49.  
  50. // setting and getting the third image/title
  51. - (const char *)thirdTitle;
  52. - setThirdTitle:(const char *)aString;
  53. - (const char *)thirdIcon;
  54. - setThirdIcon:(const char *)iconName;
  55. - thirdImage;
  56. - setThirdImage:image;
  57. - setType:(int)aType;
  58. - (BOOL)isCyclic;
  59.  
  60. // Need to override these to provide for the third state
  61. - (const char *)stringValue;
  62. - setStringValue:(const char *)aString;
  63. - setStringValueNoCopy:(const char *)aString;
  64. - (int)intValue;
  65. - setIntValue:(int)anInt;
  66. - (float)floatValue;
  67. - setFloatValue:(float)aFloat;
  68. - (double)doubleValue;
  69. - setDoubleValue:(double)aDouble;
  70.  
  71. // these override the drawing to deal with the extra
  72. // image/icon and title
  73. - getDrawRect:(NXRect *)theRect;
  74. - getTitleRect:(NXRect *)theRect;
  75. - getIconRect:(NXRect *)theRect;
  76. - calcCellSize:(NXSize *)theSize inRect:(const NXRect *)aRect;
  77. - drawInside:(const NXRect *)aRect inView:controlView;
  78. - highlight:(const NXRect *)cellFrame inView:controlView lit:(BOOL)flag;
  79. - (BOOL)trackMouse:(NXEvent *)theEvent inRect:(const NXRect *)cellFrame
  80.         ofView:controlView;
  81. - performClick:sender;
  82. - performAltClick:sender;
  83. - write:(NXTypedStream *)stream;
  84. - read:(NXTypedStream *)stream;
  85.  
  86. - replaceAltTitle:(const char *)aString;
  87. - replaceTitle:(const char *)aString;
  88.  
  89. @end
  90.