1{%mainunit appkit.pas}
2{
3	NSButtonCell.h
4	Application Kit
5	Copyright (c) 1994-2005, Apple Computer, Inc.
6	All rights reserved.
7}
8
9{$ifdef HEADER}
10{$ifndef NSBUTTONCELL_PAS_H}
11{$define NSBUTTONCELL_PAS_H}
12
13{$include NSActionCell.inc}
14
15//@class NSAttributedString, NSFont, NSImage, NSSound;
16
17type
18  NSButtonType = (
19    NSMomentaryLightButton		= 0,	// was NSMomentaryPushButton
20    NSPushOnPushOffButton		= 1,
21    NSToggleButton			= 2,
22    NSSwitchButton			= 3,
23    NSRadioButton			= 4,
24    NSMomentaryChangeButton		= 5,
25    NSOnOffButton			= 6,
26    NSMomentaryPushInButton		= 7,	// was NSMomentaryLight
27
28    { These constants were accidentally reversed so that NSMomentaryPushButton lit and
29       NSMomentaryLight pushed. These names are now deprecated }
30
31    NSMomentaryPushButton		= 0{%H-},
32    NSMomentaryLight			= 7
33
34  );
35
36  NSBezelStyle = (
37
38    NSRoundedBezelStyle          = 1,
39    NSRegularSquareBezelStyle    = 2,
40    NSThickSquareBezelStyle      = 3,
41    NSThickerSquareBezelStyle    = 4,
42//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
43    NSDisclosureBezelStyle       = 5,
44//#endif
45    NSShadowlessSquareBezelStyle = 6,
46    NSCircularBezelStyle         = 7,
47//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
48    NSTexturedSquareBezelStyle   = 8,
49    NSHelpButtonBezelStyle       = 9,
50//#endif
51//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
52    NSSmallSquareBezelStyle       = 10,
53    NSTexturedRoundedBezelStyle   = 11,
54    NSRoundRectBezelStyle         = 12,
55    NSRecessedBezelStyle          = 13,
56    NSRoundedDisclosureBezelStyle = 14,
57//#endif
58
59    // this will be obsolete before GM
60
61    NSSmallIconButtonBezelStyle  = 2
62
63  {%H-});
64
65  _BCFlags = record
66{$ifdef __BIG_ENDIAN__}
67    unsigned int        pushIn:1;
68    unsigned int        changeContents:1;
69    unsigned int        changeBackground:1;
70    unsigned int        changeGray:1;
71    unsigned int        lightByContents:1;
72    unsigned int        lightByBackground:1;
73    unsigned int        lightByGray:1;
74    unsigned int        drawing:1;
75    unsigned int        bordered:1;
76    unsigned int        imageOverlaps:1;
77    unsigned int        horizontal:1;
78    unsigned int        bottomOrLeft:1;
79    unsigned int        imageAndText:1;
80    unsigned int        imageSizeDiff:1;
81    unsigned int        hasKeyEquivalentInsteadOfImage:1;
82    unsigned int        lastState:1;
83    unsigned int        transparent:1;
84    unsigned int        inset:2;
85    unsigned int        doesNotDimImage:1;
86    unsigned int        gradientType:3;
87    unsigned int        useButtonImageSource:1;
88    unsigned int        alternateMnemonicLocation:8;
89{$else}
90{    unsigned int        alternateMnemonicLocation:8;
91    unsigned int        useButtonImageSource:1;
92    unsigned int        gradientType:3;
93    unsigned int        doesNotDimImage:1;
94    unsigned int        inset:2;
95    unsigned int        transparent:1;
96    unsigned int        lastState:1;
97    unsigned int        hasKeyEquivalentInsteadOfImage:1;
98    unsigned int        imageSizeDiff:1;
99    unsigned int        imageAndText:1;
100    unsigned int        bottomOrLeft:1;
101    unsigned int        horizontal:1;
102    unsigned int        imageOverlaps:1;
103    unsigned int        bordered:1;
104    unsigned int        drawing:1;
105    unsigned int        lightByGray:1;
106    unsigned int        lightByBackground:1;
107    unsigned int        lightByContents:1;
108    unsigned int        changeGray:1;
109    unsigned int        changeBackground:1;
110    unsigned int        changeContents:1;
111    unsigned int        pushIn:1; }
112{$endif}
113  end;
114
115  _BCFlags2 = record
116{#ifdef __BIG_ENDIAN__
117    unsigned int	keyEquivalentModifierMask:24;
118    unsigned int	reserved:2;
119    unsigned int	bezelStyle2:1;
120    unsigned int	mouseInside:1;
121    unsigned int	showsBorderOnlyWhileMouseInside:1;
122    unsigned int	bezelStyle:3;
123#else
124    unsigned int	bezelStyle:3;
125    unsigned int	showsBorderOnlyWhileMouseInside:1;
126    unsigned int	mouseInside:1;
127    unsigned int	bezelStyle2:1;
128    unsigned int	reserved:2;
129    unsigned int	keyEquivalentModifierMask:24;
130#endif}
131  end;
132
133// NSGradientType :
134//
135// A concave gradient is darkest in the top left corner,
136// a convex gradient is darkest in the bottom right corner.
137//
138// Weak versus strong is how much contrast exists between
139// the colors used in opposite corners
140type
141  NSGradientType = (
142    NSGradientNone          = 0,
143    NSGradientConcaveWeak   = 1,
144    NSGradientConcaveStrong = 2,
145    NSGradientConvexWeak    = 3,
146    NSGradientConvexStrong  = 4
147  );
148
149{$endif}
150{$endif}
151{$ifdef CLASSES}
152{$ifndef NSBUTTONCELL_PAS_C}
153{$define NSBUTTONCELL_PAS_C}
154
155  NSButtonCell = class(NSActionCell)
156  public
157
158{- (NSString *)title;
159- (void)setTitle:(NSString *)aString;
160- (NSString *)alternateTitle;
161- (void)setAlternateTitle:(NSString *)aString;
162- (NSImage *)alternateImage;
163- (void)setAlternateImage:(NSImage *)image;
164- (NSCellImagePosition)imagePosition;
165- (void)setImagePosition:(NSCellImagePosition)aPosition;
166- (int)highlightsBy;
167- (void)setHighlightsBy:(int)aType;
168- (int)showsStateBy;
169- (void)setShowsStateBy:(int)aType;
170- (void)setButtonType:(NSButtonType)aType;
171- (BOOL)isOpaque;
172- (void)setFont:(NSFont *)fontObj;
173- (BOOL)isTransparent;
174- (void)setTransparent:(BOOL)flag;
175- (void)setPeriodicDelay:(float)delay interval:(float)interval;
176- (void)getPeriodicDelay:(float *)delay interval:(float *)interval;
177- (NSString *)keyEquivalent;
178- (void)setKeyEquivalent:(NSString *)aKeyEquivalent;
179- (unsigned int)keyEquivalentModifierMask;
180- (void)setKeyEquivalentModifierMask:(unsigned int)mask;
181- (NSFont *)keyEquivalentFont;
182- (void)setKeyEquivalentFont:(NSFont *)fontObj;
183- (void)setKeyEquivalentFont:(NSString *)fontName size:(float)fontSize;
184- (void)performClick:(id)sender; // Significant NSCell override, actually clicks itself.
185
186#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
187- (void)drawImage:(NSImage*)image withFrame:(NSRect)frame inView:(NSView*)controlView;
188- (NSRect)drawTitle:(NSAttributedString*)title withFrame:(NSRect)frame inView:(NSView*)controlView;
189- (void)drawBezelWithFrame:(NSRect)frame inView:(NSView*)controlView;
190#endif
191@end
192
193@interface NSButtonCell(NSKeyboardUI)
194- (void)setTitleWithMnemonic:(NSString *)stringWithAmpersand;
195- (void)setAlternateTitleWithMnemonic:(NSString *)stringWithAmpersand;
196- (void)setAlternateMnemonicLocation:(unsigned)location;
197- (unsigned)alternateMnemonicLocation;
198- (NSString *)alternateMnemonic;
199@end
200
201@interface NSButtonCell(NSButtonCellExtensions)
202- (NSGradientType)gradientType;
203- (void)setGradientType:(NSGradientType)type;
204
205// When disabled, the image and text of an NSButtonCell are normally dimmed with gray.
206// Radio buttons and switches use (imageDimsWhenDisabled == NO) so only their text is dimmed.
207- (void)setImageDimsWhenDisabled:(BOOL)flag;
208- (BOOL)imageDimsWhenDisabled;
209
210- (void) setShowsBorderOnlyWhileMouseInside:(BOOL)show;
211- (BOOL) showsBorderOnlyWhileMouseInside;
212
213- (void) mouseEntered:(NSEvent*)event;
214- (void) mouseExited:(NSEvent*)event;
215
216#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
217- (NSColor*)backgroundColor;
218- (void)setBackgroundColor:(NSColor*)color;
219#endif
220
221@end
222
223@interface NSButtonCell(NSButtonCellAttributedStringMethods)
224- (NSAttributedString *)attributedTitle;
225- (void)setAttributedTitle:(NSAttributedString *)obj;
226- (NSAttributedString *)attributedAlternateTitle;
227- (void)setAttributedAlternateTitle:(NSAttributedString *)obj;
228@end
229
230@interface NSButtonCell(NSButtonCellBezelStyles)
231
232- (void) setBezelStyle:(NSBezelStyle)bezelStyle;
233- (NSBezelStyle)bezelStyle;
234
235@end
236
237@interface NSButtonCell (NSButtonCellSoundExtensions)
238- (void)setSound:(NSSound *)aSound;
239- (NSSound *)sound;
240@end}
241
242  end;
243
244{$endif}
245{$endif}
246{$ifdef IMPLEMENTATION}
247
248{$endif}
249
250