OSDN Git Service

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