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

  1. /*
  2.     NSView.h
  3.     Application Kit
  4.     Copyright (c) 1994-1996, NeXT Software, Inc.
  5.     All rights reserved.
  6. */
  7.  
  8. #import <Foundation/Foundation.h>
  9. #import <AppKit/NSWindow.h>
  10. #import <AppKit/NSScreen.h>
  11. #import <AppKit/AppKitDefines.h>
  12.  
  13. @class NSCursor;
  14. @class NSScrollView;
  15.  
  16. enum {
  17.     NSViewNotSizable            =  0,
  18.     NSViewMinXMargin            =  1,
  19.     NSViewWidthSizable            =  2,
  20.     NSViewMaxXMargin            =  4,
  21.     NSViewMinYMargin            =  8,
  22.     NSViewHeightSizable            = 16,
  23.     NSViewMaxYMargin            = 32
  24. };
  25.  
  26. typedef enum _NSBorderType {
  27.     NSNoBorder                = 0,
  28.     NSLineBorder            = 1,
  29.     NSBezelBorder            = 2,
  30.     NSGrooveBorder            = 3
  31. } NSBorderType;
  32.  
  33. typedef struct __VFlags {
  34. #ifdef __BIG_ENDIAN__
  35.     unsigned int        rotatedFromBase:1;
  36.     unsigned int        rotatedOrScaledFromBase:1;
  37.     unsigned int        autosizing:6;
  38.     unsigned int        autoresizeSubviews:1;
  39.     unsigned int        wantsGState:1;
  40.     unsigned int        needsDisplay:1;
  41.     unsigned int        validGState:1;
  42.     unsigned int        newGState:1;
  43.     unsigned int        noVerticalAutosizing:1;
  44.     unsigned int        frameChangeNotesSuspended:1;
  45.     unsigned int        needsFrameChangeNote:1;
  46.     unsigned int        focusChangeNotesSuspended:1;
  47.     unsigned int        boundsChangeNotesSuspended:1;
  48.     unsigned int        needsBoundsChangeNote:1;
  49.     unsigned int        removingWithoutInvalidation:1;
  50.         unsigned int        interfaceStyle0:1;
  51.     unsigned int        needsDisplayForBounds:1;
  52.     unsigned int        specialArchiving:1;
  53.     unsigned int        interfaceStyle1:1;
  54.     unsigned int        retainCount:6;
  55.     unsigned int        retainCountOverMax:1;
  56.     unsigned int        aboutToResize:1;
  57. #else
  58.     unsigned int        aboutToResize:1;
  59.     unsigned int        retainCountOverMax:1;
  60.     unsigned int        retainCount:6;
  61.     unsigned int        interfaceStyle1:1;
  62.     unsigned int        specialArchiving:1;
  63.     unsigned int        needsDisplayForBounds:1;
  64.     unsigned int        interfaceStyle0:1;
  65.         unsigned int        removingWithoutInvalidation:1;
  66.     unsigned int        needsBoundsChangeNote:1;
  67.     unsigned int        boundsChangeNotesSuspended:1;
  68.     unsigned int        focusChangeNotesSuspended:1;
  69.     unsigned int        needsFrameChangeNote:1;
  70.     unsigned int        frameChangeNotesSuspended:1;
  71.     unsigned int        noVerticalAutosizing:1;
  72.     unsigned int        newGState:1;
  73.     unsigned int        validGState:1;
  74.     unsigned int        needsDisplay:1;
  75.     unsigned int        wantsGState:1;
  76.     unsigned int        autoresizeSubviews:1;
  77.     unsigned int        autosizing:6;
  78.     unsigned int        rotatedOrScaledFromBase:1;
  79.     unsigned int        rotatedFromBase:1;
  80. #endif
  81. } _VFlags;
  82.  
  83. typedef int NSTrackingRectTag;
  84.  
  85. @class NSEvent;
  86.  
  87. @interface NSView : NSResponder
  88. {
  89.     NSRect              _frame;
  90.     NSRect              _bounds;
  91.     id                  _superview;
  92.     NSMutableArray      *_subviews;
  93.     NSWindow            *_window;
  94.     int                 _gState;
  95.     id                  _frameMatrix;
  96.     id            _drawMatrix;
  97.     NSMutableSet    *_dragTypes;
  98.     NSRect        *_errorOffsets;
  99.     _VFlags        _vFlags;
  100.     struct __VFlags2 {
  101.     unsigned int    nextKeyViewRefCount:14;
  102.     unsigned int    previousKeyViewRefCount:14;
  103.     unsigned int    clippedFocus:1;
  104.     unsigned int    hasToolTip:1;
  105.     unsigned int    reserved:2;
  106.     } _vFlags2;
  107. }
  108.  
  109.  
  110. - (id)initWithFrame:(NSRect)frameRect;
  111.  
  112. - (NSWindow *)window;
  113. - (NSView *)superview;
  114. - (NSArray *)subviews;
  115. - (BOOL)isDescendantOf:(NSView *)aView;
  116. - (NSView *)ancestorSharedWithView:(NSView *)aView;
  117. - (NSView *)opaqueAncestor;
  118. - (void)addSubview:(NSView *)aView;
  119. - (void)addSubview:(NSView *)aView positioned:(NSWindowOrderingMode)place relativeTo:(NSView *)otherView;
  120. - (void)sortSubviewsUsingFunction:(int (*)(id, id, void *))compare context:(void *)context;
  121. - (void)viewWillMoveToWindow:(NSWindow *)newWindow;
  122. - (void)viewWillMoveToSuperview:(NSView *)newSuperview;
  123. - (void)removeFromSuperview;
  124. - (void)replaceSubview:(NSView *)oldView with:(NSView *)newView;
  125. #ifndef STRICT_OPENSTEP
  126. - (void)removeFromSuperviewWithoutNeedingDisplay;
  127. #endif
  128.  
  129. - (void)setPostsFrameChangedNotifications:(BOOL)flag;
  130. - (BOOL)postsFrameChangedNotifications;
  131. - (void)resizeSubviewsWithOldSize:(NSSize)oldSize;
  132. - (void)resizeWithOldSuperviewSize:(NSSize)oldSize;
  133. - (void)setAutoresizesSubviews:(BOOL)flag;
  134. - (BOOL)autoresizesSubviews;
  135. - (void)setAutoresizingMask:(unsigned int)mask;
  136. - (unsigned int)autoresizingMask;
  137.  
  138. - (void)setFrameOrigin:(NSPoint)newOrigin;
  139. - (void)setFrameSize:(NSSize)newSize;
  140. - (void)setFrame:(NSRect)frameRect;
  141. - (NSRect)frame;
  142. - (void)setFrameRotation:(float)angle;
  143. - (float)frameRotation;
  144.  
  145. - (void)setBoundsOrigin:(NSPoint)newOrigin;
  146. - (void)setBoundsSize:(NSSize)newSize;
  147. - (void)setBoundsRotation:(float)angle;
  148. - (float)boundsRotation;
  149. - (void)translateOriginToPoint:(NSPoint)translation;
  150. - (void)scaleUnitSquareToSize:(NSSize)newUnitSize;
  151. - (void)rotateByAngle:(float)angle;
  152. - (void)setBounds:(NSRect)aRect;
  153. - (NSRect)bounds;
  154.  
  155. - (BOOL)isFlipped;
  156. - (BOOL)isRotatedFromBase;
  157. - (BOOL)isRotatedOrScaledFromBase;
  158. - (BOOL)isOpaque;
  159.  
  160. - (NSPoint)convertPoint:(NSPoint)aPoint fromView:(NSView *)aView;
  161. - (NSPoint)convertPoint:(NSPoint)aPoint toView:(NSView *)aView;
  162. - (NSSize)convertSize:(NSSize)aSize fromView:(NSView *)aView;
  163. - (NSSize)convertSize:(NSSize)aSize toView:(NSView *)aView;
  164. - (NSRect)convertRect:(NSRect)aRect fromView:(NSView *)aView;
  165. - (NSRect)convertRect:(NSRect)aRect toView:(NSView *)aView;
  166. - (NSRect)centerScanRect:(NSRect)aRect;
  167.  
  168. - (BOOL)canDraw;
  169. - (void)setNeedsDisplay:(BOOL)flag;
  170. - (void)setNeedsDisplayInRect:(NSRect)invalidRect;
  171. - (BOOL)needsDisplay;
  172. - (void)lockFocus;
  173. - (void)unlockFocus;
  174. + (NSView *)focusView;
  175. - (NSRect)visibleRect;
  176.  
  177. - (void)display;
  178. - (void)displayIfNeeded;
  179. - (void)displayIfNeededIgnoringOpacity;
  180. - (void)displayRect:(NSRect)rect;
  181. - (void)displayIfNeededInRect:(NSRect)rect;
  182. - (void)displayRectIgnoringOpacity:(NSRect)rect;
  183. - (void)displayIfNeededInRectIgnoringOpacity:(NSRect)rect;
  184. - (void)drawRect:(NSRect)rect;
  185.  
  186. - (int)gState;
  187. - (void)allocateGState;
  188. - (void)releaseGState;
  189. - (void)setUpGState;
  190. - (void)renewGState;
  191.  
  192. - (void)scrollPoint:(NSPoint)aPoint;
  193. - (BOOL)scrollRectToVisible:(NSRect)aRect;
  194. - (BOOL)autoscroll:(NSEvent *)theEvent;
  195. - (NSRect)adjustScroll:(NSRect)newVisible;
  196. - (void)scrollRect:(NSRect)aRect by:(NSSize)delta;
  197.  
  198. - (NSView *)hitTest:(NSPoint)aPoint;
  199. - (BOOL)mouse:(NSPoint)aPoint inRect:(NSRect)aRect;
  200. - (id)viewWithTag:(int)aTag;
  201. - (int)tag;
  202. - (BOOL)performKeyEquivalent:(NSEvent *)theEvent;
  203. - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent;
  204. - (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent *)theEvent;
  205. - (BOOL)needsPanelToBecomeKey;
  206.  
  207. - (void)addCursorRect:(NSRect)aRect cursor:(NSCursor *)anObj;
  208. - (void)removeCursorRect:(NSRect)aRect cursor:(NSCursor *)anObj;
  209. - (void)discardCursorRects;
  210. - (void)resetCursorRects;
  211.  
  212. - (NSTrackingRectTag)addTrackingRect:(NSRect)aRect owner:(id)anObject userData:(void *)data assumeInside:(BOOL)flag;
  213. - (void)removeTrackingRect:(NSTrackingRectTag)tag;
  214.  
  215. - (BOOL)shouldDrawColor;
  216.  
  217. - (void)setPostsBoundsChangedNotifications:(BOOL)flag;
  218. - (BOOL)postsBoundsChangedNotifications;
  219.  
  220. - (NSScrollView *)enclosingScrollView;
  221.  
  222. #ifndef STRICT_OPENSTEP
  223. - (NSMenu *)menuForEvent:(NSEvent *)event;
  224. + (NSMenu *)defaultMenu;
  225. #endif
  226.  
  227. #if !defined(STRICT_OPENSTEP) && !defined(STRICT_40) && !defined(STRICT_41)
  228. - (void)setToolTip:(NSString *)string;
  229. - (NSString *)toolTip;
  230. #endif
  231.  
  232. @end
  233.  
  234. #ifndef STRICT_OPENSTEP
  235. @interface NSView(NSKeyboardUI)
  236. - (BOOL)performMnemonic:(NSString *)theString;
  237. - (void)setNextKeyView:(NSView *)next;
  238. - (NSView *)nextKeyView;
  239. - (NSView *)previousKeyView;
  240. - (NSView *)nextValidKeyView;
  241. - (NSView *)previousValidKeyView;
  242. @end
  243. #endif
  244.  
  245. @interface NSView(NSPrinting)
  246.  
  247. - (void)writeEPSInsideRect:(NSRect)rect toPasteboard:(NSPasteboard *)pasteboard;
  248. - (NSData *)dataWithEPSInsideRect:(NSRect)rect;
  249. - (void)print:(id)sender;
  250. - (BOOL)knowsPagesFirst:(int *)firstPageNum last:(int *)lastPageNum;
  251. - (void)beginPrologueBBox:(NSRect)boundingBox creationDate:(NSString *)dateCreated createdBy:(NSString *)anApplication fonts:(NSString *)fontNames forWhom:(NSString *)user pages:(int)numPages title:(NSString *)aTitle;
  252. - (void)endHeaderComments;
  253. - (void)endPrologue;
  254. - (void)beginSetup;
  255. - (void)endSetup;
  256. - (void)beginPage:(int)ordinalNum label:(NSString *)aString bBox:(NSRect)pageRect fonts:(NSString *)fontNames;
  257. - (void)beginPageSetupRect:(NSRect)aRect placement:(NSPoint)location;
  258. - (void)addToPageSetup;
  259. - (void)endPageSetup;
  260. - (void)endPage;
  261. - (void)beginTrailer;
  262. - (void)endTrailer;
  263. - (float)heightAdjustLimit;
  264. - (float)widthAdjustLimit;
  265. - (void)adjustPageWidthNew:(float *)newRight left:(float)oldLeft right:(float)oldRight limit:(float)rightLimit;
  266. - (void)adjustPageHeightNew:(float *)newBottom top:(float)oldTop bottom:(float)oldBottom limit:(float)bottomLimit;
  267. - (NSRect)rectForPage:(int)page;
  268. - (NSPoint)locationOfPrintRect:(NSRect)aRect;
  269. - (void)drawSheetBorderWithSize:(NSSize)borderSize;
  270. - (void)drawPageBorderWithSize:(NSSize)borderSize;
  271.  
  272. #ifndef STRICT_OPENSTEP
  273. #ifndef WIN32
  274. // Mach-only non-openstep API.
  275. - (void)fax:(id)sender;
  276. #endif
  277. #endif
  278.  
  279. @end
  280.  
  281.  
  282. @interface NSView(NSDrag)
  283. - (void)dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag;
  284.  
  285. - (void)registerForDraggedTypes:(NSArray *)newTypes;
  286. - (void)unregisterDraggedTypes;
  287.  
  288. - (BOOL)dragFile:(NSString *)filename fromRect:(NSRect)rect slideBack:(BOOL)aFlag event:(NSEvent *)event;
  289.  
  290. @end
  291.  
  292. /* Notifications */
  293.  
  294. APPKIT_EXTERN NSString *NSViewFrameDidChangeNotification;
  295. APPKIT_EXTERN NSString *NSViewFocusDidChangeNotification;
  296. APPKIT_EXTERN NSString *NSViewBoundsDidChangeNotification;
  297.     // This notification is sent whenever the views bounds change and the frame does not.  That is, it is sent whenever the view's bounds are translated, scaled or rotated, but NOT when the bounds change as a result of, for example, setFrameSize:.
  298.  
  299.