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 | |
f7f27309 |
21 | #define PUTTY_REG_POS "Software\\SimonTatham\\PuTTY" |
22 | #define PUTTY_REG_PARENT "Software\\SimonTatham" |
23 | #define PUTTY_REG_PARENT_CHILD "PuTTY" |
24 | #define PUTTY_REG_GPARENT "Software" |
25 | #define PUTTY_REG_GPARENT_CHILD "SimonTatham" |
26 | |
27 | #define GETTICKCOUNT GetTickCount |
28 | #define CURSORBLINK GetCaretBlinkTime() |
29 | #define TICKSPERSEC 1000 /* GetTickCount returns milliseconds */ |
30 | |
31 | #define DEFAULT_CODEPAGE CP_ACP |
32 | |
33 | typedef HDC Context; |
8c3cd914 |
34 | |
f7f27309 |
35 | /* |
36 | * Window handles for the dialog boxes that can be running during a |
37 | * PuTTY session. |
38 | */ |
39 | GLOBAL HWND logbox; |
40 | |
41 | /* |
42 | * The all-important instance handle. |
43 | */ |
8c3cd914 |
44 | GLOBAL HINSTANCE hinst; |
45 | |
46 | /* |
f7f27309 |
47 | * I've just looked in the windows standard headr files for WM_USER, there |
48 | * are hundreds of flags defined using the form WM_USER+123 so I've |
49 | * renumbered this NETEVENT value and the two in window.c |
50 | */ |
51 | #define WM_XUSER (WM_USER + 0x2000) |
52 | #define WM_NETEVENT (WM_XUSER + 5) |
53 | |
54 | /* |
e6346999 |
55 | * On Windows, we send MA_2CLK as the only event marking the second |
56 | * press of a mouse button. Compare unix.h. |
57 | */ |
58 | #define MULTICLICK_ONLY_EVENT 1 |
59 | |
60 | /* |
61 | * On Windows, data written to the clipboard must be NUL-terminated. |
62 | */ |
63 | #define SELECTION_NUL_TERMINATED 1 |
64 | |
65 | /* |
0f351587 |
66 | * On Windows, copying to the clipboard terminates lines with CRLF. |
67 | */ |
68 | #define SEL_NL { 13, 10 } |
69 | |
70 | /* |
8c3cd914 |
71 | * Exports from winctrls.c. |
72 | */ |
73 | |
74 | struct ctlpos { |
75 | HWND hwnd; |
76 | WPARAM font; |
77 | int dlu4inpix; |
78 | int ypos, width; |
79 | int xoff; |
3ac9cd9f |
80 | int boxystart, boxid; |
8c3cd914 |
81 | char *boxtext; |
82 | }; |
83 | |
ca20bfcf |
84 | /* |
c0a81592 |
85 | * Exports from winutils.c. |
86 | */ |
d3a1a808 |
87 | void split_into_argv(char *, int *, char ***, char ***); |
c0a81592 |
88 | |
89 | /* |
ca20bfcf |
90 | * Private structure for prefslist state. Only in the header file |
91 | * so that we can delegate allocation to callers. |
92 | */ |
93 | struct prefslist { |
94 | int listid, upbid, dnbid; |
95 | int srcitem; |
96 | int dummyitem; |
97 | int dragging; |
98 | }; |
99 | |
f7f27309 |
100 | /* |
101 | * Exports from winctrls.c. |
102 | */ |
8c3cd914 |
103 | void ctlposinit(struct ctlpos *cp, HWND hwnd, |
32874aea |
104 | int leftborder, int rightborder, int topborder); |
ca20bfcf |
105 | HWND doctl(struct ctlpos *cp, RECT r, |
32874aea |
106 | char *wclass, int wstyle, int exstyle, char *wtext, int wid); |
8c3cd914 |
107 | void bartitle(struct ctlpos *cp, char *name, int id); |
3ac9cd9f |
108 | void beginbox(struct ctlpos *cp, char *name, int idbox); |
8c3cd914 |
109 | void endbox(struct ctlpos *cp); |
110 | void multiedit(struct ctlpos *cp, ...); |
32874aea |
111 | void radioline(struct ctlpos *cp, char *text, int id, int nacross, ...); |
d74d141c |
112 | void bareradioline(struct ctlpos *cp, int nacross, ...); |
8c3cd914 |
113 | void radiobig(struct ctlpos *cp, char *text, int id, ...); |
114 | void checkbox(struct ctlpos *cp, char *text, int id); |
66ee282a |
115 | void statictext(struct ctlpos *cp, char *text, int lines, int id); |
8c3cd914 |
116 | void staticbtn(struct ctlpos *cp, char *stext, int sid, |
32874aea |
117 | char *btext, int bid); |
af282e3b |
118 | void static2btn(struct ctlpos *cp, char *stext, int sid, |
119 | char *btext1, int bid1, char *btext2, int bid2); |
8c3cd914 |
120 | void staticedit(struct ctlpos *cp, char *stext, |
32874aea |
121 | int sid, int eid, int percentedit); |
2c9c6388 |
122 | void staticddl(struct ctlpos *cp, char *stext, |
123 | int sid, int lid, int percentlist); |
b8ae1f0f |
124 | void combobox(struct ctlpos *cp, char *text, int staticid, int listid); |
6e522441 |
125 | void staticpassedit(struct ctlpos *cp, char *stext, |
32874aea |
126 | int sid, int eid, int percentedit); |
6e522441 |
127 | void bigeditctrl(struct ctlpos *cp, char *stext, |
32874aea |
128 | int sid, int eid, int lines); |
129 | void ersatztab(struct ctlpos *cp, char *stext, int sid, int lid, int s2id); |
8c3cd914 |
130 | void editbutton(struct ctlpos *cp, char *stext, int sid, |
32874aea |
131 | int eid, char *btext, int bid); |
8c3cd914 |
132 | void sesssaver(struct ctlpos *cp, char *text, |
32874aea |
133 | int staticid, int editid, int listid, ...); |
8c3cd914 |
134 | void envsetter(struct ctlpos *cp, char *stext, int sid, |
32874aea |
135 | char *e1stext, int e1sid, int e1id, |
136 | char *e2stext, int e2sid, int e2id, |
137 | int listid, char *b1text, int b1id, char *b2text, int b2id); |
8c3cd914 |
138 | void charclass(struct ctlpos *cp, char *stext, int sid, int listid, |
32874aea |
139 | char *btext, int bid, int eid, char *s2text, int s2id); |
8c3cd914 |
140 | void colouredit(struct ctlpos *cp, char *stext, int sid, int listid, |
32874aea |
141 | char *btext, int bid, ...); |
ca20bfcf |
142 | void prefslist(struct prefslist *hdl, struct ctlpos *cp, char *stext, |
143 | int sid, int listid, int upbid, int dnbid); |
144 | int handle_prefslist(struct prefslist *hdl, |
145 | int *array, int maxmemb, |
146 | int is_dlmsg, HWND hwnd, |
147 | WPARAM wParam, LPARAM lParam); |
6e522441 |
148 | void progressbar(struct ctlpos *cp, int id); |
d74d141c |
149 | void fwdsetter(struct ctlpos *cp, int listid, char *stext, int sid, |
150 | char *e1stext, int e1sid, int e1id, |
151 | char *e2stext, int e2sid, int e2id, |
152 | char *btext, int bid); |
f7f27309 |
153 | |
154 | /* |
155 | * Exports from windlg.c. |
156 | */ |
157 | void defuse_showwindow(void); |
158 | int do_config(void); |
159 | int do_reconfig(HWND); |
f7f27309 |
160 | void showeventlog(HWND); |
161 | void showabout(HWND); |
f7f27309 |
162 | void force_normal(HWND hwnd); |
163 | |
f7f27309 |
164 | /* |
165 | * Exports from sizetip.c. |
166 | */ |
167 | void UpdateSizeTip(HWND src, int cx, int cy); |
168 | void EnableSizeTip(int bEnable); |
169 | |
1709795f |
170 | /* |
171 | * Unicode and multi-byte character handling stuff. |
172 | */ |
173 | #define is_dbcs_leadbyte(cp, c) IsDBCSLeadByteEx(cp, c) |
174 | #define mb_to_wc(cp, flags, mbstr, mblen, wcstr, wclen) \ |
175 | MultiByteToWideChar(cp, flags, mbstr, mblen, wcstr, wclen) |
176 | #define wc_to_mb(cp, flags, wcstr, wclen, mbstr, mblen, def, defused) \ |
177 | WideCharToMultiByte(cp, flags, mbstr, mblen, wcstr, wclen, def,defused) |
178 | |
f7f27309 |
179 | #endif |