home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-Developer.iso / NextLibrary / Frameworks / AppKit.framework / Versions / B / Headers / NSCell.h < prev    next >
Text File  |  1996-10-17  |  8KB  |  259 lines

  1. /*
  2.     NSCell.h
  3.     Application Kit
  4.     Copyright (c) 1994-1996, NeXT Software, Inc.
  5.     All rights reserved.
  6. */
  7.  
  8. #import <Foundation/NSObject.h>
  9. #import <AppKit/NSText.h>
  10.  
  11. @class NSEvent;
  12. @class NSMenu;
  13. @class NSControl;
  14. #ifndef STRICT_OPENSTEP
  15. @class NSAttributedString;
  16. @class NSFormatter;
  17. #endif
  18.  
  19. enum {
  20.     NSAnyType                = 0,
  21.     NSIntType                = 1,
  22.     NSPositiveIntType            = 2,
  23.     NSFloatType                = 3,
  24.     NSPositiveFloatType            = 4,
  25.     NSDoubleType            = 6,
  26.     NSPositiveDoubleType        = 7
  27. };
  28.  
  29. typedef enum _NSCellType {
  30.     NSNullCellType            = 0,
  31.     NSTextCellType            = 1,
  32.     NSImageCellType            = 2
  33. } NSCellType;
  34.  
  35. typedef enum _NSCellAttribute {
  36.     NSCellDisabled            = 0,
  37.     NSCellState                = 1,
  38.     NSPushInCell            = 2,
  39.     NSCellEditable            = 3,
  40.     NSChangeGrayCell            = 4,
  41.     NSCellHighlighted            = 5,
  42.     NSCellLightsByContents        = 6,
  43.     NSCellLightsByGray            = 7,
  44.     NSChangeBackgroundCell        = 8,
  45.     NSCellLightsByBackground        = 9,
  46.     NSCellIsBordered            = 10,
  47.     NSCellHasOverlappingImage        = 11,
  48.     NSCellHasImageHorizontal        = 12,
  49.     NSCellHasImageOnLeftOrBottom    = 13,
  50.     NSCellChangesContents        = 14,
  51.     NSCellIsInsetButton            = 15
  52. } NSCellAttribute;
  53.  
  54. typedef enum _NSCellImagePosition {
  55.     NSNoImage                = 0,
  56.     NSImageOnly                = 1,
  57.     NSImageLeft                = 2,
  58.     NSImageRight            = 3,
  59.     NSImageBelow            = 4,
  60.     NSImageAbove            = 5,
  61.     NSImageOverlaps            = 6
  62. } NSCellImagePosition;
  63.  
  64. /* ButtonCell highlightsBy and showsStateBy mask */
  65.  
  66. enum {
  67.     NSNoCellMask            = 0,
  68.     NSContentsCellMask            = 1,
  69.     NSPushInCellMask            = 2,
  70.     NSChangeGrayCellMask        = 4,
  71.     NSChangeBackgroundCellMask        = 8,
  72. };
  73.  
  74. typedef struct __CFlags {
  75.     unsigned int        state:1;
  76.     unsigned int        highlighted:1;
  77.     unsigned int        disabled:1;
  78.     unsigned int        editable:1;
  79.     NSCellType          type:2;
  80.     unsigned int        vCentered:1;
  81.     unsigned int        hCentered:1;
  82.     unsigned int        bordered:1;
  83.     unsigned int        bezeled:1;
  84.     unsigned int        selectable:1;
  85.     unsigned int        scrollable:1;
  86.     unsigned int        continuous:1;
  87.     unsigned int        actOnMouseDown:1;
  88.     unsigned int        isLeaf:1;
  89.     unsigned int        mnemonicLocation:8;
  90.     unsigned int        actOnMouseDragged:1;
  91.     unsigned int        isLoaded:1;
  92.     unsigned int        noWrap:1;
  93.     unsigned int        dontActOnMouseUp:1;
  94.     unsigned int        isWhite:1;
  95.     unsigned int        useUserKeyEquivalent:1;
  96.     unsigned int        showsFirstResponder:1;
  97.     unsigned int        docEditing:1;
  98.     unsigned int        docSaved:1;
  99.     unsigned int        wasSelectable:1;
  100.     unsigned int        hasInvalidObject:1;
  101.     unsigned int        allowsEditingTextAttributes:1;
  102.     unsigned int        importsGraphics:1;
  103.     NSTextAlignment     alignment:3;
  104.     unsigned int        retainCountOverMax:1;
  105.     unsigned int        retainCount:7;
  106.     unsigned int        refusesFirstResponder:1;
  107.     unsigned int        needsHighlightedText:1;
  108.     unsigned int        doesntShowMnemonicNormally:1;
  109.     unsigned int        currentlyEditing:1;
  110.     unsigned int        RESERVED4:13;
  111. } _CFlags;
  112.  
  113.  
  114.  
  115. @interface NSCell : NSObject <NSCopying, NSCoding>
  116. {
  117.     id _contents;
  118.     _CFlags _cFlags;
  119. @private
  120.     // This variable should *only* be accessed through the following methods:
  121.     // setImage:, image, setFont:, and font
  122.     id _support;
  123. }
  124.  
  125.  
  126. + (BOOL)prefersTrackingUntilMouseUp;
  127.  
  128.  
  129. - (id)initTextCell:(NSString *)aString;
  130. - (id)initImageCell:(NSImage *)image;
  131.  
  132. - (NSView *)controlView;
  133. - (NSCellType)type;
  134. - (void)setType:(NSCellType)aType;
  135. - (int)state;
  136. - (void)setState:(int)value;
  137. - (id)target;
  138. - (void)setTarget:(id)anObject;
  139. - (SEL)action;
  140. - (void)setAction:(SEL)aSelector;
  141. - (int)tag;
  142. - (void)setTag:(int)anInt;
  143. - (BOOL)isOpaque;
  144. - (BOOL)isEnabled;
  145. - (void)setEnabled:(BOOL)flag;
  146. - (int)sendActionOn:(int)mask;
  147. - (BOOL)isContinuous;
  148. - (void)setContinuous:(BOOL)flag;
  149. - (BOOL)isEditable;
  150. - (void)setEditable:(BOOL)flag;
  151. - (BOOL)isSelectable;
  152. - (void)setSelectable:(BOOL)flag;
  153. - (BOOL)isBordered;
  154. - (void)setBordered:(BOOL)flag;
  155. - (BOOL)isBezeled;
  156. - (void)setBezeled:(BOOL)flag;
  157. - (BOOL)isScrollable;
  158. - (void)setScrollable:(BOOL)flag;    /* If YES, sets wraps to NO */
  159. - (BOOL)isHighlighted;
  160. - (NSTextAlignment)alignment;
  161. - (void)setAlignment:(NSTextAlignment)mode;
  162. - (BOOL)wraps;
  163. - (void)setWraps:(BOOL)flag;    /* If YES, sets scrollable to NO */
  164. - (NSFont *)font;
  165. - (void)setFont:(NSFont *)fontObj;
  166. - (int)entryType;
  167. - (void)setEntryType:(int)aType;
  168. - (BOOL)isEntryAcceptable:(NSString *)aString;
  169. - (void)setFloatingPointFormat:(BOOL)autoRange left:(unsigned)leftDigits right:(unsigned)rightDigits;
  170. - (NSString *)keyEquivalent;
  171. #ifndef STRICT_OPENSTEP
  172. - (void)setFormatter:(NSFormatter *)newFormatter;
  173. - (id)formatter;
  174. - (id <NSCopying>)objectValue;
  175. - (void)setObjectValue:(id <NSCopying>)obj;
  176. - (BOOL)hasValidObjectValue;
  177. #endif STRICT_OPENSTEP
  178. - (NSString *)stringValue;
  179. - (void)setStringValue:(NSString *)aString;
  180. - (NSComparisonResult)compare:(id)otherCell;
  181. - (int)intValue;
  182. - (void)setIntValue:(int)anInt;
  183. - (float)floatValue;
  184. - (void)setFloatValue:(float)aFloat;
  185. - (double)doubleValue;
  186. - (void)setDoubleValue:(double)aDouble;
  187. - (void)takeIntValueFrom:(id)sender;
  188. - (void)takeFloatValueFrom:(id)sender;
  189. - (void)takeDoubleValueFrom:(id)sender;
  190. - (void)takeStringValueFrom:(id)sender;
  191. #ifndef STRICT_OPENSTEP
  192. - (void)takeObjectValueFrom:(id)sender;
  193. #endif
  194. - (NSImage *)image;
  195. - (void)setImage:(NSImage *)image;
  196. - (id)representedObject;
  197. - (void)setRepresentedObject:(id)anObject;
  198. - (int)cellAttribute:(NSCellAttribute)aParameter;
  199. - (void)setCellAttribute:(NSCellAttribute)aParameter to:(int)value;
  200. - (NSRect)imageRectForBounds:(NSRect)theRect;
  201. - (NSRect)titleRectForBounds:(NSRect)theRect;
  202. - (NSRect)drawingRectForBounds:(NSRect)theRect;
  203. - (NSSize)cellSize;
  204. - (NSSize)cellSizeForBounds:(NSRect)aRect;
  205. - (void)calcDrawInfo:(NSRect)aRect;
  206. - (NSText *)setUpFieldEditorAttributes:(NSText *)textObj;
  207. - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
  208. - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
  209. - (void)highlight:(BOOL)flag withFrame:(NSRect)cellFrame inView:(NSView *)controlView;
  210. - (int)mouseDownFlags;
  211. - (void)getPeriodicDelay:(float *)delay interval:(float *)interval;
  212. - (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView;
  213. - (BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint)currentPoint inView:(NSView *)controlView;
  214. - (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView:(NSView *)controlView mouseIsUp:(BOOL)flag;
  215. - (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:(NSView *)controlView untilMouseUp:(BOOL)flag;
  216. - (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject event:(NSEvent *)theEvent;
  217. - (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(int)selStart length:(int)selLength;
  218. - (void)endEditing:(NSText *)textObj;
  219. - (void)resetCursorRect:(NSRect)cellFrame inView:(NSView *)controlView;
  220.  
  221. #ifndef STRICT_OPENSTEP
  222. - (void)setMenu:(NSMenu *)aMenu;
  223. - (NSMenu *)menu;
  224. - (NSMenu *)menuForEvent:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)view;
  225. + (NSMenu *)defaultMenu;
  226. #endif
  227.  
  228. @end
  229.  
  230. #ifndef STRICT_OPENSTEP
  231. @interface NSCell(NSKeyboardUI)
  232. - (void)setRefusesFirstResponder:(BOOL)flag;
  233. - (BOOL)refusesFirstResponder;
  234. - (BOOL)acceptsFirstResponder;
  235. - (void)setShowsFirstResponder:(BOOL)showFR;
  236. - (BOOL)showsFirstResponder;
  237. - (void)setMnemonicLocation:(unsigned)location;
  238. - (unsigned)mnemonicLocation;
  239. - (NSString *)mnemonic;
  240. - (void)setTitleWithMnemonic:(NSString *)stringWithAmpersand;
  241. - (void)performClick:(id)sender;
  242. @end
  243. #endif STRICT_OPENSTEP
  244.  
  245.  
  246. #ifndef STRICT_OPENSTEP
  247.  
  248. @interface NSCell(NSCellAttributedStringMethods)
  249. - (NSAttributedString *)attributedStringValue;
  250. - (void)setAttributedStringValue:(NSAttributedString *)obj;
  251. /* 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. */
  252. - (BOOL)allowsEditingTextAttributes;
  253. - (void)setAllowsEditingTextAttributes:(BOOL)flag;    /* If NO, also clears setImportsGraphics: */
  254. - (BOOL)importsGraphics;
  255. - (void)setImportsGraphics:(BOOL)flag;            /* If YES, also sets setAllowsEditingTextAttributes: */
  256. @end
  257.  
  258. #endif
  259.