1{%mainunit appkit.pas}
2{
3	NSCell.h
4	Application Kit
5	Copyright (c) 1994-2005, Apple Computer, Inc.
6	All rights reserved.
7}
8
9{$ifdef HEADER}
10{$ifndef NSCELL_PAS_H}
11{$define NSCELL_PAS_H}
12
13{#import <AppKit/NSText.h>
14#import <AppKit/NSParagraphStyle.h>
15
16@class NSAttributedString, NSEvent, NSFont, NSFormatter, NSImage, NSMenu, NSText, NSView;}
17
18const
19    NSAnyType				= 0;
20    NSIntType				= 1;
21    NSPositiveIntType			= 2;
22    NSFloatType				= 3;
23    NSPositiveFloatType			= 4;
24    NSDoubleType			= 6;
25    NSPositiveDoubleType		= 7;
26
27type
28  NSCellType = (
29    NSNullCellType			= 0,
30    NSTextCellType			= 1,
31    NSImageCellType			= 2
32  );
33
34  NSCellAttribute = (
35    NSCellDisabled			= 0,
36    NSCellState				= 1,
37    NSPushInCell			= 2,
38    NSCellEditable			= 3,
39    NSChangeGrayCell			= 4,
40    NSCellHighlighted			= 5,
41    NSCellLightsByContents		= 6,
42    NSCellLightsByGray			= 7,
43    NSChangeBackgroundCell		= 8,
44    NSCellLightsByBackground		= 9,
45    NSCellIsBordered			= 10,
46    NSCellHasOverlappingImage		= 11,
47    NSCellHasImageHorizontal		= 12,
48    NSCellHasImageOnLeftOrBottom	= 13,
49    NSCellChangesContents		= 14,
50    NSCellIsInsetButton			= 15,
51    NSCellAllowsMixedState		= 16
52  );
53
54  NSCellImagePosition = (
55    NSNoImage				= 0,
56    NSImageOnly				= 1,
57    NSImageLeft				= 2,
58    NSImageRight			= 3,
59    NSImageBelow			= 4,
60    NSImageAbove			= 5,
61    NSImageOverlaps			= 6
62  );
63
64  NSCellStateValue = (
65    NSMixedState = -1,
66    NSOffState   =  0,
67    NSOnState    =  1
68  );
69
70{ ButtonCell highlightsBy and showsStateBy mask }
71
72const
73    NSNoCellMask			= 0;
74    NSContentsCellMask			= 1;
75    NSPushInCellMask			= 2;
76    NSChangeGrayCellMask		= 4;
77    NSChangeBackgroundCellMask		= 8;
78
79
80type
81  NSControlTint = (
82    NSDefaultControlTint  = 0,	// system 'default'
83//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
84    NSBlueControlTint     = 1,
85    NSGraphiteControlTint = 6,
86//#endif
87    NSClearControlTint    = 7
88  );
89
90  NSControlSize = (
91    NSRegularControlSize,
92    NSSmallControlSize
93//#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
94    , NSMiniControlSize
95//#endif
96  );
97
98  _CFlags = record
99{    unsigned int        state:1;
100    unsigned int        highlighted:1;
101    unsigned int        disabled:1;
102    unsigned int        editable:1;
103    NSCellType          type:2;
104    unsigned int        vCentered:1;
105    unsigned int        hCentered:1;
106    unsigned int        bordered:1;
107    unsigned int        bezeled:1;
108    unsigned int        selectable:1;
109    unsigned int        scrollable:1;
110    unsigned int        continuous:1;
111    unsigned int        actOnMouseDown:1;
112    unsigned int        isLeaf:1;
113    unsigned int        invalidObjectValue:1;
114    unsigned int        invalidFont:1;
115    NSLineBreakMode     lineBreakMode:3;
116    unsigned int        reserved1:3;
117    unsigned int        actOnMouseDragged:1;
118    unsigned int        isLoaded:1;
119    unsigned int        reserved2:1;
120    unsigned int        dontActOnMouseUp:1;
121    unsigned int        isWhite:1;
122    unsigned int        useUserKeyEquivalent:1;
123    unsigned int        showsFirstResponder:1;
124    unsigned int	focusRingType:2;
125    unsigned int        wasSelectable:1;
126    unsigned int        hasInvalidObject:1;
127    unsigned int        allowsEditingTextAttributes:1;
128    unsigned int        importsGraphics:1;
129    NSTextAlignment     alignment:3;
130    unsigned int        retainCountOverMax:1;
131    unsigned int        retainCount:7;
132    unsigned int        refusesFirstResponder:1;
133    unsigned int        needsHighlightedText:1;
134    unsigned int        dontAllowsUndo:1;
135    unsigned int        currentlyEditing:1;
136    unsigned int	allowsMixedState:1;
137    unsigned int	inMixedState:1;
138    unsigned int        sendsActionOnEndEditing:1;
139    unsigned int	inSendAction:1;
140    unsigned int	menuWasSet:1;
141    unsigned int        controlTint:3;
142    unsigned int        controlSize:2;
143    unsigned int	branchImageDisabled:1;
144    unsigned int	drawingInRevealover:1;
145    unsigned int        needsHighlightedTextHint:1;}
146  end;
147
148
149{$endif}
150{$endif}
151{$ifdef CLASSES}
152{$ifndef NSCELL_PAS_C}
153{$define NSCELL_PAS_C}
154
155  NSCell = class(NSObject) //<NSCopying, NSCoding>
156
157{+ (BOOL)prefersTrackingUntilMouseUp;
158
159
160- (id)initTextCell:(NSString *)aString;
161- (id)initImageCell:(NSImage *)image;
162
163- (NSView *)controlView;
164#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
165- (void)setControlView:(NSView*)view;
166#endif
167- (NSCellType)type;
168- (void)setType:(NSCellType)aType;
169- (int)state;
170- (void)setState:(int)value;
171- (id)target;
172- (void)setTarget:(id)anObject;
173- (SEL)action;
174- (void)setAction:(SEL)aSelector;
175- (int)tag;
176- (void)setTag:(int)anInt;
177- (NSString*)title;
178- (void)setTitle:(NSString*)aString;
179- (BOOL)isOpaque;
180- (BOOL)isEnabled;
181- (void)setEnabled:(BOOL)flag;
182- (int)sendActionOn:(int)mask;
183- (BOOL)isContinuous;
184- (void)setContinuous:(BOOL)flag;
185- (BOOL)isEditable;
186- (void)setEditable:(BOOL)flag;
187- (BOOL)isSelectable;
188- (void)setSelectable:(BOOL)flag;
189- (BOOL)isBordered;
190- (void)setBordered:(BOOL)flag;
191- (BOOL)isBezeled;
192- (void)setBezeled:(BOOL)flag;
193- (BOOL)isScrollable;
194- (void)setScrollable:(BOOL)flag;	/* If YES, sets wraps to NO */
195- (BOOL)isHighlighted;
196- (void)setHighlighted:(BOOL)flag;
197- (NSTextAlignment)alignment;
198- (void)setAlignment:(NSTextAlignment)mode;
199- (BOOL)wraps;
200- (void)setWraps:(BOOL)flag;	/* If YES, sets scrollable to NO */
201- (NSFont *)font;
202- (void)setFont:(NSFont *)fontObj;
203- (int)entryType;
204- (void)setEntryType:(int)aType;
205- (BOOL)isEntryAcceptable:(NSString *)aString;
206- (void)setFloatingPointFormat:(BOOL)autoRange left:(unsigned)leftDigits right:(unsigned)rightDigits;
207- (NSString *)keyEquivalent;
208- (void)setFormatter:(NSFormatter *)newFormatter;
209- (id)formatter;
210- (id)objectValue;
211- (void)setObjectValue:(id <NSCopying>)obj;
212- (BOOL)hasValidObjectValue;
213- (NSString *)stringValue;
214- (void)setStringValue:(NSString *)aString;
215- (NSComparisonResult)compare:(id)otherCell;
216- (int)intValue;
217- (void)setIntValue:(int)anInt;
218- (float)floatValue;
219- (void)setFloatValue:(float)aFloat;
220- (double)doubleValue;
221- (void)setDoubleValue:(double)aDouble;
222- (void)takeIntValueFrom:(id)sender;
223- (void)takeFloatValueFrom:(id)sender;
224- (void)takeDoubleValueFrom:(id)sender;
225- (void)takeStringValueFrom:(id)sender;
226- (void)takeObjectValueFrom:(id)sender;
227- (NSImage *)image;
228- (void)setImage:(NSImage *)image;
229- (void) setControlTint:(NSControlTint)controlTint;
230- (NSControlTint)controlTint;
231- (void)setControlSize:(NSControlSize)size;
232- (NSControlSize)controlSize;
233- (id)representedObject;
234- (void)setRepresentedObject:(id)anObject;
235- (int)cellAttribute:(NSCellAttribute)aParameter;
236- (void)setCellAttribute:(NSCellAttribute)aParameter to:(int)value;
237- (NSRect)imageRectForBounds:(NSRect)theRect;
238- (NSRect)titleRectForBounds:(NSRect)theRect;
239- (NSRect)drawingRectForBounds:(NSRect)theRect;
240- (NSSize)cellSize;
241- (NSSize)cellSizeForBounds:(NSRect)aRect;
242- (NSColor *)highlightColorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
243- (void)calcDrawInfo:(NSRect)aRect;
244- (NSText *)setUpFieldEditorAttributes:(NSText *)textObj;
245- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
246- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
247- (void)highlight:(BOOL)flag withFrame:(NSRect)cellFrame inView:(NSView *)controlView;
248- (int)mouseDownFlags;
249- (void)getPeriodicDelay:(float *)delay interval:(float *)interval;
250- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView;
251- (BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint)currentPoint inView:(NSView *)controlView;
252- (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView:(NSView *)controlView mouseIsUp:(BOOL)flag;
253- (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:(NSView *)controlView untilMouseUp:(BOOL)flag;
254- (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject event:(NSEvent *)theEvent;
255- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(int)selStart length:(int)selLength;
256- (void)endEditing:(NSText *)textObj;
257- (void)resetCursorRect:(NSRect)cellFrame inView:(NSView *)controlView;
258
259- (void)setMenu:(NSMenu *)aMenu;
260- (NSMenu *)menu;
261- (NSMenu *)menuForEvent:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)view;
262+ (NSMenu *)defaultMenu;
263
264- (void)setSendsActionOnEndEditing:(BOOL)flag;
265- (BOOL)sendsActionOnEndEditing;
266
267#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
268- (NSWritingDirection)baseWritingDirection;
269- (void)setBaseWritingDirection:(NSWritingDirection)writingDirection;
270
271- (void)setLineBreakMode:(NSLineBreakMode)mode;
272- (NSLineBreakMode)lineBreakMode;
273
274- (void)setAllowsUndo:(BOOL)allowsUndo;
275- (BOOL)allowsUndo;
276#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 */
277@end
278
279@interface NSCell(NSKeyboardUI)
280- (void)setRefusesFirstResponder:(BOOL)flag;
281- (BOOL)refusesFirstResponder;
282- (BOOL)acceptsFirstResponder;
283- (void)setShowsFirstResponder:(BOOL)showFR;
284- (BOOL)showsFirstResponder;
285- (void)setMnemonicLocation:(unsigned)location;
286- (unsigned)mnemonicLocation;
287- (NSString *)mnemonic;
288- (void)setTitleWithMnemonic:(NSString *)stringWithAmpersand;
289- (void)performClick:(id)sender;
290
291#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
292- (void)setFocusRingType:(NSFocusRingType)focusRingType;
293- (NSFocusRingType)focusRingType;
294+ (NSFocusRingType)defaultFocusRingType;
295#endif
296@end
297
298@interface NSCell(NSCellAttributedStringMethods)
299- (NSAttributedString *)attributedStringValue;
300- (void)setAttributedStringValue:(NSAttributedString *)obj;
301/* These methods determine whether the user can modify text attributes and import graphics in a rich cell.  Note that whatever these flags are, cells can still contain attributed text if programmatically set. */
302- (BOOL)allowsEditingTextAttributes;
303- (void)setAllowsEditingTextAttributes:(BOOL)flag;	/* If NO, also clears setImportsGraphics: */
304- (BOOL)importsGraphics;
305- (void)setImportsGraphics:(BOOL)flag;			/* If YES, also sets setAllowsEditingTextAttributes: */
306@end
307
308@interface NSCell(NSCellMixedState)
309- (void)setAllowsMixedState:(BOOL)flag;	/* allow button to have mixed state value*/
310- (BOOL)allowsMixedState;
311- (int)nextState;			/* get next state state in cycle */
312- (void)setNextState;			/* toggle/cycle through states */
313@end}
314
315  end;
316
317//APPKIT_EXTERN NSString *NSControlTintDidChangeNotification; /* sent after user changes control tint preference */
318
319{$endif}
320{$endif}
321{$ifdef IMPLEMENTATION}
322
323{$endif}
324
325