]> asedeno.scripts.mit.edu Git - PuTTY.git/blob - winstuff.h
Selection now supported in pterm. Required small modifications
[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 typedef 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
35 typedef HDC Context;
36
37 /*
38  * Window handles for the dialog boxes that can be running during a
39  * PuTTY session.
40  */
41 GLOBAL HWND logbox;
42
43 /*
44  * The all-important instance handle.
45  */
46 GLOBAL HINSTANCE hinst;
47
48 /*
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 /*
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 /*
68  * Exports from winctrls.c.
69  */
70
71 struct ctlpos {
72     HWND hwnd;
73     WPARAM font;
74     int dlu4inpix;
75     int ypos, width;
76     int xoff;
77     int boxystart, boxid;
78     char *boxtext;
79 };
80
81 /*
82  * Exports from winutils.c.
83  */
84 void split_into_argv(char *, int *, char ***, char ***);
85
86 /*
87  * Private structure for prefslist state. Only in the header file
88  * so that we can delegate allocation to callers.
89  */
90 struct prefslist {
91     int listid, upbid, dnbid;
92     int srcitem;
93     int dummyitem;
94     int dragging;
95 };
96
97 /*
98  * Exports from winctrls.c.
99  */
100 void ctlposinit(struct ctlpos *cp, HWND hwnd,
101                 int leftborder, int rightborder, int topborder);
102 HWND doctl(struct ctlpos *cp, RECT r,
103            char *wclass, int wstyle, int exstyle, char *wtext, int wid);
104 void bartitle(struct ctlpos *cp, char *name, int id);
105 void beginbox(struct ctlpos *cp, char *name, int idbox);
106 void endbox(struct ctlpos *cp);
107 void multiedit(struct ctlpos *cp, ...);
108 void radioline(struct ctlpos *cp, char *text, int id, int nacross, ...);
109 void bareradioline(struct ctlpos *cp, int nacross, ...);
110 void radiobig(struct ctlpos *cp, char *text, int id, ...);
111 void checkbox(struct ctlpos *cp, char *text, int id);
112 void statictext(struct ctlpos *cp, char *text, int lines, int id);
113 void staticbtn(struct ctlpos *cp, char *stext, int sid,
114                char *btext, int bid);
115 void static2btn(struct ctlpos *cp, char *stext, int sid,
116                 char *btext1, int bid1, char *btext2, int bid2);
117 void staticedit(struct ctlpos *cp, char *stext,
118                 int sid, int eid, int percentedit);
119 void staticddl(struct ctlpos *cp, char *stext,
120                int sid, int lid, int percentlist);
121 void combobox(struct ctlpos *cp, char *text, int staticid, int listid);
122 void staticpassedit(struct ctlpos *cp, char *stext,
123                     int sid, int eid, int percentedit);
124 void bigeditctrl(struct ctlpos *cp, char *stext,
125                  int sid, int eid, int lines);
126 void ersatztab(struct ctlpos *cp, char *stext, int sid, int lid, int s2id);
127 void editbutton(struct ctlpos *cp, char *stext, int sid,
128                 int eid, char *btext, int bid);
129 void sesssaver(struct ctlpos *cp, char *text,
130                int staticid, int editid, int listid, ...);
131 void envsetter(struct ctlpos *cp, char *stext, int sid,
132                char *e1stext, int e1sid, int e1id,
133                char *e2stext, int e2sid, int e2id,
134                int listid, char *b1text, int b1id, char *b2text, int b2id);
135 void charclass(struct ctlpos *cp, char *stext, int sid, int listid,
136                char *btext, int bid, int eid, char *s2text, int s2id);
137 void colouredit(struct ctlpos *cp, char *stext, int sid, int listid,
138                 char *btext, int bid, ...);
139 void prefslist(struct prefslist *hdl, struct ctlpos *cp, char *stext,
140                int sid, int listid, int upbid, int dnbid);
141 int handle_prefslist(struct prefslist *hdl,
142                      int *array, int maxmemb,
143                      int is_dlmsg, HWND hwnd,
144                      WPARAM wParam, LPARAM lParam);
145 void progressbar(struct ctlpos *cp, int id);
146 void fwdsetter(struct ctlpos *cp, int listid, char *stext, int sid,
147                char *e1stext, int e1sid, int e1id,
148                char *e2stext, int e2sid, int e2id,
149                char *btext, int bid);
150
151 /*
152  * Exports from windlg.c.
153  */
154 void defuse_showwindow(void);
155 int do_config(void);
156 int do_reconfig(HWND);
157 void showeventlog(HWND);
158 void showabout(HWND);
159 void force_normal(HWND hwnd);
160
161 /*
162  * Exports from sizetip.c.
163  */
164 void UpdateSizeTip(HWND src, int cx, int cy);
165 void EnableSizeTip(int bEnable);
166
167 /*
168  * Unicode and multi-byte character handling stuff.
169  */
170 #define is_dbcs_leadbyte(cp, c) IsDBCSLeadByteEx(cp, c)
171 #define mb_to_wc(cp, flags, mbstr, mblen, wcstr, wclen) \
172         MultiByteToWideChar(cp, flags, mbstr, mblen, wcstr, wclen)
173 #define wc_to_mb(cp, flags, wcstr, wclen, mbstr, mblen, def, defused) \
174         WideCharToMultiByte(cp, flags, mbstr, mblen, wcstr, wclen, def,defused)
175
176 #endif