winprocs.h

Go to the documentation of this file.
00001 /*      SCCS Id: @(#)winprocs.h 3.4     2003/01/08      */
00002 /* Copyright (c) David Cohrs, 1992                                */
00003 /* NetHack may be freely redistributed.  See license for details. */
00004 
00005 #ifndef WINPROCS_H
00006 #define WINPROCS_H
00007 
00008 struct window_procs {
00009     const char *name;
00010     unsigned long wincap;       /* window port capability options supported */
00011     unsigned long wincap2;      /* additional window port capability options supported */
00012     void FDECL((*win_init_nhwindows), (int *, char **));
00013     void NDECL((*win_player_selection));
00014     void NDECL((*win_askname));
00015     void NDECL((*win_get_nh_event)) ;
00016     void FDECL((*win_exit_nhwindows), (const char *));
00017     void FDECL((*win_suspend_nhwindows), (const char *));
00018     void NDECL((*win_resume_nhwindows));
00019     winid FDECL((*win_create_nhwindow), (int));
00020     void FDECL((*win_clear_nhwindow), (winid));
00021     void FDECL((*win_display_nhwindow), (winid, BOOLEAN_P));
00022     void FDECL((*win_destroy_nhwindow), (winid));
00023     void FDECL((*win_curs), (winid,int,int));
00024     void FDECL((*win_putstr), (winid, int, const char *));
00025     void FDECL((*win_display_file), (const char *, BOOLEAN_P));
00026     void FDECL((*win_start_menu), (winid));
00027     void FDECL((*win_add_menu), (winid,int,const ANY_P *,
00028                 CHAR_P,CHAR_P,int,const char *, BOOLEAN_P));
00029     void FDECL((*win_end_menu), (winid, const char *));
00030     int FDECL((*win_select_menu), (winid, int, MENU_ITEM_P **));
00031     char FDECL((*win_message_menu), (CHAR_P,int,const char *));
00032     void NDECL((*win_update_inventory));
00033     void NDECL((*win_mark_synch));
00034     void NDECL((*win_wait_synch));
00035 #ifdef CLIPPING
00036     void FDECL((*win_cliparound), (int, int));
00037 #endif
00038 #ifdef POSITIONBAR
00039     void FDECL((*win_update_positionbar), (char *));
00040 #endif
00041     void FDECL((*win_print_glyph), (winid,XCHAR_P,XCHAR_P,int));
00042     void FDECL((*win_raw_print), (const char *));
00043     void FDECL((*win_raw_print_bold), (const char *));
00044     int NDECL((*win_nhgetch));
00045     int FDECL((*win_nh_poskey), (int *, int *, int *));
00046     void NDECL((*win_nhbell));
00047     int NDECL((*win_doprev_message));
00048     char FDECL((*win_yn_function), (const char *, const char *, CHAR_P));
00049     void FDECL((*win_getlin), (const char *,char *));
00050     int NDECL((*win_get_ext_cmd));
00051     void FDECL((*win_number_pad), (int));
00052     void NDECL((*win_delay_output));
00053 #ifdef CHANGE_COLOR
00054     void FDECL((*win_change_color), (int,long,int));
00055 #ifdef MAC
00056     void FDECL((*win_change_background), (int));
00057     short FDECL((*win_set_font_name), (winid, char *));
00058 #endif
00059     char * NDECL((*win_get_color_string));
00060 #endif
00061 
00062     /* other defs that really should go away (they're tty specific) */
00063     void NDECL((*win_start_screen));
00064     void NDECL((*win_end_screen));
00065 
00066     void FDECL((*win_outrip), (winid,int));
00067     void FDECL((*win_preference_update), (const char *));
00068 };
00069 
00070 extern NEARDATA struct window_procs windowprocs;
00071 
00072 /*
00073  * If you wish to only support one window system and not use procedure
00074  * pointers, add the appropriate #ifdef below.
00075  */
00076 
00077 #define init_nhwindows (*windowprocs.win_init_nhwindows)
00078 #define player_selection (*windowprocs.win_player_selection)
00079 #define askname (*windowprocs.win_askname)
00080 #define get_nh_event (*windowprocs.win_get_nh_event)
00081 #define exit_nhwindows (*windowprocs.win_exit_nhwindows)
00082 #define suspend_nhwindows (*windowprocs.win_suspend_nhwindows)
00083 #define resume_nhwindows (*windowprocs.win_resume_nhwindows)
00084 #define create_nhwindow (*windowprocs.win_create_nhwindow)
00085 #define clear_nhwindow (*windowprocs.win_clear_nhwindow)
00086 #define display_nhwindow (*windowprocs.win_display_nhwindow)
00087 #define destroy_nhwindow (*windowprocs.win_destroy_nhwindow)
00088 #define curs (*windowprocs.win_curs)
00089 #define putstr (*windowprocs.win_putstr)
00090 #define display_file (*windowprocs.win_display_file)
00091 #define start_menu (*windowprocs.win_start_menu)
00092 #define add_menu (*windowprocs.win_add_menu)
00093 #define end_menu (*windowprocs.win_end_menu)
00094 #define select_menu (*windowprocs.win_select_menu)
00095 #define message_menu (*windowprocs.win_message_menu)
00096 #define update_inventory (*windowprocs.win_update_inventory)
00097 #define mark_synch (*windowprocs.win_mark_synch)
00098 #define wait_synch (*windowprocs.win_wait_synch)
00099 #ifdef CLIPPING
00100 #define cliparound (*windowprocs.win_cliparound)
00101 #endif
00102 #ifdef POSITIONBAR
00103 #define update_positionbar (*windowprocs.win_update_positionbar)
00104 #endif
00105 #define print_glyph (*windowprocs.win_print_glyph)
00106 #define raw_print (*windowprocs.win_raw_print)
00107 #define raw_print_bold (*windowprocs.win_raw_print_bold)
00108 #define nhgetch (*windowprocs.win_nhgetch)
00109 #define nh_poskey (*windowprocs.win_nh_poskey)
00110 #define nhbell (*windowprocs.win_nhbell)
00111 #define nh_doprev_message (*windowprocs.win_doprev_message)
00112 #define getlin (*windowprocs.win_getlin)
00113 #define get_ext_cmd (*windowprocs.win_get_ext_cmd)
00114 #define number_pad (*windowprocs.win_number_pad)
00115 #define delay_output (*windowprocs.win_delay_output)
00116 #ifdef CHANGE_COLOR
00117 #define change_color (*windowprocs.win_change_color)
00118 #ifdef MAC
00119 #define change_background (*windowprocs.win_change_background)
00120 #define set_font_name (*windowprocs.win_set_font_name)
00121 #endif
00122 #define get_color_string (*windowprocs.win_get_color_string)
00123 #endif
00124 
00125 /* 3.4.2: There is a real yn_function() in the core now, which does
00126  *        some buffer length validation on the parameters prior to
00127  *        invoking the window port routine. yn_function() is in cmd.c
00128  */
00129 /* #define yn_function (*windowprocs.win_yn_function) */
00130 
00131 /* other defs that really should go away (they're tty specific) */
00132 #define start_screen (*windowprocs.win_start_screen)
00133 #define end_screen (*windowprocs.win_end_screen)
00134 
00135 #define outrip (*windowprocs.win_outrip)
00136 #define preference_update (*windowprocs.win_preference_update)
00137 
00138 /*
00139  * WINCAP
00140  * Window port preference capability bits.
00141  * Some day this might be better in its own wincap.h file.
00142  */
00143 #define WC_COLOR         0x01L          /* 01 Port can display things in color       */
00144 #define WC_HILITE_PET    0x02L          /* 02 supports hilite pet                    */
00145 #define WC_ASCII_MAP     0x04L          /* 03 supports an ascii map                  */
00146 #define WC_TILED_MAP     0x08L          /* 04 supports a tiled map                   */
00147 #define WC_PRELOAD_TILES 0x10L          /* 05 supports pre-loading tiles             */
00148 #define WC_TILE_WIDTH    0x20L          /* 06 prefer this width of tile              */
00149 #define WC_TILE_HEIGHT   0x40L          /* 07 prefer this height of tile             */
00150 #define WC_TILE_FILE     0x80L          /* 08 alternative tile file name             */
00151 #define WC_INVERSE       0x100L         /* 09 Port supports inverse video            */
00152 #define WC_ALIGN_MESSAGE 0x200L         /* 10 supports message alignmt top|b|l|r     */
00153 #define WC_ALIGN_STATUS  0x400L         /* 11 supports status alignmt top|b|l|r      */
00154 #define WC_VARY_MSGCOUNT 0x800L         /* 12 supports varying message window        */
00155 #define WC_FONT_MAP      0x1000L        /* 13 supports specification of map win font */
00156 #define WC_FONT_MESSAGE  0x2000L        /* 14 supports specification of msg win font */
00157 #define WC_FONT_STATUS   0x4000L        /* 15 supports specification of sts win font */
00158 #define WC_FONT_MENU     0x8000L        /* 16 supports specification of mnu win font */
00159 #define WC_FONT_TEXT     0x10000L       /* 17 supports specification of txt win font */
00160 #define WC_FONTSIZ_MAP   0x20000L       /* 18 supports specification of map win font */
00161 #define WC_FONTSIZ_MESSAGE 0x40000L     /* 19 supports specification of msg win font */
00162 #define WC_FONTSIZ_STATUS 0x80000L      /* 20 supports specification of sts win font */
00163 #define WC_FONTSIZ_MENU  0x100000L      /* 21 supports specification of mnu win font */
00164 #define WC_FONTSIZ_TEXT  0x200000L      /* 22 supports specification of txt win font */
00165 #define WC_SCROLL_MARGIN 0x400000L      /* 23 supports setting scroll margin for map */
00166 #define WC_SPLASH_SCREEN 0x800000L      /* 24 supports display of splash screen      */
00167 #define WC_POPUP_DIALOG  0x1000000L     /* 25 supports queries in pop dialogs        */
00168 #define WC_SCROLL_AMOUNT 0x2000000L     /* 26 scroll this amount at scroll margin    */
00169 #define WC_EIGHT_BIT_IN  0x4000000L     /* 27 8-bit character input                  */
00170 #define WC_PERM_INVENT   0x8000000L     /* 28 8-bit character input                  */
00171 #define WC_MAP_MODE      0x10000000L    /* 29 map_mode option                        */
00172 #define WC_WINDOWCOLORS  0x20000000L    /* 30 background color for message window    */
00173 #define WC_PLAYER_SELECTION  0x40000000L /* 31 background color for message window    */
00174 #define WC_MOUSE_SUPPORT 0x80000000L    /* 32 mouse support                          */
00175                                         /* no free bits */
00176 
00177 #define WC2_FULLSCREEN          0x01L   /* 01 display full screen                    */
00178 #define WC2_SOFTKEYBOARD        0x02L   /* 02 software keyboard                      */
00179 #define WC2_WRAPTEXT            0x04L   /* 03 wrap long lines of text                */
00180 #define WC2_TERM_COLS           0x08L   /* 04 supports setting terminal width        */
00181 #define WC2_TERM_ROWS           0x10L   /* 05 supports setting terminal height       */
00182 #define WC2_WINDOWBORDERS       0x20L   /* 06 display borders for NetHack windows    */
00183 #define WC2_PETATTR             0x40L   /* 07 attributes for highlight_pet */
00184 #define WC2_GUICOLOR            0x80L   /* 08 attributes for highlight_pet */
00185 #define WC2_NEWCOLORS           0x100L  /* 09 try to use slashem colors              */
00186                                         /* 24 free bits */
00187 
00188 #define ALIGN_LEFT      1
00189 #define ALIGN_RIGHT     2
00190 #define ALIGN_TOP       3
00191 #define ALIGN_BOTTOM    4
00192 
00193 /* player_selection */
00194 #define VIA_DIALOG      0
00195 #define VIA_PROMPTS     1
00196 
00197 /* map_mode settings - deprecated */
00198 #define MAP_MODE_TILES          0
00199 #define MAP_MODE_ASCII4x6       1
00200 #define MAP_MODE_ASCII6x8       2
00201 #define MAP_MODE_ASCII8x8       3
00202 #define MAP_MODE_ASCII16x8      4
00203 #define MAP_MODE_ASCII7x12      5
00204 #define MAP_MODE_ASCII8x12      6
00205 #define MAP_MODE_ASCII16x12     7
00206 #define MAP_MODE_ASCII12x16     8
00207 #define MAP_MODE_ASCII10x18     9
00208 #define MAP_MODE_ASCII_FIT_TO_SCREEN 10
00209 #define MAP_MODE_TILES_FIT_TO_SCREEN 11
00210 
00211 #if 0
00212 #define WC_SND_SOUND     0x01L          /* 01 Port has some sound capabilities       */
00213 #define WC_SND_SPEAKER   0x02L          /* 02 Sound supported via built-in speaker   */
00214 #define WC_SND_STEREO    0x04L          /* 03 Stereo sound supported                 */
00215 #define WC_SND_RAW       0x08L          /* 04 Raw sound supported                    */
00216 #define WC_SND_WAVE      0x10L          /* 05 Wave support                           */
00217 #define WC_SND_MIDI      0x20L          /* 06 Midi support                           */
00218                                         /* 26 free bits */
00219 #endif
00220 
00221 struct wc_Opt {
00222         const char *wc_name;
00223         unsigned long wc_bit;
00224 };
00225 
00226 #endif /* WINPROCS_H */