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