2 * winstuff.h: Windows-specific inter-module stuff.
5 #ifndef PUTTY_WINSTUFF_H
6 #define PUTTY_WINSTUFF_H
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.
14 #ifdef PUTTY_DO_GLOBALS
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"
27 #define GETTICKCOUNT GetTickCount
28 #define CURSORBLINK GetCaretBlinkTime()
29 #define TICKSPERSEC 1000 /* GetTickCount returns milliseconds */
31 #define DEFAULT_CODEPAGE CP_ACP
36 * Window handles for the dialog boxes that can be running during a
42 * The all-important instance handle.
44 GLOBAL HINSTANCE hinst
;
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
51 #define WM_XUSER (WM_USER + 0x2000)
52 #define WM_NETEVENT (WM_XUSER + 5)
55 * On Windows, we send MA_2CLK as the only event marking the second
56 * press of a mouse button. Compare unix.h.
58 #define MULTICLICK_ONLY_EVENT 1
61 * On Windows, data written to the clipboard must be NUL-terminated.
63 #define SELECTION_NUL_TERMINATED 1
66 * On Windows, copying to the clipboard terminates lines with CRLF.
68 #define SEL_NL { 13, 10 }
71 * Exports from winctrls.c.
85 * Exports from winutils.c.
87 void split_into_argv(char *, int *, char ***, char ***);
90 * Private structure for prefslist state. Only in the header file
91 * so that we can delegate allocation to callers.
94 int listid
, upbid
, dnbid
;
101 * Exports from winctrls.c.
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
);
155 * Exports from windlg.c.
157 void defuse_showwindow(void);
159 int do_reconfig(HWND
);
160 void showeventlog(HWND
);
161 void showabout(HWND
);
162 void force_normal(HWND hwnd
);
165 * Exports from sizetip.c.
167 void UpdateSizeTip(HWND src
, int cx
, int cy
);
168 void EnableSizeTip(int bEnable
);
171 * Unicode and multi-byte character handling stuff.
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, mbstr, mblen, wcstr, wclen, def,defused)