home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / DEV.Z / NSButtonCell.h < prev    next >
Text File  |  1996-09-09  |  6KB  |  170 lines

  1. /*
  2.     NSButtonCell.h
  3.     Application Kit
  4.     Copyright (c) 1994-1996, NeXT Software, Inc.
  5.     All rights reserved.
  6. */
  7.  
  8. #import <AppKit/NSActionCell.h>
  9.  
  10. @class NSImage;
  11. @class NSFont;
  12. @class NSAttributedString;
  13.  
  14. typedef enum _NSButtonType {
  15.     NSMomentaryPushButton        = 0,
  16.     NSPushOnPushOffButton        = 1,
  17.     NSToggleButton            = 2,
  18.     NSSwitchButton            = 3,
  19.     NSRadioButton            = 4,
  20.     NSMomentaryChangeButton        = 5,
  21.     NSOnOffButton            = 6,
  22.     NSMomentaryLight            = 7
  23. } NSButtonType;
  24.  
  25. typedef struct __BCFlags {
  26. #ifdef __BIG_ENDIAN__
  27.     unsigned int        pushIn:1;
  28.     unsigned int        changeContents:1;
  29.     unsigned int        changeBackground:1;
  30.     unsigned int        changeGray:1;
  31.     unsigned int        lightByContents:1;
  32.     unsigned int        lightByBackground:1;
  33.     unsigned int        lightByGray:1;
  34.     unsigned int        hasAlpha:1;
  35.     unsigned int        bordered:1;
  36.     unsigned int        imageOverlaps:1;
  37.     unsigned int        horizontal:1;
  38.     unsigned int        bottomOrLeft:1;
  39.     unsigned int        imageAndText:1;
  40.     unsigned int        imageSizeDiff:1;
  41.     unsigned int        hasKeyEquivalentInsteadOfImage:1;
  42.     unsigned int        lastState:1;
  43.     unsigned int        transparent:1;
  44.     unsigned int        inset:2;
  45.     unsigned int        doesNotDimImage:1;
  46.     unsigned int        gradientType:3;
  47.     unsigned int        reserved1:1;
  48.     unsigned int        alternateMnemonicLocation:8;
  49. #else
  50.     unsigned int        alternateMnemonicLocation:8;
  51.     unsigned int        reserved1:1;
  52.     unsigned int        gradientType:3;
  53.     unsigned int        doesNotDimImage:1;
  54.     unsigned int        inset:2;
  55.     unsigned int        transparent:1;
  56.     unsigned int        lastState:1;
  57.     unsigned int        hasKeyEquivalentInsteadOfImage:1;
  58.     unsigned int        imageSizeDiff:1;
  59.     unsigned int        imageAndText:1;
  60.     unsigned int        bottomOrLeft:1;
  61.     unsigned int        horizontal:1;
  62.     unsigned int        imageOverlaps:1;
  63.     unsigned int        bordered:1;
  64.     unsigned int        hasAlpha:1;
  65.     unsigned int        lightByGray:1;
  66.     unsigned int        lightByBackground:1;
  67.     unsigned int        lightByContents:1;
  68.     unsigned int        changeGray:1;
  69.     unsigned int        changeBackground:1;
  70.     unsigned int        changeContents:1;
  71.     unsigned int        pushIn:1;
  72. #endif
  73. } _BCFlags;
  74.  
  75.  
  76. @interface NSButtonCell : NSActionCell
  77. {
  78.     NSString           *_altContents;
  79.     id            _sound;
  80.     NSString           *_keyEquivalent;
  81.     unsigned int    _keyEquivalentModifierMask;
  82.     unsigned short    _periodicDelay;
  83.     unsigned short    _periodicInterval;
  84.     _BCFlags            _bcFlags;
  85.     NSImage            *_normalImage;
  86.     id                  _alternateImageOrKeyEquivalentFont;
  87. }
  88.  
  89.  
  90. - (NSString *)title;
  91. - (void)setTitle:(NSString *)aString;
  92. - (NSString *)alternateTitle;
  93. - (void)setAlternateTitle:(NSString *)aString;
  94. #ifndef STRICT_OPENSTEP
  95. - (id)alternateObjectValue;
  96. - (void)setAlternateObjectValue:(id)obj;
  97. - (BOOL)hasValidAlternateObjectValue;
  98. #endif STRICT_OPENSTEP
  99. - (NSImage *)alternateImage;
  100. - (void)setAlternateImage:(NSImage *)image;
  101. - (NSCellImagePosition)imagePosition;
  102. - (void)setImagePosition:(NSCellImagePosition)aPosition;
  103. - (int)highlightsBy;
  104. - (void)setHighlightsBy:(int)aType;
  105. - (int)showsStateBy;
  106. - (void)setShowsStateBy:(int)aType;
  107. - (void)setButtonType:(NSButtonType)aType;
  108. - (BOOL)isOpaque;
  109. - (void)setFont:(NSFont *)fontObj;
  110. - (BOOL)isTransparent;
  111. - (void)setTransparent:(BOOL)flag;
  112. - (void)setPeriodicDelay:(float)delay interval:(float)interval;
  113. - (void)getPeriodicDelay:(float *)delay interval:(float *)interval;
  114. - (NSString *)keyEquivalent;
  115. - (void)setKeyEquivalent:(NSString *)aKeyEquivalent;
  116. - (unsigned int)keyEquivalentModifierMask;
  117. - (void)setKeyEquivalentModifierMask:(unsigned int)mask;
  118. - (NSFont *)keyEquivalentFont;
  119. - (void)setKeyEquivalentFont:(NSFont *)fontObj;
  120. - (void)setKeyEquivalentFont:(NSString *)fontName size:(float)fontSize;
  121. - (void)performClick:(id)sender; // Significant NSCell override, actually clicks itself.
  122.  
  123. @end
  124.  
  125. #ifndef STRICT_OPENSTEP
  126. @interface NSButtonCell(NSKeyboardUI)
  127. - (void)setTitleWithMnemonic:(NSString *)stringWithAmpersand;
  128. - (void)setAlternateTitleWithMnemonic:(NSString *)stringWithAmpersand;
  129. - (void)setAlternateMnemonicLocation:(unsigned)location;
  130. - (unsigned)alternateMnemonicLocation;
  131. - (NSString *)alternateMnemonic;
  132. @end
  133. #endif
  134.  
  135. #ifndef STRICT_OPENSTEP
  136.  
  137. // NSGradientType :
  138. //
  139. // A concave gradient is darkest in the top left corner, 
  140. // a convex gradient is darkest in the bottom right corner.
  141. //
  142. // Weak versus strong is how much contrast exists between
  143. // the colors used in opposite corners
  144. typedef enum _NSGradientType {
  145.     NSGradientNone          = 0,
  146.     NSGradientConcaveWeak   = 1,
  147.     NSGradientConcaveStrong = 2,
  148.     NSGradientConvexWeak    = 3,
  149.     NSGradientConvexStrong  = 4
  150. } NSGradientType;
  151.  
  152. @interface NSButtonCell(NSButtonCellExtensions)
  153. - (NSGradientType)gradientType;
  154. - (void)setGradientType:(NSGradientType)type;
  155.  
  156. // When disabled, the image and text of an NSButtonCell are normally dimmed with gray.
  157. // Radio buttons and switches use (imageDimsWhenDisabled == NO) so only their text is dimmed.
  158. - (void)setImageDimsWhenDisabled:(BOOL)flag;
  159. - (BOOL)imageDimsWhenDisabled;
  160. @end
  161.  
  162. @interface NSButtonCell(NSButtonCellAttributedStringMethods)
  163. - (NSAttributedString *)attributedTitle;
  164. - (void)setAttributedTitle:(NSAttributedString *)obj;
  165. - (NSAttributedString *)attributedAlternateTitle;
  166. - (void)setAttributedAlternateTitle:(NSAttributedString *)obj;
  167. @end
  168.  
  169. #endif
  170.