]> asedeno.scripts.mit.edu Git - PuTTY.git/blob - winstuff.h
Line discipline module now uses dynamically allocated data. Also
[PuTTY.git] / 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  * 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 /*
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 /*
66  * On Windows, copying to the clipboard terminates lines with CRLF.
67  */
68 #define SEL_NL { 13, 10 }
69
70 /*
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;
80     int boxystart, boxid;
81     char *boxtext;
82 };
83
84 /*
85  * Exports from winutils.c.
86  */
87 void split_into_argv(char *, int *, char ***, char ***);
88
89 /*
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
100 /*
101  * Exports from winctrls.c.
102  */
103 void ctlposinit(struct ctlpos *cp, HWND hwnd,
104                 int leftborder, int rightborder, int topborder);
105 HWND doctl(struct ctlpos *cp, RECT r,
106            char *wclass, int wstyle, int exstyle, char *wtext, int wid);
107 void bartitle(struct ctlpos *cp, char *name, int id);
108 void beginbox(struct ctlpos *cp, char *name, int idbox);
109 void endbox(struct ctlpos *cp);
110 void multiedit(struct ctlpos *cp, ...);
111 void radioline(struct ctlpos *cp, char *text, int id, int nacross, ...);
112 void bareradioline(struct ctlpos *cp, int nacross, ...);
113 void radiobig(struct ctlpos *cp, char *text, int id, ...);
114 void checkbox(struct ctlpos *cp, char *text, int id);
115 void statictext(struct ctlpos *cp, char *text, int lines, int id);
116 void staticbtn(struct ctlpos *cp, char *stext, int sid,
117                char *btext, int bid);
118 void static2btn(struct ctlpos *cp, char *stext, int sid,
119                 char *btext1, int bid1, char *btext2, int bid2);
120 void staticedit(struct ctlpos *cp, char *stext,
121                 int sid, int eid, int percentedit);
122 void staticddl(struct ctlpos *cp, char *stext,
123                int sid, int lid, int percentlist);
124 void combobox(struct ctlpos *cp, char *text, int staticid, int listid);
125 void staticpassedit(struct ctlpos *cp, char *stext,
126                     int sid, int eid, int percentedit);
127 void bigeditctrl(struct ctlpos *cp, char *stext,
128                  int sid, int eid, int lines);
129 void ersatztab(struct ctlpos *cp, char *stext, int sid, int lid, int s2id);
130 void editbutton(struct ctlpos *cp, char *stext, int sid,
131                 int eid, char *btext, int bid);
132 void sesssaver(struct ctlpos *cp, char *text,
133                int staticid, int editid, int listid, ...);
134 void envsetter(struct ctlpos *cp, char *stext, int sid,
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);
138 void charclass(struct ctlpos *cp, char *stext, int sid, int listid,
139                char *btext, int bid, int eid, char *s2text, int s2id);
140 void colouredit(struct ctlpos *cp, char *stext, int sid, int listid,
141                 char *btext, int bid, ...);
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);
148 void progressbar(struct ctlpos *cp, int id);
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);
153
154 /*
155  * Exports from windlg.c.
156  */
157 void defuse_showwindow(void);
158 int do_config(void);
159 int do_reconfig(HWND);
160 void showeventlog(HWND);
161 void showabout(HWND);
162 void force_normal(HWND hwnd);
163
164 /*
165  * Exports from sizetip.c.
166  */
167 void UpdateSizeTip(HWND src, int cx, int cy);
168 void EnableSizeTip(int bEnable);
169
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, wcstr, wclen, mbstr, mblen, def,defused)
178
179 #endif