Source:SLASH'EM 0.0.7E7F2/winGTK.h

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

The latest source code for vanilla NetHack is at Source code.

1.   /*  2.      $Id: winGTK.h,v 1.54 2004/04/10 15:41:21 j_ali Exp $ 3.    */  4.     5.    #ifndef WINGTK_H 6.   #define WINGTK_H 7.    8.    #include   9.    #include   10. 11.  #ifndef WIN32 12.  #define WINGTK_X11		/* X11 libraries are available for our use */ 13.  #ifdef DEBUG 14.  #define MONITOR_XRESOURCES	/* Debugging */ 15.  #endif 16.  #endif 17.   18.   #define GTK_GRAPHICS	/* Needed when building an external interface */ 19.  #ifdef GTKHACK 20.  #define GTK_PROXY 21.  #endif 22.   23.   #ifdef WINGTK_X11 24.  #include   25. #include  26. #ifdef MONITOR_XRESOURCES 27.  #include   28. #endif 29.  #include   30. #endif 31.   32.   #include "hack.h"  33. #include "wintty.h" 34. #include "nhxdr.h" 35. #include "proxycom.h" 36. 37.  #define WINGTK_MENU_IMAGES	/* Pretty images (tiles) in first column */ 38.  #define WINGTK_RADAR		/* Radar map window */ 39.   40.   #define NHW_NONE 0		/* Unallocated window type. Must be	*/ 41.  				/* different from any other NHW_* type. */ 42.    43.   #define PROXY_CLNT_LOGGED 0x80000000UL	/* Unallocated proxy clnt flag. */ 44.    45.   #define	NH_PAD			5 46.   47.   #define NH_SESSION_RESIZABLE	1    /* Allow the user to resize window */ 48.  #define NH_SESSION_USER_POS	2    /* Window position from user */ 49.  #define NH_SESSION_USER_SIZE	4    /* Window size from user */ 50.  #define NH_SESSION_PLACED	8    /* Initial window placement has occured */ 51.   52.   struct gtkhackrc; 53.  typedef struct _NhGtkProgressWindow NhGtkProgressWindow; 54.   55.   extern GtkWidget *nh_gtk_window_dialog(boolean is_modal); 56.   57.   extern void nh_gtk_focus_set_master(GtkWindow *w, GtkSignalFunc func,  58.     gpointer data, gboolean use_focus_keys); 59.  extern void nh_gtk_focus_set_slave_for(GtkWindow *w, GtkWindow *slave_for); 60.   61.   extern GtkWidget *nh_session_window_new(const char *name); 62.  extern unsigned long nh_session_window_flags(const char *name); 63.  extern int nh_session_set_geometry(const char *name, int x, int y,  64.     int width, int height); 65.  extern int nh_session_save(struct gtkhackrc *rc); 66.   67.   extern int nh_read_gtkhackrc(void); 68.  extern void nh_write_gtkhackrc(void); 69.  extern void nh_gtkhackrc_store(struct gtkhackrc *rc, const char *fmt, ...); 70.   71.   extern void nh_game_preferences(GtkWidget *w, gpointer data); 72.   73.   extern GtkWidget *nh_gtk_new(GtkWidget *w, GtkWidget *parent, gchar *lbl); 74.  extern GtkWidget *nh_gtk_new_and_add(GtkWidget *w, GtkWidget *parent,  75.     gchar *lbl); 76.  extern GtkWidget *nh_gtk_new_and_pack(GtkWidget *w, GtkWidget *parent,  77.     gchar *lbl, gboolean a1, gboolean a2, guint a3); 78.  extern GtkWidget *nh_gtk_new_and_attach(GtkWidget *w, GtkWidget *parent,  79.     gchar *lbl, guint a1, guint a2, guint a3, guint a4); 80.  extern GtkWidget *nh_gtk_new_and_attach2(GtkWidget *w, GtkWidget *parent,  81.     gchar *lbl, guint a1, guint a2, guint a3, guint a4,  82.     GtkAttachOptions xoptions, GtkAttachOptions yoptions,  83.     guint xpadding, guint ypadding); 84.   85.   #define		N_NH_COLORS	(CLR_MAX + 3) 86.  extern GdkColor  nh_color[N_NH_COLORS]; 87.   88.   enum { 89.      MAP_DARK_GREEN = CLR_MAX, 90.      MAP_BLACK, 91.      MAP_WHITE 92.  };  93.    94.   extern GtkWidget *main_window; 95.   96.   #define	NH_BUFSIZ		4096 97.  #define NH_TEXT_REMEMBER	4096 98.   99.   enum xshm_map_mode { 100.     XSHM_MAP_NONE, 101.     XSHM_MAP_IMAGE, 102.     XSHM_MAP_PIXMAP, 103.     XSHM_MAP_PIXBUF 104. };  105.   106.  extern struct window_ext_procs GTK_ext_procs; 107.  108.  extern void win_GTK_init(void); 109. extern void GTK_init_nhwindows(char ***capvp); 110. extern void GTK_init_gtk(int *argc, char **argv); 111. extern int GTK_ext_init_nhwindows(int *, char **, char ***); 112. extern char *GTK_ext_askname(void); 113. extern int GTK_ext_player_selection(int *, int *, int *, int *); 114. extern int nh_set_help_font(gchar *name); 115. #ifdef GTKHACK 116. extern int nh_help_save(struct gtkhackrc *rc); 117. #endif 118. extern void GTK_ext_display_file(int fh); 119. extern void GTK_ext_add_menu(winid, int, int, CHAR_P, CHAR_P, int,  120.    const char *, BOOLEAN_P); 121. extern int GTK_ext_select_menu(winid, int, struct proxy_mi **); 122. extern void GTK_ext_print_glyph(winid id, int x, int y, int glyph); 123. extern void GTK_ext_print_glyph_layered(winid id, int nl,  124.    struct proxy_glyph_layer *layers); 125. extern char GTK_ext_yn_function(const char *, const char *, CHAR_P, int *); 126. extern int GTK_ext_outrip(winid, char *); 127. extern char *GTK_getline(const char *query, boolean cancelable); 128. extern char *GTK_ext_getlin(const char *query); 129. extern void GTK_get_nh_event(void); 130. extern void GTK_exit_nhwindows(const char *); 131. extern void GTK_suspend_nhwindows(void); 132. extern void GTK_resume_nhwindows(void); 133. extern winid GTK_create_nhwindow(int); 134. extern void GTK_ext_clear_nhwindow(winid, int, int, int); 135. extern void GTK_display_nhwindow(winid, BOOLEAN_P); 136. extern void GTK_destroy_nhwindow(winid); 137. extern void GTK_curs(winid, int, int); 138. extern void GTK_putstr(winid, int, const char *); 139. extern void GTK_start_menu(winid); 140. extern void GTK_end_menu(winid, const char *); 141. extern void GTK_update_inventory(void); 142. extern void GTK_mark_synch(void); 143. extern void GTK_wait_synch(void); 144. #ifdef CLIPPING 145. extern void GTK_cliparound(int, int); 146. #endif 147. extern int GTK_nhgetch(void); 148. extern int GTK_nh_poskey(int *, int *, int *); 149. extern void GTK_nhbell(void); 150. extern int GTK_doprev_message(void); 151. extern void GTK_extcmd_set(int cmd); 152. extern int GTK_get_ext_cmd(void); 153. extern void GTK_number_pad(int); 154. extern void GTK_delay_output(void); 155. extern void GTK_start_screen(void); 156. extern void GTK_end_screen(void); 157. extern void GTK_raw_print(const char *); 158. extern void GTK_raw_print_bold(const char *); 159. extern void GTK_ext_preference_update(const char *, const char *); 160. #ifdef GTKHACK 161. extern void GTK_ext_send_config_file(int); 162. #endif 163.  164.  extern GdkPixmap *GTK_glyph_to_gdkpixmap(int); 165.  166.  extern GtkWidget *nh_map_new(GtkWidget *); 167. extern void nh_map_destroy(void); 168. extern void nh_map_clear(int, int, int); 169. extern void nh_map_check_visibility(void); 170. extern void nh_map_pos(int *, int *, int *); 171. extern void nh_map_click(int); 172. extern void nh_map_flush(void); 173. extern void nh_map_color_changed(boolean); 174. extern void nh_map_hilite_pet_changed(boolean); 175. extern int nh_set_map_visual(int); 176. extern int nh_set_map_font(gchar *name); 177. extern gchar *nh_get_map_font(void); 178. extern int nh_get_map_visual(void); 179. extern int nh_check_map_visual(int); 180.  181.  extern GtkWidget *GTK_preferences_new(void); 182.  183.  extern int main_hook(int *watch); 184. extern void quit_hook(void); 185. extern gint GTK_default_key_press(GtkWidget *widget, GdkEventKey *event,  186.    gpointer data); 187. extern gint GTK_default_focus_in(GtkWidget *widget, GdkEventFocus *event,  188.    gpointer data); 189.  190.  extern GtkWidget *nh_radar_new(void); 191. extern boolean nh_radar_get_use(void); 192. extern void nh_radar_set_use(boolean use); 193. extern void nh_radar_update(void); 194.  195.  extern GtkWidget *nh_message_new(void); 196. extern void nh_message_destroy(void); 197. extern void nh_message_putstr(const char *); 198.  199.  extern GtkWidget *nh_status_new(void); 200. extern boolean nh_status_in_trouble(void); 201. extern char *nh_status_last_displayed(char *quan); 202. extern void GTK_ext_status(int, int, const char **); 203.  204.  extern int nh_keysym(GdkEventKey *ev); 205. extern int nh_dir_keysym(GdkEventKey *ev); 206.  207.  extern void nh_option_new(void); 208. extern void nh_option_lock(boolean); 209. extern int nh_option_cache_sync(void); 210. extern void nh_option_cache_set(char *option, const char *value); 211. extern void nh_option_cache_set_bool(char *option, boolean value); 212. extern void nh_option_cache_set_addr(char *option, char **addr); 213. extern void nh_option_cache_set_bool_addr(char *option, boolean *addr); 214. extern void nh_option_cache_set_callback(char *, void (*)(char *)); 215. extern void nh_option_cache_set_bool_callback(char *, void (*)(boolean)); 216. extern char *nh_option_cache_get(char *option); 217. extern boolean nh_option_cache_get_bool(char *option); 218.  219.  #ifdef GTK_PROXY 220. extern struct proxycb_get_glyph_mapping_res * 221.     nh_proxy_cache_get_glyph_mapping(GtkWidget *progress_window); 222. extern char *nh_proxy_cache_dlbh_fmd5sum(const char *name); 223. extern void nh_proxy_cache_set_dir(const char *dir); 224. extern int nh_proxy_cache_save(struct gtkhackrc *rc); 225. extern char *nh_proxy_cache_file(const char *class, const char *name); 226. extern void nh_proxy_cache_mkdir(const char *class, const char *name); 227. extern char *nh_proxy_game_cache_file(const char *name); 228. extern NhExtIO *GTK_io_open(const char *filename, unsigned int flags); 229. extern int GTK_io_close(NhExtIO *io); 230. #endif 231.  232.  extern int nh_dlbh_fopen(const char *class, const char *name, const char *mode); 233. extern int nh_dlbh_fclose(int fh); 234. extern char *nh_dlbh_fgets(char *buf, int len, int fh); 235. extern int nh_dlbh_fread(char *buf, int size, int quan, int fh); 236. extern int nh_dlbh_fseek(int fh, long pos, int whence); 237. extern int nh_dlbh_ftell(int fh); 238.  239.  extern int nh_tile_height; 240. extern int nh_tile_3dheight; 241.  242.  extern void nh_position_popup_dialog(GtkWidget *w); 243. /*  244.   * topten.c  245. */ 246.  extern int create_toptenwin; 247.  248.  struct cached_options { 249.     boolean num_pad; 250.     boolean use_color; 251.     boolean hilite_pet; 252.     boolean perm_invent; 253. } copts; 254.  255.  struct menu { 256.     GtkCList *clist; 257.     const char *prompt; 258.     struct _NHMenuItem *nhMenuItem; 259.     int alloc_menuitem; 260.     int n_menuitem; 261.     int c_menuitem; 262. };  263.   264.  struct menu_info_t { 265.     struct menu	curr_menu;		/* Menu being displayed. */ 266.      struct menu	new_menu;		/* New menu being built. */ 267.      /*  268.       * cancelled may take the following values: 269.      *	0	Menu window is blocking on user input 270.      *	1	Menu window is being torn down 271.      *	-1	Menu window is non-blocking 272.      */  273.      int cancelled; 274.     int n_select; 275.     int selmode; 276.     int keysym; 277.     int valid_widgets; 278.     long count;				/* Pending count */ 279. #ifdef WINGTK_MENU_IMAGES 280.     int	 pixmaps;			/* Set if any pixmaps set in clist */ 281. #endif 282. };  283.   284.  #ifdef md5_INCLUDED 285. struct text_info_t { 286.     md5_state_t md5_state; 287.     GtkTextBuffer *buffer; 288. };  289.  #endif 290.  291.  #define NHWF_DISPLAYED		1 292.  293.  typedef struct _NHWindow{ 294.     int type; 295.     unsigned flags; 296.  297.      guint hid; 298.     GtkWidget *w; 299.     GtkWidget *hbox, *hbox2, *hbox3; 300.     GtkWidget *vbox; 301.     GtkWidget *clist; 302.     GtkWidget *scrolled, *scrolled2; 303.  304.      GtkWidget *frame; 305.  306.      GtkAdjustment *adj, *adj2; 307.  308.      int	n_button; 309.     GtkWidget *button[20]; 310.  311.      union { 312. 	struct menu_info_t *Menu_info;	/* menu window info */ 313. 	struct text_info_t *Text_info;	/* text window info */ 314.     } Win_info; 315.  316.  } NHWindow; 317.  318.  /* Defines to use for the window information union. */ 319.  #define menu_information   Win_info.Menu_info 320. #define text_information   Win_info.Text_info 321.  322.  #ifdef md5_INCLUDED 323. /* This linked list describes non-blocking text windows which may have no  324. * corresponding NetHack window (ie., the game has called destroy_nhwindow). 325.  */  326.  extern struct nbtw { 327.     GtkWidget *w; 328.     md5_byte_t digest[16];		/* MD5 checksum of window contents */ 329.     struct nbtw *next; 330. } *non_blocking_text_windows; 331. #endif 332.  333.  typedef struct _TileTab{ 334.     char *ident; 335.     char *file; 336. #ifdef GTK_PROXY 337.     char *mapfile; 338. #endif 339.     int tilemap_width, tilemap_height; 340.     int unit_width, unit_height; 341.  342.      int ofsetx_3d; 343.     int ofsety_3d; 344.  345.      int transparent:1; 346.     int spread:1; 347.  348.      void *data; 349. } TileTab; 350. extern TileTab tileTab[]; 351. extern int no_tileTab; 352. extern int stone_tile; 353.  354.  #ifdef GTK_PROXY 355. #undef NO_GLYPH 356. extern int no_glyph; 357. #define NO_GLYPH no_glyph 358. #endif 359.  360.  extern GtkWidget *xshm_map_init(enum xshm_map_mode, int width, int height); 361. extern void xshm_map_button_handler(GtkSignalFunc func, gpointer data); 362. extern void xshm_map_flush; 363. extern void xshm_map_cliparound(int x, int y); 364. extern void xshm_map_destroy; 365. extern void xshm_map_clear; 366. extern void xshm_map_tile_draw(int dst_x, int dst_y); 367. extern void xshm_map_draw(GdkRectangle *rect); 368. extern void xshm_map_draw_image(GdkImage *src, int src_x, int src_y,  369.    int dest_x, int dest_y, int width, int height); 370. extern void xshm_map_draw_drawable(GdkDrawable *src, int src_x, int src_y,  371.    int dest_x, int dest_y, int width, int height); 372. extern GtkAdjustment *xshm_map_get_hadjustment(void); 373. extern GtkAdjustment *xshm_map_get_vadjustment(void); 374. extern void x_tile_init_add_stages(TileTab *t, NhGtkProgressWindow *w); 375. extern enum xshm_map_mode x_tile_init(TileTab *t, NhGtkProgressWindow *w); 376. extern void x_tile_tmp_clear; 377. extern int x_tile_render_to_drawable(GdkDrawable *drawable, GdkGC *gc,  378.    int tile, int src_x, int src_y, int dest_x, int dest_y,  379.    int width, int height); 380. extern void x_tile_draw_rectangle(int dstx, int dsty, GdkColor *c); 381. extern void x_tile_draw_tile(int tile, int dstx, int dsty); 382. extern void x_tile_draw_tmp(int dstx, int dsty); 383. extern void x_tile_tmp_draw_tile(int tile, int ofsx, int ofsy); 384. extern void x_tile_tmp_draw_rectangle(int ofsx, int ofsy, int c); 385. extern void x_tile_destroy; 386.  387.  /*  388.   * These must agree with the table in gtkextcmd.c -ALI 389.  */  390.   391.  #define EXT_CMD_ADJUST		0 392. #define EXT_CMD_BORROW		1 393. #define EXT_CMD_CHAT		2 394. #define EXT_CMD_CONDUCT		3 395. #define EXT_CMD_DIP		4 396. #define EXT_CMD_ENHANCE		5 397. #define EXT_CMD_EXPLORE		6 398. #define EXT_CMD_FORCE		7 399. #define EXT_CMD_INVOKE		8 400. #define EXT_CMD_JUMP		9 401. #define EXT_CMD_LOOT		10 402. #define EXT_CMD_MONSTER		11 403. #define EXT_CMD_NAME		12 404. #define EXT_CMD_OFFER		13 405. #define EXT_CMD_PRAY		14 406. #define EXT_CMD_QUIT		15 407. #define EXT_CMD_RIDE		16 408. #define EXT_CMD_RUB		17 409. #define EXT_CMD_SIT		18 410. #define EXT_CMD_TECHNIQUE	19 411. #define EXT_CMD_TURN		20 412. #define EXT_CMD_TWOWEAPON	21 413. #define EXT_CMD_UNTRAP		22 414. #define EXT_CMD_VERSION		23 415. #define EXT_CMD_WIPE		24 416. #define EXT_CMD_YOUPOLY		25 417.  418.  #define NO_EXT_CMD_MAPS		26 419.  420.  /* Current Map Mode */ 421. extern int map_visual; 422.  423.  /* Current Map Clipping Squared distance */ 424. extern int map_clip_dist2; 425.  426.  /* Current map cursor position */ 427. extern int cursx, cursy; 428.  429.  /* Xshm map rasters. Warning: only one of these will be valid */ 430. extern GdkImage *xshm_map_image; 431. extern GdkPixmap *xshm_map_pixmap; 432. extern GdkPixbuf *xshm_map_pixbuf; 433.  434.  #if defined(MONITOR_HEAP) && defined(INTERNAL_MALLOC) 435. #define XCreatePixmap(dpy, root, width, height, depth) \ 436. 	(monitor_heap_push(__FILE__, __LINE__), \  437.  	monitor_heap_pop(__FILE__, __LINE__, \ 438. 	  (XCreatePixmap)(dpy, root, width, height, depth))) 439. #define gdk_pixmap_new(w, width, height, depth) \ 440. 	(GdkPixmap *)(monitor_heap_push(__FILE__, __LINE__), \  441.  	monitor_heap_pop(__FILE__, __LINE__, \ 442. 	  (unsigned long)(gdk_pixmap_new)(w, width, height, depth))) 443. #define gdk_image_new(type, visual, width, height) \ 444. 	(GdkImage *)(monitor_heap_push(__FILE__, __LINE__), \  445.  	monitor_heap_pop(__FILE__, __LINE__, \ 446. 	  (unsigned long)(gdk_image_new)(type, visual, width, height))) 447. #define gtk_window_new(type) \ 448. 	(GtkWidget *)(monitor_heap_push(__FILE__, __LINE__), \  449.  	monitor_heap_pop(__FILE__, __LINE__, \ 450. 	  (unsigned long)(gtk_window_new)(type))) 451. #define gtk_hbox_new(homogeneous, spacing) \ 452. 	(GtkWidget *)(monitor_heap_push(__FILE__, __LINE__), \  453.  	monitor_heap_pop(__FILE__, __LINE__, \ 454. 	  (unsigned long)(gtk_hbox_new)(homogeneous, spacing))) 455. #define gtk_vbox_new(homogeneous, spacing) \ 456. 	(GtkWidget *)(monitor_heap_push(__FILE__, __LINE__), \  457.  	monitor_heap_pop(__FILE__, __LINE__, \ 458. 	  (unsigned long)(gtk_vbox_new)(homogeneous, spacing))) 459. #define gtk_clist_new(columns) \ 460. 	(GtkWidget *)(monitor_heap_push(__FILE__, __LINE__), \  461.  	monitor_heap_pop(__FILE__, __LINE__, \ 462. 	  (unsigned long)(gtk_clist_new)(columns))) 463. #endif 464.  465.  #ifndef GTKHACK 466. #define nh_strncmpi	strncmpi 467. #endif 468.  469.  #ifdef GTKHACK 470. enum { 471.     COLUMN_NAME, 472.     COLUMN_SCHEME, 473.     COLUMN_ADDRESS, 474.     COLUMN_FLAGS, 475.     N_COLUMNS 476. };  477.   478.  extern GtkTreeRowReference *GTK_default_connection, *GTK_current_connection; 479. extern GtkListStore *GTK_connections; 480. extern GtkTextBuffer *GTK_nhext_log; 481.  482.  extern GtkTreeRowReference *GTK_connection_lookup(const char *name); 483. extern void GTK_connection_set_default(const char *name); 484. extern void GTK_connection_add(const char *name, const char *scheme,  485.    const char *address, unsigned long flags); 486. extern void gtkhack_enable_logging(gboolean setting); 487. extern GtkWidget *GTK_troubleshooting_new(void); 488. #endif 489.  490.  #endif	/* WINGTK_H */