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