1 /* NetHack 3.6 winMS.h $NHDT-Date: 1433806609 2015/06/08 23:36:49 $ $NHDT-Branch: master $:$NHDT-Revision: 1.29 $ */ 2 /* Copyright (C) 2001 by Alex Kompel */ 3 /* NetHack may be freely redistributed. See license for details. */ 4 5 #ifndef WINMS_H 6 #define WINMS_H 7 8 #pragma warning(disable : 4142) /* benign redefinition of type */ 9 10 #define WIN32_LEAN_AND_MEAN 11 #include <windows.h> 12 #include <commctrl.h> 13 #include <tchar.h> 14 #include <newres.h> 15 #include "resource.h" 16 #include "hack.h" 17 18 #if defined(WIN_CE_POCKETPC) 19 #include <aygshell.h> 20 #include <sipapi.h> 21 #endif 22 23 #if defined(WIN_CE_SMARTPHONE) 24 #include <aygshell.h> 25 #include <sipapi.h> 26 #include <shlobj.h> 27 #include <prsht.h> 28 #include <Tpcshell.h> 29 #include <windowsm.h> 30 #include <KEYBD.H> 31 #endif 32 33 #if defined(WIN_CE_PS2xx) || defined(WIN32_PLATFORM_HPCPRO) 34 #include <sipapi.h> 35 #endif 36 37 /* Taskbar Menu height */ 38 #define MENU_HEIGHT 26 39 40 /* Create an array to keep track of the various windows */ 41 42 #ifndef MAXWINDOWS 43 #define MAXWINDOWS 15 44 #endif 45 46 /* RIP window ID */ 47 #define NHW_RIP 32 48 #define NHW_KEYPAD 33 49 50 /* size of tiles */ 51 #ifndef TILE_X 52 #define TILE_X 16 53 #endif 54 #define TILE_Y 16 55 56 /* tiles per line in the bitmap */ 57 #define TILES_PER_LINE 40 58 59 /* tile background color */ 60 #define TILE_BK_COLOR RGB(71, 108, 108) 61 62 /* minimum/maximum font size (in points - 1/72 inch) */ 63 #define NHFONT_DEFAULT_SIZE 9 64 #define NHFONT_STATUS_DEFAULT_SIZE 6 65 #define NHFONT_SIZE_MIN 3 66 #define NHFONT_SIZE_MAX 20 67 68 typedef struct mswin_nhwindow_data { 69 HWND win; 70 int type; 71 int dead; 72 } MSNHWinData, *PMSNHWinData; 73 74 /* global application data - alailable thour GetNHApp() */ 75 typedef struct mswin_nhwindow_app { 76 HINSTANCE hApp; /* hInstance from WinMain */ 77 int nCmdShow; /* main window mode flag */ 78 HWND hMainWnd; /* main window handle */ 79 HACCEL hAccelTable; /* accelerator table */ 80 HWND hPopupWnd; /* active dialog window (nethack menu, text, etc) */ 81 HWND hMenuBar; /* menu bar */ 82 83 MSNHWinData windowlist[MAXWINDOWS]; /* nethack windows array */ 84 85 HBITMAP bmpTiles; /* nethack tiles */ 86 HBITMAP bmpPetMark; /* pet mark Bitmap */ 87 HBITMAP bmpMapTiles; /* alternative map tiles */ 88 int mapTile_X; /* alt. tiles width */ 89 int mapTile_Y; /* alt. tiles height */ 90 int mapTilesPerLine; /* number of tile per row in the bitmap */ 91 92 boolean bNoHScroll; /* disable cliparound for horizontal grid (map) */ 93 boolean bNoVScroll; /* disable cliparound for vertical grid (map) */ 94 95 int mapDisplayModeSave; /* saved map display mode */ 96 97 int bCmdPad; /* command pad - on-screen keyboard */ 98 HWND hCmdWnd; /* handle of on-screen keyboard window */ 99 100 /* options */ 101 boolean bWrapText; /* format text to fit the window */ 102 boolean bFullScreen; /* run nethack in full-screen mode */ 103 boolean bHideScrollBars; /* hide scroll bars */ 104 boolean bUseSIP; /* use SIP (built-in software keyboard) for menus 105 (PocketPC only) */ 106 } NHWinApp, *PNHWinApp; 107 extern PNHWinApp GetNHApp(); 108 109 #define E extern 110 111 E struct window_procs mswin_procs; 112 113 #undef E 114 115 /* Some prototypes */ 116 void mswin_init_nhwindows(int *argc, char **argv); 117 void mswin_player_selection(void); 118 void mswin_askname(void); 119 void mswin_get_nh_event(void); 120 void mswin_exit_nhwindows(const char *); 121 void mswin_suspend_nhwindows(const char *); 122 void mswin_resume_nhwindows(void); 123 winid mswin_create_nhwindow(int type); 124 void mswin_clear_nhwindow(winid wid); 125 void mswin_display_nhwindow(winid wid, BOOLEAN_P block); 126 void mswin_destroy_nhwindow(winid wid); 127 void mswin_curs(winid wid, int x, int y); 128 void mswin_putstr(winid wid, int attr, const char *text); 129 void mswin_putstr_ex(winid wid, int attr, const char *text, boolean append); 130 void mswin_display_file(const char *filename, BOOLEAN_P must_exist); 131 void mswin_start_menu(winid wid, unsigned long); 132 void mswin_add_menu(winid wid, int glyph, const ANY_P *identifier, 133 CHAR_P accelerator, CHAR_P group_accel, int attr, 134 const char *str, unsigned int itemflags); 135 void mswin_end_menu(winid wid, const char *prompt); 136 int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected); 137 void mswin_update_inventory(void); 138 void mswin_mark_synch(void); 139 void mswin_wait_synch(void); 140 void mswin_cliparound(int x, int y); 141 void mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph, int bkglyph); 142 void mswin_raw_print(const char *str); 143 void mswin_raw_print_bold(const char *str); 144 int mswin_nhgetch(void); 145 int mswin_nh_poskey(int *x, int *y, int *mod); 146 void mswin_nhbell(void); 147 int mswin_doprev_message(void); 148 char mswin_yn_function(const char *question, const char *choices, CHAR_P def); 149 void mswin_getlin(const char *question, char *input); 150 int mswin_get_ext_cmd(void); 151 void mswin_number_pad(int state); 152 void mswin_delay_output(void); 153 void mswin_change_color(void); 154 char *mswin_get_color_string(void); 155 void mswin_start_screen(void); 156 void mswin_end_screen(void); 157 void mswin_outrip(winid wid, int how, time_t when); 158 void mswin_preference_update(const char *pref); 159 160 /* helper function */ 161 HWND mswin_hwnd_from_winid(winid wid); 162 winid mswin_winid_from_type(int type); 163 winid mswin_winid_from_handle(HWND hWnd); 164 void mswin_window_mark_dead(winid wid); 165 void bail(const char *mesg); 166 void nhapply_image_transparent(HDC hDC, int x, int y, int width, int height, 167 HDC sourceDC, int s_x, int s_y, int s_width, 168 int s_height, COLORREF cTransparent); 169 void mswin_popup_display(HWND popup, int *done_indicator); 170 void mswin_popup_destroy(HWND popup); 171 172 #if defined(WIN_CE_SMARTPHONE) 173 void NHSPhoneDialogSetup(HWND hDlg, UINT nToolBarId, BOOL is_edit, 174 BOOL is_fullscreen); 175 #endif 176 177 void mswin_read_reg(void); 178 void mswin_destroy_reg(void); 179 void mswin_write_reg(void); 180 181 BOOL mswin_has_keyboard(void); 182 183 void mswin_set_fullscreen(BOOL is_fullscreen); 184 185 extern winid WIN_STATUS; 186 187 #endif /* WINmswin_H */ 188