Yet more global-removal. The static variables in logging.c are now
[u/mdw/putty] / winstuff.h
CommitLineData
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
23typedef struct config_tag Config;
24typedef struct backend_tag Backend;
25typedef 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
40typedef HDC Context;
8c3cd914 41
f7f27309 42/*
43 * Window handles for the dialog boxes that can be running during a
44 * PuTTY session.
45 */
46GLOBAL HWND logbox;
47
48/*
49 * The all-important instance handle.
50 */
8c3cd914 51GLOBAL HINSTANCE hinst;
52
53/*
6b78788a 54 * Details of the help file.
55 */
56GLOBAL char *help_path;
57GLOBAL 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
62 * windlg.c.
63 */
64GLOBAL Terminal *term;
65GLOBAL 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/*
8c3cd914 92 * Exports from winctrls.c.
93 */
94
95struct ctlpos {
96 HWND hwnd;
97 WPARAM font;
98 int dlu4inpix;
99 int ypos, width;
100 int xoff;
3ac9cd9f 101 int boxystart, boxid;
8c3cd914 102 char *boxtext;
103};
104
ca20bfcf 105/*
c0a81592 106 * Exports from winutils.c.
107 */
d3a1a808 108void split_into_argv(char *, int *, char ***, char ***);
c0a81592 109
110/*
ca20bfcf 111 * Private structure for prefslist state. Only in the header file
112 * so that we can delegate allocation to callers.
113 */
114struct prefslist {
115 int listid, upbid, dnbid;
116 int srcitem;
117 int dummyitem;
118 int dragging;
119};
120
f7f27309 121/*
122 * Exports from winctrls.c.
123 */
8c3cd914 124void ctlposinit(struct ctlpos *cp, HWND hwnd,
32874aea 125 int leftborder, int rightborder, int topborder);
ca20bfcf 126HWND doctl(struct ctlpos *cp, RECT r,
32874aea 127 char *wclass, int wstyle, int exstyle, char *wtext, int wid);
8c3cd914 128void bartitle(struct ctlpos *cp, char *name, int id);
3ac9cd9f 129void beginbox(struct ctlpos *cp, char *name, int idbox);
8c3cd914 130void endbox(struct ctlpos *cp);
131void multiedit(struct ctlpos *cp, ...);
32874aea 132void radioline(struct ctlpos *cp, char *text, int id, int nacross, ...);
d74d141c 133void bareradioline(struct ctlpos *cp, int nacross, ...);
8c3cd914 134void radiobig(struct ctlpos *cp, char *text, int id, ...);
135void checkbox(struct ctlpos *cp, char *text, int id);
66ee282a 136void statictext(struct ctlpos *cp, char *text, int lines, int id);
8c3cd914 137void staticbtn(struct ctlpos *cp, char *stext, int sid,
32874aea 138 char *btext, int bid);
af282e3b 139void static2btn(struct ctlpos *cp, char *stext, int sid,
140 char *btext1, int bid1, char *btext2, int bid2);
8c3cd914 141void staticedit(struct ctlpos *cp, char *stext,
32874aea 142 int sid, int eid, int percentedit);
2c9c6388 143void staticddl(struct ctlpos *cp, char *stext,
144 int sid, int lid, int percentlist);
b8ae1f0f 145void combobox(struct ctlpos *cp, char *text, int staticid, int listid);
6e522441 146void staticpassedit(struct ctlpos *cp, char *stext,
32874aea 147 int sid, int eid, int percentedit);
6e522441 148void bigeditctrl(struct ctlpos *cp, char *stext,
32874aea 149 int sid, int eid, int lines);
150void ersatztab(struct ctlpos *cp, char *stext, int sid, int lid, int s2id);
8c3cd914 151void editbutton(struct ctlpos *cp, char *stext, int sid,
32874aea 152 int eid, char *btext, int bid);
8c3cd914 153void sesssaver(struct ctlpos *cp, char *text,
32874aea 154 int staticid, int editid, int listid, ...);
8c3cd914 155void envsetter(struct ctlpos *cp, char *stext, int sid,
32874aea 156 char *e1stext, int e1sid, int e1id,
157 char *e2stext, int e2sid, int e2id,
158 int listid, char *b1text, int b1id, char *b2text, int b2id);
8c3cd914 159void charclass(struct ctlpos *cp, char *stext, int sid, int listid,
32874aea 160 char *btext, int bid, int eid, char *s2text, int s2id);
8c3cd914 161void colouredit(struct ctlpos *cp, char *stext, int sid, int listid,
32874aea 162 char *btext, int bid, ...);
ca20bfcf 163void prefslist(struct prefslist *hdl, struct ctlpos *cp, char *stext,
164 int sid, int listid, int upbid, int dnbid);
165int handle_prefslist(struct prefslist *hdl,
166 int *array, int maxmemb,
167 int is_dlmsg, HWND hwnd,
168 WPARAM wParam, LPARAM lParam);
6e522441 169void progressbar(struct ctlpos *cp, int id);
d74d141c 170void fwdsetter(struct ctlpos *cp, int listid, char *stext, int sid,
171 char *e1stext, int e1sid, int e1id,
172 char *e2stext, int e2sid, int e2id,
173 char *btext, int bid);
f7f27309 174
175/*
176 * Exports from windlg.c.
177 */
178void defuse_showwindow(void);
179int do_config(void);
180int do_reconfig(HWND);
f7f27309 181void showeventlog(HWND);
182void showabout(HWND);
f7f27309 183void force_normal(HWND hwnd);
184
f7f27309 185/*
186 * Exports from sizetip.c.
187 */
188void UpdateSizeTip(HWND src, int cx, int cy);
189void EnableSizeTip(int bEnable);
190
191#endif