9dcfded77501529adf80f2a8bde6c859548f0bf4
[u/mdw/putty] / winstuff.h
1 /*
2 * winstuff.h: Windows-specific inter-module stuff.
3 */
4
5 #ifndef PUTTY_WINSTUFF_H
6 #define PUTTY_WINSTUFF_H
7
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 */
13 #ifndef GLOBAL
14 #ifdef PUTTY_DO_GLOBALS
15 #define GLOBAL
16 #else
17 #define GLOBAL extern
18 #endif
19 #endif
20
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;
34
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 */
44 GLOBAL HINSTANCE hinst;
45
46 /*
47 * Details of the help file.
48 */
49 GLOBAL char *help_path;
50 GLOBAL int help_has_contents;
51
52 /*
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 /*
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 /*
72 * On Windows, copying to the clipboard terminates lines with CRLF.
73 */
74 #define SEL_NL { 13, 10 }
75
76 /*
77 * Exports from winctrls.c.
78 */
79
80 struct ctlpos {
81 HWND hwnd;
82 WPARAM font;
83 int dlu4inpix;
84 int ypos, width;
85 int xoff;
86 int boxystart, boxid;
87 char *boxtext;
88 };
89
90 /*
91 * Exports from winutils.c.
92 */
93 void split_into_argv(char *, int *, char ***, char ***);
94
95 /*
96 * Private structure for prefslist state. Only in the header file
97 * so that we can delegate allocation to callers.
98 */
99 struct prefslist {
100 int listid, upbid, dnbid;
101 int srcitem;
102 int dummyitem;
103 int dragging;
104 };
105
106 /*
107 * Exports from winctrls.c.
108 */
109 void ctlposinit(struct ctlpos *cp, HWND hwnd,
110 int leftborder, int rightborder, int topborder);
111 HWND doctl(struct ctlpos *cp, RECT r,
112 char *wclass, int wstyle, int exstyle, char *wtext, int wid);
113 void bartitle(struct ctlpos *cp, char *name, int id);
114 void beginbox(struct ctlpos *cp, char *name, int idbox);
115 void endbox(struct ctlpos *cp);
116 void multiedit(struct ctlpos *cp, ...);
117 void radioline(struct ctlpos *cp, char *text, int id, int nacross, ...);
118 void bareradioline(struct ctlpos *cp, int nacross, ...);
119 void radiobig(struct ctlpos *cp, char *text, int id, ...);
120 void checkbox(struct ctlpos *cp, char *text, int id);
121 void statictext(struct ctlpos *cp, char *text, int lines, int id);
122 void staticbtn(struct ctlpos *cp, char *stext, int sid,
123 char *btext, int bid);
124 void static2btn(struct ctlpos *cp, char *stext, int sid,
125 char *btext1, int bid1, char *btext2, int bid2);
126 void staticedit(struct ctlpos *cp, char *stext,
127 int sid, int eid, int percentedit);
128 void staticddl(struct ctlpos *cp, char *stext,
129 int sid, int lid, int percentlist);
130 void combobox(struct ctlpos *cp, char *text, int staticid, int listid);
131 void staticpassedit(struct ctlpos *cp, char *stext,
132 int sid, int eid, int percentedit);
133 void bigeditctrl(struct ctlpos *cp, char *stext,
134 int sid, int eid, int lines);
135 void ersatztab(struct ctlpos *cp, char *stext, int sid, int lid, int s2id);
136 void editbutton(struct ctlpos *cp, char *stext, int sid,
137 int eid, char *btext, int bid);
138 void sesssaver(struct ctlpos *cp, char *text,
139 int staticid, int editid, int listid, ...);
140 void envsetter(struct ctlpos *cp, char *stext, int sid,
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);
144 void charclass(struct ctlpos *cp, char *stext, int sid, int listid,
145 char *btext, int bid, int eid, char *s2text, int s2id);
146 void colouredit(struct ctlpos *cp, char *stext, int sid, int listid,
147 char *btext, int bid, ...);
148 void prefslist(struct prefslist *hdl, struct ctlpos *cp, char *stext,
149 int sid, int listid, int upbid, int dnbid);
150 int handle_prefslist(struct prefslist *hdl,
151 int *array, int maxmemb,
152 int is_dlmsg, HWND hwnd,
153 WPARAM wParam, LPARAM lParam);
154 void progressbar(struct ctlpos *cp, int id);
155 void 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);
159
160 /*
161 * Exports from windlg.c.
162 */
163 void defuse_showwindow(void);
164 int do_config(void);
165 int do_reconfig(HWND);
166 void showeventlog(HWND);
167 void showabout(HWND);
168 void force_normal(HWND hwnd);
169
170 /*
171 * Exports from sizetip.c.
172 */
173 void UpdateSizeTip(HWND src, int cx, int cy);
174 void EnableSizeTip(int bEnable);
175
176 #endif