home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.2 (Developer) / NS_dev_3.2.iso / NextDeveloper / Headers / appkit / Window.h < prev    next >
Text File  |  1992-09-11  |  11KB  |  341 lines

  1. /*
  2.     Window.h
  3.     Application Kit, Release 2.0
  4.     Copyright (c) 1988, 1989, 1990, NeXT, Inc.  All rights reserved. 
  5. */
  6.  
  7. #import "Responder.h"
  8. #import "screens.h"
  9. #import "graphics.h"
  10. #import "drag.h"
  11. #import "color.h"
  12. #import <objc/hashtable.h>
  13.  
  14. /* Window Types */
  15.  
  16. #define NX_PLAINSTYLE        0
  17. #define NX_TITLEDSTYLE        1
  18. #define NX_MENUSTYLE        2
  19. #define NX_MINIWINDOWSTYLE    3
  20. #define NX_MINIWORLDSTYLE    4
  21. #define NX_TOKENSTYLE        5
  22. #define NX_RESIZEBARSTYLE    6
  23. #define NX_SIZEBARSTYLE        NX_RESIZEBARSTYLE    /* historical */
  24.  
  25. #define NX_FIRSTWINSTYLE    NX_PLAINSTYLE
  26. #define NX_LASTWINSTYLE        NX_RESIZEBARSTYLE
  27. #define NX_NUMWINSTYLES        (NX_LASTWINSTYLE - NX_FIRSTWINSTYLE + 1)
  28.  
  29. #define NX_CLOSEBUTTONMASK        1
  30. #define NX_MINIATURIZEBUTTONMASK    4
  31.  
  32. #define NX_ICONWIDTH        48.0
  33. #define NX_ICONHEIGHT        48.0
  34. #define NX_TOKENWIDTH        64.0
  35. #define NX_TOKENHEIGHT        64.0
  36.  
  37. /* Window Level Hierarchy */
  38.  
  39. #define NX_NORMALLEVEL        0
  40. #define NX_FLOATINGLEVEL    3
  41. #define NX_DOCKLEVEL        5
  42. #define NX_SUBMENULEVEL        10
  43. #define NX_MAINMENULEVEL    20
  44.  
  45. /* Length of string argument to saveFrameToString: */
  46.  
  47. #define NX_MAXFRAMESTRINGLENGTH    300
  48.  
  49.  
  50. @interface Window : Responder
  51. {
  52.     NXRect              frame;
  53.     id                  contentView;
  54.     id                  delegate;
  55.     id                  firstResponder;
  56.     id                  lastLeftHit;
  57.     id                  lastRightHit;
  58.     id                  counterpart;
  59.     id                  fieldEditor;
  60.     int                 winEventMask;
  61.     int                 windowNum;
  62.     float               backgroundGray;
  63.     struct _wFlags {
  64. #ifdef __BIG_ENDIAN__
  65.     unsigned int        style:4;
  66.     unsigned int        backing:2;
  67.     unsigned int        buttonMask:3;
  68.     unsigned int        visible:1;
  69.     unsigned int        isMainWindow:1;
  70.     unsigned int        isKeyWindow:1;
  71.     unsigned int        isPanel:1;
  72.     unsigned int        hideOnDeactivate:1;
  73.     unsigned int        dontFreeWhenClosed:1;
  74.     unsigned int        oneShot:1;
  75. #else
  76.     unsigned int        oneShot:1;
  77.     unsigned int        dontFreeWhenClosed:1;
  78.     unsigned int        hideOnDeactivate:1;
  79.     unsigned int        isPanel:1;
  80.     unsigned int        isKeyWindow:1;
  81.     unsigned int        isMainWindow:1;
  82.     unsigned int        visible:1;
  83.     unsigned int        buttonMask:3;
  84.     unsigned int        backing:2;
  85.     unsigned int        style:4;
  86. #endif
  87.     }                   wFlags;
  88.     struct _wFlags2 {
  89. #ifdef __BIG_ENDIAN__
  90.     unsigned int        deferred:1;
  91.     unsigned int        _cursorRectsDisabled:1;
  92.     unsigned int        _haveFreeCursorRects:1;
  93.     unsigned int        _validCursorRects:1;
  94.     unsigned int        docEdited:1;
  95.     unsigned int        dynamicDepthLimit:1;
  96.     unsigned int        _worksWhenModal:1;
  97.     unsigned int        _limitedBecomeKey:1;
  98.     unsigned int        _needsFlush:1;
  99.     unsigned int        _newMiniIcon:1;
  100.     unsigned int        _ignoredFirstMouse:1;
  101.     unsigned int        _repostedFirstMouse:1;
  102.     unsigned int        _windowDying:1;
  103.     unsigned int        _tempHidden:1;
  104.     unsigned int        _hiddenOnDeactivate:1;
  105.     unsigned int        _floatingPanel:1;
  106. #else
  107.     unsigned int        _floatingPanel:1;
  108.     unsigned int        _hiddenOnDeactivate:1;
  109.     unsigned int        _tempHidden:1;
  110.     unsigned int        _windowDying:1;
  111.     unsigned int        _repostedFirstMouse:1;
  112.     unsigned int        _ignoredFirstMouse:1;
  113.     unsigned int        _RESERVED:1;
  114.     unsigned int        _needsFlush:1;
  115.     unsigned int        _limitedBecomeKey:1;
  116.     unsigned int        _worksWhenModal:1;
  117.     unsigned int        dynamicDepthLimit:1;
  118.     unsigned int        docEdited:1;
  119.     unsigned int        _validCursorRects:1;
  120.     unsigned int        _haveFreeCursorRects:1;
  121.     unsigned int        _cursorRectsDisabled:1;
  122.     unsigned int        deferred:1;
  123. #endif
  124.     }                   wFlags2;
  125.     id                  _borderView;
  126.     short               _displayDisabled;
  127.     short               _flushDisabled;
  128.     void               *_cursorRects;
  129.     NXHashTable        *_trectTable;
  130.     id                  _invalidCursorView;
  131.     id            _miniIcon;
  132.     void           *_private;
  133. }
  134.  
  135. + getFrameRect:(NXRect *)fRect forContentRect:(const NXRect *)cRect style:(int)aStyle;
  136. + getContentRect:(NXRect *)cRect forFrameRect:(const NXRect *)fRect style:(int)aStyle;
  137. + (NXCoord)minFrameWidth:(const char *)aTitle forStyle:(int)aStyle buttonMask:(int)aMask;
  138. + (NXWindowDepth)defaultDepthLimit;
  139.  
  140. - init;
  141. - initContent:(const NXRect *)contentRect style:(int)aStyle backing:(int)bufferingType buttonMask:(int)mask defer:(BOOL)flag;
  142. - initContent:(const NXRect *)contentRect style:(int)aStyle backing:(int)bufferingType buttonMask:(int)mask defer:(BOOL)flag screen:(const NXScreen *)screen;
  143. - free;
  144. - awake;
  145. - setTitle:(const char *)aString;
  146. - setTitleAsFilename:(const char *)aString;
  147. - setExcludedFromWindowsMenu:(BOOL)flag;
  148. - (BOOL)isExcludedFromWindowsMenu;
  149. - setContentView:aView;
  150. - contentView;
  151. - setDelegate:anObject;
  152. - delegate;
  153. - (const char *)title;
  154. - (int)buttonMask;
  155. - (int)windowNum;
  156. - getFieldEditor:(BOOL)createFlag for:anObject;
  157. - endEditingFor:anObject;
  158. - placeWindowAndDisplay:(const NXRect *)frameRect;
  159. - placeWindow:(const NXRect *)frameRect;
  160. - placeWindow:(const NXRect *)frameRect screen:(const NXScreen *)screen;
  161. - (BOOL)constrainFrameRect:(NXRect *)frameRect toScreen:(const NXScreen *)screen;
  162. - sizeWindow:(NXCoord)width :(NXCoord)height;
  163. - moveTo:(NXCoord)x :(NXCoord)y;
  164. - moveTopLeftTo:(NXCoord)x :(NXCoord)y;
  165. - moveTo:(NXCoord)x :(NXCoord)y screen:(const NXScreen *)screen;
  166. - moveTopLeftTo:(NXCoord)x :(NXCoord)y screen:(const NXScreen *)screen;
  167. - getFrame:(NXRect *)theRect;
  168. - getFrame:(NXRect *)rect andScreen:(const NXScreen **)screen;
  169. - getMouseLocation:(NXPoint *)thePoint;
  170. - (int)style;
  171. - useOptimizedDrawing:(BOOL)flag;
  172. - disableFlushWindow;
  173. - reenableFlushWindow;
  174. - (BOOL)isFlushWindowDisabled;
  175. - flushWindow;
  176. - flushWindowIfNeeded;
  177. - disableDisplay;
  178. - reenableDisplay;
  179. - (BOOL)isDisplayEnabled;
  180. - displayIfNeeded;
  181. - display;
  182. - update;
  183. - (int)setEventMask:(int)newMask;
  184. - (int)addToEventMask:(int)newEvents;
  185. - (int)removeFromEventMask:(int)oldEvents;
  186. - (int)eventMask;
  187. - setTrackingRect:(const NXRect *)aRect inside:(BOOL)insideFlag owner:anObject tag:(int)trackNum left:(BOOL)leftDown right:(BOOL)rightDown;
  188. - discardTrackingRect:(int)trackNum;
  189. - makeFirstResponder:aResponder;
  190. - firstResponder;
  191. - sendEvent:(NXEvent *)theEvent;
  192. - windowExposed:(NXEvent *)theEvent;
  193. - windowMoved:(NXEvent *)theEvent;
  194. - screenChanged:(NXEvent *)theEvent;
  195. - (int)resizeFlags;
  196. - makeKeyWindow;
  197. - becomeKeyWindow;
  198. - resignKeyWindow;
  199. - becomeMainWindow;
  200. - resignMainWindow;
  201. - displayBorder;
  202. - rightMouseDown:(NXEvent *)theEvent;
  203. - (BOOL)commandKey:(NXEvent *)theEvent;
  204. - close;
  205. - setFreeWhenClosed:(BOOL)flag;
  206. - miniaturize:sender;
  207. - deminiaturize:sender;
  208. - (BOOL)tryToPerform:(SEL)anAction with:anObject;
  209. - validRequestorForSendType:(NXAtom)sendType andReturnType:(NXAtom)returnType;
  210. - setBackgroundGray:(float)value;
  211. - (float)backgroundGray;
  212. - setBackgroundColor:(NXColor)color;
  213. - (NXColor)backgroundColor;
  214. - dragFrom:(float)x :(float)y eventNum:(int)num;
  215. - setHideOnDeactivate:(BOOL)flag;
  216. - (BOOL)doesHideOnDeactivate;
  217. - center;
  218. - makeKeyAndOrderFront:sender;
  219. - orderFront:sender;
  220. - orderBack:sender;
  221. - orderOut:sender;
  222. - orderWindow:(int)place relativeTo:(int)otherWin;
  223. - orderFrontRegardless;
  224. - setMiniwindowIcon:(const char *)anIcon;
  225. - setMiniwindowImage:image;
  226. - setMiniwindowTitle:(const char *)title;
  227. - (const char *)miniwindowIcon;
  228. - (NXImage *)miniwindowImage;
  229. - (const char *)miniwindowTitle;
  230. - setDocEdited:(BOOL)flag;
  231. - (BOOL)isDocEdited;
  232. - (BOOL)isVisible;
  233. - (BOOL)isKeyWindow;
  234. - (BOOL)isMainWindow;
  235. - (BOOL)canBecomeKeyWindow;
  236. - (BOOL)canBecomeMainWindow;
  237. - (BOOL)worksWhenModal;
  238. - convertBaseToScreen:(NXPoint *)aPoint;
  239. - convertScreenToBase:(NXPoint *)aPoint;
  240. - performClose:sender;
  241. - performMiniaturize:sender;
  242. - (int)gState;
  243. - setOneShot:(BOOL)flag;
  244. - (BOOL)isOneShot;
  245. - faxPSCode:sender;
  246. - printPSCode:sender;
  247. - copyPSCodeInside:(const NXRect *)rect to:(NXStream *)stream;
  248. - smartFaxPSCode:sender;
  249. - smartPrintPSCode:sender;
  250. - (BOOL)knowsPagesFirst:(int *)firstPageNum last:(int *)lastPageNum;
  251. - openSpoolFile:(char *)filename;
  252. - beginPSOutput;
  253. - beginPrologueBBox:(const NXRect *)boundingBox creationDate:(const char *)dateCreated createdBy:(const char *)anApplication fonts:(const char *)fontNames forWhom:(const char *)user pages:(int)numPages title:(const char *)aTitle;
  254. - endHeaderComments;
  255. - endPrologue;
  256. - beginSetup;
  257. - endSetup;
  258. - beginPage:(int)ordinalNum label:(const char *)aString bBox:(const NXRect *)pageRect fonts:(const char *)fontNames;
  259. - beginPageSetupRect:(const NXRect *)aRect placement:(const NXPoint *)location;
  260. - endPageSetup;
  261. - endPage;
  262. - beginTrailer;
  263. - endTrailer;
  264. - endPSOutput;
  265. - spoolFile:(const char *)filename;
  266. - (float)heightAdjustLimit;
  267. - (float)widthAdjustLimit;
  268. - (BOOL)getRect:(NXRect *)theRect forPage:(int)page;
  269. - placePrintRect:(const NXRect *)aRect offset:(NXPoint *)location;
  270. - addCursorRect:(const NXRect *)aRect cursor:anObj forView:aView;
  271. - removeCursorRect:(const NXRect *)aRect cursor:anObj forView:aView;
  272. - disableCursorRects;
  273. - enableCursorRects;
  274. - discardCursorRects;
  275. - invalidateCursorRectsForView:aView;
  276. - resetCursorRects;
  277. - setBackingType:(int)bufferingType;
  278. - (int)backingType;
  279. - setAvoidsActivation:(BOOL)flag;
  280. - (BOOL)avoidsActivation;
  281. - setDepthLimit:(NXWindowDepth)limit;
  282. - (NXWindowDepth)depthLimit;
  283. - setDynamicDepthLimit:(BOOL)flag;
  284. - (BOOL)hasDynamicDepthLimit;
  285. - (const NXScreen *)screen;
  286. - (const NXScreen *)bestScreen;
  287. - (BOOL)canStoreColor;
  288. - counterpart;
  289. - (void)saveFrameToString:(char *)string;
  290. - (void)setFrameFromString:(const char *)string;
  291. - (void)saveFrameUsingName:(const char *)name;
  292. - (BOOL)setFrameUsingName:(const char *)name;
  293. - (BOOL)setFrameAutosaveName:(const char *)name;
  294. - (const char *)frameAutosaveName;
  295. + (void)removeFrameUsingName:(const char *)name;
  296. - getMinSize:(NXSize *)size;
  297. - getMaxSize:(NXSize *)size;
  298. - setMinSize:(const NXSize *)size;
  299. - setMaxSize:(const NXSize *)size;
  300. - write:(NXTypedStream *)stream;
  301. - read:(NXTypedStream *)stream;
  302.  
  303. /* 
  304.  * The following new... methods are now obsolete.  They remain in this  
  305.  * interface file for backward compatibility only.  Use Object's alloc method  
  306.  * and the init... methods defined in this class instead.
  307.  */
  308. + newContent:(const NXRect *)contentRect style:(int)aStyle backing:(int)bufferingType buttonMask:(int)mask defer:(BOOL)flag;
  309. + newContent:(const NXRect *)contentRect style:(int)aStyle backing:(int)bufferingType buttonMask:(int)mask defer:(BOOL)flag screen:(const NXScreen *)screen;
  310. + new;
  311.  
  312. @end
  313.  
  314.  
  315. @interface Window(Drag)
  316. - dragImage:anImage at:(NXPoint *)baseLocation offset:(NXPoint *)initialOffset event:(NXEvent *)event pasteboard:(Pasteboard *)pboard source:sourceObj slideBack:(BOOL)slideFlag;
  317.  
  318. - registerForDraggedTypes:(const char *const *)newTypes count:(int)numTypes;
  319. - unregisterDraggedTypes;
  320. @end
  321.  
  322.  
  323. @interface Object(WindowDelegate)
  324. - windowWillClose:sender;
  325. - windowWillReturnFieldEditor:sender toObject:client;
  326. - windowWillResize:sender toSize:(NXSize *)frameSize;
  327. - windowDidResize:sender;
  328. - windowDidExpose:sender;
  329. - windowWillMove:sender;
  330. - windowDidMove:sender;
  331. - windowDidBecomeKey:sender;
  332. - windowDidResignKey:sender;
  333. - windowDidBecomeMain:sender;
  334. - windowDidResignMain:sender;
  335. - windowWillMiniaturize:sender toMiniwindow:miniwindow;
  336. - windowDidMiniaturize:sender;
  337. - windowDidDeminiaturize:sender;
  338. - windowDidUpdate:sender;
  339. - windowDidChangeScreen:sender;
  340. @end
  341.