1/*	SCCS Id: @(#)winprocs.h 3.4	2003/01/08	*/
2/* Copyright (c) David Cohrs, 1992				  */
3/* NetHack may be freely redistributed.  See license for details. */
4
5#ifndef WINPROCS_H
6#define WINPROCS_H
7
8struct window_procs {
9    const char *name;
10    unsigned long wincap;	/* window port capability options supported */
11    unsigned long wincap2;	/* additional window port capability options supported */
12    void FDECL((*win_init_nhwindows), (int *, char **));
13    void NDECL((*win_player_selection));
14    void NDECL((*win_askname));
15    void NDECL((*win_get_nh_event)) ;
16    void FDECL((*win_exit_nhwindows), (const char *));
17    void FDECL((*win_suspend_nhwindows), (const char *));
18    void NDECL((*win_resume_nhwindows));
19    winid FDECL((*win_create_nhwindow), (int));
20    void FDECL((*win_clear_nhwindow), (winid));
21    void FDECL((*win_display_nhwindow), (winid, BOOLEAN_P));
22    void FDECL((*win_destroy_nhwindow), (winid));
23    void FDECL((*win_curs), (winid,int,int));
24    void FDECL((*win_putstr), (winid, int, const char *));
25    void FDECL((*win_display_file), (const char *, BOOLEAN_P));
26    void FDECL((*win_start_menu), (winid));
27    void FDECL((*win_add_menu), (winid,int,const ANY_P *,
28		CHAR_P,CHAR_P,int,const char *, BOOLEAN_P));
29    void FDECL((*win_end_menu), (winid, const char *));
30    int FDECL((*win_select_menu), (winid, int, MENU_ITEM_P **));
31    char FDECL((*win_message_menu), (CHAR_P,int,const char *));
32    void NDECL((*win_update_inventory));
33    void NDECL((*win_mark_synch));
34    void NDECL((*win_wait_synch));
35#ifdef CLIPPING
36    void FDECL((*win_cliparound), (int, int));
37#endif
38#ifdef POSITIONBAR
39    void FDECL((*win_update_positionbar), (char *));
40#endif
41    void FDECL((*win_print_glyph), (winid,XCHAR_P,XCHAR_P,int));
42    void FDECL((*win_raw_print), (const char *));
43    void FDECL((*win_raw_print_bold), (const char *));
44    int NDECL((*win_nhgetch));
45    int FDECL((*win_nh_poskey), (int *, int *, int *));
46    void NDECL((*win_nhbell));
47    int NDECL((*win_doprev_message));
48    char FDECL((*win_yn_function), (const char *, const char *, CHAR_P));
49    void FDECL((*win_getlin), (const char *,char *));
50    int NDECL((*win_get_ext_cmd));
51    void FDECL((*win_number_pad), (int));
52    void NDECL((*win_delay_output));
53#ifdef CHANGE_COLOR
54    void FDECL((*win_change_color), (int,long,int));
55#ifdef MAC
56    void FDECL((*win_change_background), (int));
57    short FDECL((*win_set_font_name), (winid, char *));
58#endif
59    char * NDECL((*win_get_color_string));
60#endif
61
62    /* other defs that really should go away (they're tty specific) */
63    void NDECL((*win_start_screen));
64    void NDECL((*win_end_screen));
65
66    void FDECL((*win_outrip), (winid,int));
67    void FDECL((*win_preference_update), (const char *));
68};
69
70extern NEARDATA struct window_procs windowprocs;
71
72/*
73 * If you wish to only support one window system and not use procedure
74 * pointers, add the appropriate #ifdef below.
75 */
76
77#define init_nhwindows (*windowprocs.win_init_nhwindows)
78#define player_selection (*windowprocs.win_player_selection)
79#define askname (*windowprocs.win_askname)
80#define get_nh_event (*windowprocs.win_get_nh_event)
81#define exit_nhwindows (*windowprocs.win_exit_nhwindows)
82#define suspend_nhwindows (*windowprocs.win_suspend_nhwindows)
83#define resume_nhwindows (*windowprocs.win_resume_nhwindows)
84#define create_nhwindow (*windowprocs.win_create_nhwindow)
85#define clear_nhwindow (*windowprocs.win_clear_nhwindow)
86#define display_nhwindow (*windowprocs.win_display_nhwindow)
87#define destroy_nhwindow (*windowprocs.win_destroy_nhwindow)
88#define curs (*windowprocs.win_curs)
89#define putstr (*windowprocs.win_putstr)
90#define display_file (*windowprocs.win_display_file)
91#define start_menu (*windowprocs.win_start_menu)
92#define add_menu (*windowprocs.win_add_menu)
93#define end_menu (*windowprocs.win_end_menu)
94#define select_menu (*windowprocs.win_select_menu)
95#define message_menu (*windowprocs.win_message_menu)
96#define update_inventory (*windowprocs.win_update_inventory)
97#define mark_synch (*windowprocs.win_mark_synch)
98#define wait_synch (*windowprocs.win_wait_synch)
99#ifdef CLIPPING
100#define cliparound (*windowprocs.win_cliparound)
101#endif
102#ifdef POSITIONBAR
103#define update_positionbar (*windowprocs.win_update_positionbar)
104#endif
105#define print_glyph (*windowprocs.win_print_glyph)
106#define raw_print (*windowprocs.win_raw_print)
107#define raw_print_bold (*windowprocs.win_raw_print_bold)
108#define nhgetch (*windowprocs.win_nhgetch)
109#define nh_poskey (*windowprocs.win_nh_poskey)
110#define nhbell (*windowprocs.win_nhbell)
111#define nh_doprev_message (*windowprocs.win_doprev_message)
112#define getlin (*windowprocs.win_getlin)
113#define get_ext_cmd (*windowprocs.win_get_ext_cmd)
114#define number_pad (*windowprocs.win_number_pad)
115#define delay_output (*windowprocs.win_delay_output)
116#ifdef CHANGE_COLOR
117#define change_color (*windowprocs.win_change_color)
118#ifdef MAC
119#define change_background (*windowprocs.win_change_background)
120#define set_font_name (*windowprocs.win_set_font_name)
121#endif
122#define get_color_string (*windowprocs.win_get_color_string)
123#endif
124
125/* 3.4.2: There is a real yn_function() in the core now, which does
126 *        some buffer length validation on the parameters prior to
127 *        invoking the window port routine. yn_function() is in cmd.c
128 */
129/* #define yn_function (*windowprocs.win_yn_function) */
130
131/* other defs that really should go away (they're tty specific) */
132#define start_screen (*windowprocs.win_start_screen)
133#define end_screen (*windowprocs.win_end_screen)
134
135#define outrip (*windowprocs.win_outrip)
136#define preference_update (*windowprocs.win_preference_update)
137
138/*
139 * WINCAP
140 * Window port preference capability bits.
141 * Some day this might be better in its own wincap.h file.
142 */
143#define WC_COLOR	 0x01L		/* 01 Port can display things in color       */
144#define WC_HILITE_PET	 0x02L		/* 02 supports hilite pet                    */
145#define WC_ASCII_MAP	 0x04L		/* 03 supports an ascii map                  */
146#define WC_TILED_MAP	 0x08L		/* 04 supports a tiled map                   */
147#define WC_PRELOAD_TILES 0x10L		/* 05 supports pre-loading tiles             */
148#define WC_TILE_WIDTH	 0x20L		/* 06 prefer this width of tile              */
149#define WC_TILE_HEIGHT	 0x40L		/* 07 prefer this height of tile             */
150#define WC_TILE_FILE	 0x80L		/* 08 alternative tile file name             */
151#define WC_INVERSE	 0x100L		/* 09 Port supports inverse video            */
152#define WC_ALIGN_MESSAGE 0x200L		/* 10 supports message alignmt top|b|l|r     */
153#define WC_ALIGN_STATUS	 0x400L		/* 11 supports status alignmt top|b|l|r      */
154#define WC_VARY_MSGCOUNT 0x800L		/* 12 supports varying message window        */
155#define WC_FONT_MAP	 0x1000L	/* 13 supports specification of map win font */
156#define WC_FONT_MESSAGE	 0x2000L	/* 14 supports specification of msg win font */
157#define WC_FONT_STATUS	 0x4000L	/* 15 supports specification of sts win font */
158#define WC_FONT_MENU	 0x8000L	/* 16 supports specification of mnu win font */
159#define WC_FONT_TEXT	 0x10000L	/* 17 supports specification of txt win font */
160#define WC_FONTSIZ_MAP	 0x20000L	/* 18 supports specification of map win font */
161#define WC_FONTSIZ_MESSAGE 0x40000L	/* 19 supports specification of msg win font */
162#define WC_FONTSIZ_STATUS 0x80000L	/* 20 supports specification of sts win font */
163#define WC_FONTSIZ_MENU	 0x100000L	/* 21 supports specification of mnu win font */
164#define WC_FONTSIZ_TEXT	 0x200000L	/* 22 supports specification of txt win font */
165#define WC_SCROLL_MARGIN 0x400000L	/* 23 supports setting scroll margin for map */
166#define WC_SPLASH_SCREEN 0x800000L	/* 24 supports display of splash screen      */
167#define WC_POPUP_DIALOG	 0x1000000L	/* 25 supports queries in pop dialogs        */
168#define WC_SCROLL_AMOUNT 0x2000000L	/* 26 scroll this amount at scroll margin    */
169#define WC_EIGHT_BIT_IN	 0x4000000L	/* 27 8-bit character input                  */
170#define WC_PERM_INVENT	 0x8000000L	/* 28 8-bit character input                  */
171#define WC_MAP_MODE	 0x10000000L	/* 29 map_mode option                        */
172#define WC_WINDOWCOLORS  0x20000000L	/* 30 background color for message window    */
173#define WC_PLAYER_SELECTION  0x40000000L /* 31 background color for message window    */
174#define WC_MOUSE_SUPPORT 0x80000000L	/* 32 mouse support                          */
175					/* no free bits */
176
177#define WC2_FULLSCREEN		0x01L	/* 01 display full screen                    */
178#define WC2_SOFTKEYBOARD	0x02L	/* 02 software keyboard                      */
179#define WC2_WRAPTEXT		0x04L	/* 04 wrap long lines of text                */
180					/* 29 free bits */
181
182#define ALIGN_LEFT	1
183#define ALIGN_RIGHT	2
184#define ALIGN_TOP	3
185#define ALIGN_BOTTOM	4
186
187/* player_selection */
188#define VIA_DIALOG	0
189#define VIA_PROMPTS	1
190
191/* map_mode settings - deprecated */
192#define MAP_MODE_TILES		0
193#define MAP_MODE_ASCII4x6	1
194#define MAP_MODE_ASCII6x8	2
195#define MAP_MODE_ASCII8x8	3
196#define MAP_MODE_ASCII16x8	4
197#define MAP_MODE_ASCII7x12	5
198#define MAP_MODE_ASCII8x12	6
199#define MAP_MODE_ASCII16x12	7
200#define MAP_MODE_ASCII12x16	8
201#define MAP_MODE_ASCII10x18	9
202#define MAP_MODE_ASCII_FIT_TO_SCREEN 10
203#define MAP_MODE_TILES_FIT_TO_SCREEN 11
204
205#if 0
206#define WC_SND_SOUND	 0x01L		/* 01 Port has some sound capabilities       */
207#define WC_SND_SPEAKER	 0x02L		/* 02 Sound supported via built-in speaker   */
208#define WC_SND_STEREO	 0x04L		/* 03 Stereo sound supported                 */
209#define WC_SND_RAW	 0x08L		/* 04 Raw sound supported                    */
210#define WC_SND_WAVE	 0x10L		/* 05 Wave support                           */
211#define WC_SND_MIDI	 0x20L		/* 06 Midi support                           */
212					/* 26 free bits */
213#endif
214
215struct wc_Opt {
216	const char *wc_name;
217	unsigned long wc_bit;
218};
219
220#endif /* WINPROCS_H */
221