8c3cd914 |
1 | /* |
2 | * winstuff.h: Windows-specific inter-module stuff. |
3 | */ |
4 | |
f7f27309 |
5 | #ifndef PUTTY_WINSTUFF_H |
6 | #define PUTTY_WINSTUFF_H |
7 | |
8c3cd914 |
8 | /* |
9 | * Global variables. Most modules declare these `extern', but |
10 | * window.c will do `#define PUTTY_DO_GLOBALS' before including this |
11 | * module, and so will get them properly defined. |
12 | */ |
f7f27309 |
13 | #ifndef GLOBAL |
8c3cd914 |
14 | #ifdef PUTTY_DO_GLOBALS |
15 | #define GLOBAL |
16 | #else |
17 | #define GLOBAL extern |
18 | #endif |
f7f27309 |
19 | #endif |
20 | |
a8327734 |
21 | #ifndef DONE_TYPEDEFS |
22 | #define DONE_TYPEDEFS |
23 | typedef struct config_tag Config; |
24 | typedef struct backend_tag Backend; |
25 | typedef struct terminal_tag Terminal; |
26 | #endif |
27 | |
f7f27309 |
28 | #define PUTTY_REG_POS "Software\\SimonTatham\\PuTTY" |
29 | #define PUTTY_REG_PARENT "Software\\SimonTatham" |
30 | #define PUTTY_REG_PARENT_CHILD "PuTTY" |
31 | #define PUTTY_REG_GPARENT "Software" |
32 | #define PUTTY_REG_GPARENT_CHILD "SimonTatham" |
33 | |
34 | #define GETTICKCOUNT GetTickCount |
35 | #define CURSORBLINK GetCaretBlinkTime() |
36 | #define TICKSPERSEC 1000 /* GetTickCount returns milliseconds */ |
37 | |
38 | #define DEFAULT_CODEPAGE CP_ACP |
39 | |
40 | typedef HDC Context; |
8c3cd914 |
41 | |
f7f27309 |
42 | /* |
43 | * Window handles for the dialog boxes that can be running during a |
44 | * PuTTY session. |
45 | */ |
46 | GLOBAL HWND logbox; |
47 | |
48 | /* |
49 | * The all-important instance handle. |
50 | */ |
8c3cd914 |
51 | GLOBAL HINSTANCE hinst; |
52 | |
53 | /* |
6b78788a |
54 | * Details of the help file. |
55 | */ |
56 | GLOBAL char *help_path; |
57 | GLOBAL int help_has_contents; |
58 | |
59 | /* |
a8327734 |
60 | * The terminal and logging context are notionally local to the |
61 | * Windows front end, but they must be shared between window.c and |
0b4f0bc0 |
62 | * windlg.c. Likewise the saved-sessions list. |
a8327734 |
63 | */ |
64 | GLOBAL Terminal *term; |
65 | GLOBAL void *logctx; |
66 | |
67 | /* |
f7f27309 |
68 | * I've just looked in the windows standard headr files for WM_USER, there |
69 | * are hundreds of flags defined using the form WM_USER+123 so I've |
70 | * renumbered this NETEVENT value and the two in window.c |
71 | */ |
72 | #define WM_XUSER (WM_USER + 0x2000) |
73 | #define WM_NETEVENT (WM_XUSER + 5) |
74 | |
75 | /* |
e6346999 |
76 | * On Windows, we send MA_2CLK as the only event marking the second |
77 | * press of a mouse button. Compare unix.h. |
78 | */ |
79 | #define MULTICLICK_ONLY_EVENT 1 |
80 | |
81 | /* |
82 | * On Windows, data written to the clipboard must be NUL-terminated. |
83 | */ |
84 | #define SELECTION_NUL_TERMINATED 1 |
85 | |
86 | /* |
0f351587 |
87 | * On Windows, copying to the clipboard terminates lines with CRLF. |
88 | */ |
89 | #define SEL_NL { 13, 10 } |
90 | |
91 | /* |
2f92b717 |
92 | * sk_getxdmdata() does not exist under Windows (not that I |
93 | * couldn't write it if I wanted to, but I haven't bothered), so |
94 | * it's a macro which always returns FALSE. With any luck this will |
95 | * cause the compiler to notice it can optimise away the |
96 | * implementation of XDM-AUTHORIZATION-1 in x11fwd.c :-) |
97 | */ |
98 | #define sk_getxdmdata(socket, ip, port) (0) |
99 | |
100 | /* |
8c3cd914 |
101 | * Exports from winctrls.c. |
102 | */ |
103 | |
104 | struct ctlpos { |
105 | HWND hwnd; |
106 | WPARAM font; |
107 | int dlu4inpix; |
108 | int ypos, width; |
109 | int xoff; |
3ac9cd9f |
110 | int boxystart, boxid; |
8c3cd914 |
111 | char *boxtext; |
112 | }; |
113 | |
ca20bfcf |
114 | /* |
c0a81592 |
115 | * Exports from winutils.c. |
116 | */ |
d3a1a808 |
117 | void split_into_argv(char *, int *, char ***, char ***); |
c0a81592 |
118 | |
119 | /* |
ca20bfcf |
120 | * Private structure for prefslist state. Only in the header file |
121 | * so that we can delegate allocation to callers. |
122 | */ |
123 | struct prefslist { |
124 | int listid, upbid, dnbid; |
125 | int srcitem; |
126 | int dummyitem; |
127 | int dragging; |
128 | }; |
129 | |
f7f27309 |
130 | /* |
131 | * Exports from winctrls.c. |
132 | */ |
8c3cd914 |
133 | void ctlposinit(struct ctlpos *cp, HWND hwnd, |
32874aea |
134 | int leftborder, int rightborder, int topborder); |
ca20bfcf |
135 | HWND doctl(struct ctlpos *cp, RECT r, |
32874aea |
136 | char *wclass, int wstyle, int exstyle, char *wtext, int wid); |
8c3cd914 |
137 | void bartitle(struct ctlpos *cp, char *name, int id); |
3ac9cd9f |
138 | void beginbox(struct ctlpos *cp, char *name, int idbox); |
8c3cd914 |
139 | void endbox(struct ctlpos *cp); |
140 | void multiedit(struct ctlpos *cp, ...); |
32874aea |
141 | void radioline(struct ctlpos *cp, char *text, int id, int nacross, ...); |
d74d141c |
142 | void bareradioline(struct ctlpos *cp, int nacross, ...); |
8c3cd914 |
143 | void radiobig(struct ctlpos *cp, char *text, int id, ...); |
144 | void checkbox(struct ctlpos *cp, char *text, int id); |
66ee282a |
145 | void statictext(struct ctlpos *cp, char *text, int lines, int id); |
8c3cd914 |
146 | void staticbtn(struct ctlpos *cp, char *stext, int sid, |
32874aea |
147 | char *btext, int bid); |
af282e3b |
148 | void static2btn(struct ctlpos *cp, char *stext, int sid, |
149 | char *btext1, int bid1, char *btext2, int bid2); |
8c3cd914 |
150 | void staticedit(struct ctlpos *cp, char *stext, |
32874aea |
151 | int sid, int eid, int percentedit); |
2c9c6388 |
152 | void staticddl(struct ctlpos *cp, char *stext, |
153 | int sid, int lid, int percentlist); |
b8ae1f0f |
154 | void combobox(struct ctlpos *cp, char *text, int staticid, int listid); |
6e522441 |
155 | void staticpassedit(struct ctlpos *cp, char *stext, |
32874aea |
156 | int sid, int eid, int percentedit); |
6e522441 |
157 | void bigeditctrl(struct ctlpos *cp, char *stext, |
32874aea |
158 | int sid, int eid, int lines); |
159 | void ersatztab(struct ctlpos *cp, char *stext, int sid, int lid, int s2id); |
8c3cd914 |
160 | void editbutton(struct ctlpos *cp, char *stext, int sid, |
32874aea |
161 | int eid, char *btext, int bid); |
8c3cd914 |
162 | void sesssaver(struct ctlpos *cp, char *text, |
32874aea |
163 | int staticid, int editid, int listid, ...); |
8c3cd914 |
164 | void envsetter(struct ctlpos *cp, char *stext, int sid, |
32874aea |
165 | char *e1stext, int e1sid, int e1id, |
166 | char *e2stext, int e2sid, int e2id, |
167 | int listid, char *b1text, int b1id, char *b2text, int b2id); |
8c3cd914 |
168 | void charclass(struct ctlpos *cp, char *stext, int sid, int listid, |
32874aea |
169 | char *btext, int bid, int eid, char *s2text, int s2id); |
8c3cd914 |
170 | void colouredit(struct ctlpos *cp, char *stext, int sid, int listid, |
32874aea |
171 | char *btext, int bid, ...); |
ca20bfcf |
172 | void prefslist(struct prefslist *hdl, struct ctlpos *cp, char *stext, |
173 | int sid, int listid, int upbid, int dnbid); |
174 | int handle_prefslist(struct prefslist *hdl, |
175 | int *array, int maxmemb, |
176 | int is_dlmsg, HWND hwnd, |
177 | WPARAM wParam, LPARAM lParam); |
6e522441 |
178 | void progressbar(struct ctlpos *cp, int id); |
d74d141c |
179 | void fwdsetter(struct ctlpos *cp, int listid, char *stext, int sid, |
180 | char *e1stext, int e1sid, int e1id, |
181 | char *e2stext, int e2sid, int e2id, |
a4b92c62 |
182 | char *btext, int bid, |
183 | char *r1text, int r1id, char *r2text, int r2id); |
f7f27309 |
184 | |
185 | /* |
186 | * Exports from windlg.c. |
187 | */ |
188 | void defuse_showwindow(void); |
189 | int do_config(void); |
190 | int do_reconfig(HWND); |
f7f27309 |
191 | void showeventlog(HWND); |
192 | void showabout(HWND); |
f7f27309 |
193 | void force_normal(HWND hwnd); |
194 | |
f7f27309 |
195 | /* |
196 | * Exports from sizetip.c. |
197 | */ |
198 | void UpdateSizeTip(HWND src, int cx, int cy); |
199 | void EnableSizeTip(int bEnable); |
200 | |
facd762c |
201 | /* |
202 | * Exports from unicode.c. |
203 | */ |
07b2a9cd |
204 | struct unicode_data; |
21d2b241 |
205 | void init_ucs(Config *, struct unicode_data *); |
facd762c |
206 | |
f7f27309 |
207 | #endif |