Source:SLASH'EM 0.0.7E7F2/macwin.h

From NetHackWiki
Jump to navigation Jump to search

Below is the full text to macwin.h from the source code of SLASH'EM 0.0.7E7F2. To link to a particular line, write [[Source:SLASH'EM 0.0.7E7F2/macwin.h#line123]], for example.

Source code for vanilla NetHack is at Source code.


The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

1.    /*	SCCS Id: @(#)macwin.h	3.4	1996/01/15	*/
2.    /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3.    /* NetHack may be freely redistributed.  See license for details. */
4.    
5.    #ifndef MACWIN_H
6.    # define MACWIN_H
7.    #undef red			/* undef internal color const strings from decl */
8.    #undef green
9.    #undef blue
10.   
11.   #ifndef __MACH__
12.   #include <windows.h>
13.   #include <dialogs.h>
14.   #endif
15.   
16.   /* more headers */
17.   #ifdef THINK_C
18.   #include <pascal.h>	/* for CtoPStr and PtoCStr */
19.   #endif
20.   
21.   /* resources */
22.   #define PLAYER_NAME_RES_ID	1001
23.   
24.   /* fake some things if we don't have universal headers.. */
25.   #if 0  /*ndef NewUserItemProc*/
26.   typedef pascal void (*UserItemProcPtr)(WindowPtr theWindow, short itemNo);
27.   typedef UserItemProcPtr UserItemUPP;
28.   #define NewUserItemProc(p)	(UserItemUPP)(p)
29.   
30.   typedef pascal void (*ControlActionProcPtr)(ControlHandle theControl, short partCode);
31.   typedef ControlActionProcPtr ControlActionUPP;
32.   #define NewControlActionProc(p) (ControlActionUPP)(p)
33.   
34.   typedef ModalFilterProcPtr ModalFilterUPP;
35.   #define DisposeRoutineDescriptor(p)
36.   #endif
37.   
38.   /* misc */
39.   #ifdef __MWERKS__
40.   # define ResumeProcPtr long		/* for call to InitDialogs */
41.   #endif
42.   
43.   /* working dirs structure */
44.   typedef struct macdirs {
45.   	Str32		dataName;
46.   	short		dataRefNum;
47.   	long		dataDirID;
48.   
49.   	Str32		saveName;
50.   	short		saveRefNum;
51.   	long		saveDirID;
52.   
53.   	Str32		levelName;
54.   	short		levelRefNum;
55.   	long		levelDirID;
56.   } MacDirs;
57.   
58.   typedef struct macflags {
59.   	Bitfield (processes, 1);
60.   	Bitfield (color, 1);
61.   	Bitfield (folders, 1);
62.   	Bitfield (tempMem, 1);
63.   	Bitfield (help, 1);
64.   	Bitfield (fsSpec, 1);
65.   	Bitfield (trueType, 1);
66.   	Bitfield (aux, 1);
67.   	Bitfield (alias, 1);
68.   	Bitfield (standardFile, 1);
69.   	Bitfield (hasDebugger, 1);
70.   	Bitfield (hasAE, 1);
71.   	Bitfield (gotOpen, 1);
72.   } MacFlags;
73.   
74.   extern MacDirs theDirs;		/* used in macfile.c */
75.   extern MacFlags macFlags;
76.   
77.   /*
78.    * Mac windows
79.    */
80.   #define NUM_MACWINDOWS 15
81.   #define TEXT_BLOCK 512L
82.   
83.   /* Window constants */
84.   #define kMapWindow 0
85.   #define kStatusWindow 1
86.   #define kMessageWindow 2
87.   #define kTextWindow 3
88.   #define kMenuWindow 4
89.   #define kLastWindowKind kMenuWindow
90.   
91.   /*
92.    * This determines the minimum logical line length in text windows
93.    * That is; even if physical width is less, this is where line breaks
94.    * go at the minimum. 350 is about right for score lines with a
95.    * geneva 10 pt font.
96.    */
97.   #define MIN_RIGHT 350
98.   
99.   typedef struct {
100.  	anything id;
101.  	char accelerator;
102.  	char groupAcc;
103.  	short line;
104.  } MacMHMenuItem;
105.  
106.  typedef struct NhWindow {
107.  	WindowPtr		its_window;
108.  
109.  	short			font_number;
110.  	short			font_size;
111.  	short			char_width;
112.  	short			row_height;
113.  	short			ascent_height;
114.  	
115.  	short			x_size;
116.  	short			y_size;
117.  	short			x_curs;
118.  	short			y_curs;
119.  	
120.  	short		last_more_lin; /* Used by message window */
121.  	short		save_lin;		/* Used by message window */
122.  
123.  	short			miSize;		/* size of menu items arrays */
124.  	short			miLen;		/* number of menu items in array */
125.  	MacMHMenuItem	**menuInfo;		/* Used by menus (array handle) */
126.  	char		menuChar;		/* next menu accelerator to use */
127.  	short			**menuSelected;	/* list of selected elements from list */
128.  	short			miSelLen;	/* number of items selected */
129.  	short			how;		/* menu mode */
130.  
131.  	char			drawn;
132.  	Handle			windowText;
133.  	long			windowTextLen;
134.  	short		scrollPos;
135.  	ControlHandle	scrollBar;
136.  } NhWindow;
137.  
138.  extern Boolean CheckNhWin(WindowPtr mac_win);
139.  
140.  
141.  #define NUM_STAT_ROWS 2
142.  #define NUM_ROWS 22
143.  #define NUM_COLS 80 /* We shouldn't use column 0 */
144.  #define QUEUE_LEN 24
145.  
146.  extern NhWindow * theWindows;
147.  
148.  extern struct window_procs mac_procs;
149.  
150.  #define NHW_BASE 0
151.  extern winid BASE_WINDOW, WIN_MAP, WIN_MESSAGE, WIN_INVEN, WIN_STATUS;
152.  
153.  
154.  /*
155.   * External declarations for the window routines.
156.   */
157.  
158.  #define E extern
159.  
160.  /* ### dprintf.c ### */
161.  
162.  extern void dprintf (char *, ...);
163.  
164.  /* ### maccurs.c ### */
165.  
166.  extern Boolean RetrievePosition (short, short *, short *);
167.  extern Boolean RetrieveSize (short, short, short, short *, short *);
168.  extern void SaveWindowPos (WindowPtr);
169.  extern void SaveWindowSize (WindowPtr);
170.  extern Boolean FDECL(RetrieveWinPos, (WindowPtr,short *,short *));
171.  
172.  /* ### macerrs.c ### */
173.  
174.  extern void showerror(char *,const char *);
175.  extern Boolean itworked(short);
176.  extern void mustwork(short);
177.  extern void attemptingto(char *);
178.  /* appear to be unused 
179.  extern void comment(char *,long);
180.  extern void pushattemptingto(char *);
181.  extern void popattempt(void);
182.  */
183.  /* ### macfile.c ### */
184.  
185.  /* extern char *macgets(int fd, char *ptr, unsigned len); unused */
186.  extern void FDECL(C2P,(const char *c, unsigned char *p));
187.  extern void FDECL(P2C,(const unsigned char *p, char *c));
188.  
189.  /* ### macmenu.c ### */
190.  
191.  extern void DoMenuEvt (long);
192.  extern void InitMenuRes(void);
193.  extern void AdjustMenus(short);
194.  #define DimMenuBar() AdjustMenus(1)
195.  #define UndimMenuBar() AdjustMenus(0)
196.  
197.  /* ### macmain.c ### */
198.  
199.  extern void FDECL (process_openfile, (short s_vol, long s_dir, Str255 fNm, OSType ft));
200.  
201.  /* ### macwin.c ### */
202.  
203.  extern void AddToKeyQueue(unsigned char, Boolean);
204.  extern unsigned char GetFromKeyQueue (void);
205.  void trans_num_keys (EventRecord *);
206.  extern void NDECL (InitMac);
207.  int FDECL (try_key_queue, (char *));
208.  void FDECL (enter_topl_mode, (char *));
209.  void FDECL (leave_topl_mode, (char *));
210.  void FDECL (topl_set_resp, (char *, char));
211.  Boolean FDECL (topl_key, (unsigned char, Boolean));
212.  E void FDECL(HandleEvent, (EventRecord *));	/* used in mmodal.c */
213.  extern void NDECL(port_help);
214.  
215.  extern Boolean small_screen;
216.  
217.  E void FDECL(mac_init_nhwindows, (int *, char **));
218.  E void NDECL(mac_askname);
219.  E void NDECL(mac_get_nh_event);
220.  E void FDECL(mac_exit_nhwindows, (const char *));
221.  E winid FDECL(mac_create_nhwindow, (int));
222.  E void FDECL(mac_clear_nhwindow, (winid));
223.  E void FDECL(mac_display_nhwindow, (winid, BOOLEAN_P));
224.  E void FDECL(mac_destroy_nhwindow, (winid));
225.  E void FDECL(mac_curs, (winid,int,int));
226.  E void FDECL(mac_putstr, (winid, int, const char *));
227.  E void FDECL(mac_start_menu, (winid));
228.  E void FDECL(mac_add_menu, (winid,int,const anything *,
229.  		CHAR_P,CHAR_P,int,const char *, BOOLEAN_P));
230.  E void FDECL(mac_end_menu, (winid, const char *));
231.  E int FDECL(mac_select_menu, (winid, int, menu_item **));
232.  #ifdef CLIPPING
233.  E void FDECL(mac_cliparound, (int, int));
234.  #endif
235.  E int NDECL(mac_nhgetch);
236.  E int FDECL(mac_nh_poskey, (int *, int *, int *));
237.  E int NDECL(mac_doprev_message);
238.  E char FDECL(mac_yn_function, (const char *, const char *, CHAR_P));
239.  E void FDECL(mac_getlin, (const char *,char *));
240.  E int NDECL(mac_get_ext_cmd);
241.  E void FDECL(mac_number_pad, (int));
242.  E void NDECL(mac_delay_output);
243.  
244.  #undef E
245.  
246.  #endif /* ! MACWIN_H */