1 |
|
---|
2 | /*
|
---|
3 | *@@sourcefile dialog.h:
|
---|
4 | * header file for dialog.c. See remarks there.
|
---|
5 | *
|
---|
6 | * Note: Version numbering in this file relates to XWorkplace version
|
---|
7 | * numbering.
|
---|
8 | *
|
---|
9 | *@@added V0.9.9 (2001-04-01) [umoeller]
|
---|
10 | *@@include <os2.h>
|
---|
11 | *@@include #include "helpers\linklist.h" // for mnemonic helpers
|
---|
12 | *@@include #include "helpers\dialog.h"
|
---|
13 | */
|
---|
14 |
|
---|
15 | /* Copyright (C) 2001 Ulrich Mller.
|
---|
16 | * This file is part of the "XWorkplace helpers" source package.
|
---|
17 | * This is free software; you can redistribute it and/or modify
|
---|
18 | * it under the terms of the GNU General Public License as published
|
---|
19 | * by the Free Software Foundation, in version 2 as it comes in the
|
---|
20 | * "COPYING" file of the XWorkplace main distribution.
|
---|
21 | * This program is distributed in the hope that it will be useful,
|
---|
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
24 | * GNU General Public License for more details.
|
---|
25 | */
|
---|
26 |
|
---|
27 | #if __cplusplus
|
---|
28 | extern "C" {
|
---|
29 | #endif
|
---|
30 |
|
---|
31 | #ifndef DIALOG_HEADER_INCLUDED
|
---|
32 | #define DIALOG_HEADER_INCLUDED
|
---|
33 |
|
---|
34 | #ifndef NULL_POINT
|
---|
35 | #define NULL_POINT {0, 0}
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | /* ******************************************************************
|
---|
39 | *
|
---|
40 | * Error codes
|
---|
41 | *
|
---|
42 | ********************************************************************/
|
---|
43 |
|
---|
44 | #define ERROR_DLG_FIRST 43000
|
---|
45 |
|
---|
46 | #define DLGERR_ROW_BEFORE_TABLE (ERROR_DLG_FIRST)
|
---|
47 | #define DLGERR_CONTROL_BEFORE_ROW (ERROR_DLG_FIRST + 1)
|
---|
48 | #define DLGERR_NULL_CTL_DEF (ERROR_DLG_FIRST + 2)
|
---|
49 | #define DLGERR_CANNOT_CREATE_FRAME (ERROR_DLG_FIRST + 3)
|
---|
50 | #define DLGERR_INVALID_CODE (ERROR_DLG_FIRST + 4)
|
---|
51 | #define DLGERR_TABLE_NOT_CLOSED (ERROR_DLG_FIRST + 5)
|
---|
52 | #define DLGERR_TOO_MANY_TABLES_CLOSED (ERROR_DLG_FIRST + 6)
|
---|
53 | #define DLGERR_CANNOT_CREATE_CONTROL (ERROR_DLG_FIRST + 7)
|
---|
54 | #define DLGERR_ARRAY_TOO_SMALL (ERROR_DLG_FIRST + 8)
|
---|
55 | #define DLGERR_INVALID_CONTROL_TITLE (ERROR_DLG_FIRST + 9)
|
---|
56 | #define DLGERR_INVALID_STATIC_BITMAP (ERROR_DLG_FIRST + 10)
|
---|
57 | #define DLGERR_INTEGRITY_BAD_COLUMN_INDEX (ERROR_DLG_FIRST + 11)
|
---|
58 |
|
---|
59 | #define ERROR_DLG_LAST (ERROR_DLG_FIRST + 11)
|
---|
60 |
|
---|
61 | /* ******************************************************************
|
---|
62 | *
|
---|
63 | * Structures
|
---|
64 | *
|
---|
65 | ********************************************************************/
|
---|
66 |
|
---|
67 | #define SZL_AUTOSIZE (-1)
|
---|
68 |
|
---|
69 | #define CTL_COMMON_FONT ((PCSZ)-1)
|
---|
70 |
|
---|
71 | /*
|
---|
72 | *@@ CONTROLDEF:
|
---|
73 | * defines a single control. Used
|
---|
74 | * with the TYPE_CONTROL_DEF type in
|
---|
75 | * DLGHITEM.
|
---|
76 | *
|
---|
77 | *@@changed V0.9.12 (2001-05-31) [umoeller]: added control data
|
---|
78 | */
|
---|
79 |
|
---|
80 | typedef struct _CONTROLDEF
|
---|
81 | {
|
---|
82 | const char *pcszClass; // registered PM window class
|
---|
83 | const char *pcszText;
|
---|
84 | // window text (class-specific)
|
---|
85 | // special hacks:
|
---|
86 | // -- For WS_STATIC with SS_BITMAP or SS_ICON set,
|
---|
87 | // you may specify the exact HPOINTER here.
|
---|
88 | // The dlg routine will then subclass the static
|
---|
89 | //
|
---|
90 |
|
---|
91 | ULONG flStyle; // standard window styles
|
---|
92 |
|
---|
93 | USHORT usID; // dlg item ID
|
---|
94 |
|
---|
95 | const char *pcszFont; // font presparam, or NULL for no presparam,
|
---|
96 | // or CTL_COMMON_FONT for standard dialog
|
---|
97 | // font specified on input to dlghCreateDlg
|
---|
98 |
|
---|
99 | USHORT usAdjustPosition;
|
---|
100 | // flags for winhAdjustControls; any combination of
|
---|
101 | // XAC_MOVEX, XAC_MOVEY, XAC_SIZEX, XAC_SIZEY
|
---|
102 | // @@todo not implemented yet
|
---|
103 |
|
---|
104 | SIZEL szlDlgUnits;
|
---|
105 | // proposed size for the control. Note that starting
|
---|
106 | // with V0.9.19, these are now dialog units to
|
---|
107 | // finally fix the bad alignment problems with
|
---|
108 | // lower resolutions. The dialog formatter applies
|
---|
109 | // an internal factor to these things based on
|
---|
110 | // what WinMapDlgPoints gives us.
|
---|
111 | // A number of special flags are available per
|
---|
112 | // cx and cy field:
|
---|
113 | // -- SZL_AUTOSIZE (-1): determine size automatically.
|
---|
114 | // Works only for statics with SS_TEXT and
|
---|
115 | // SS_BITMAP.
|
---|
116 | // -- Any other _negative_ value is considered a
|
---|
117 | // percentage of the largest row width in the
|
---|
118 | // table. For example, -50 would mean 50% of
|
---|
119 | // the largest row in the table. This is valid
|
---|
120 | // for the CX field only.
|
---|
121 | // If the CONTROLDEF appears with a START_NEW_TABLE
|
---|
122 | // type in _DLGHITEM (to specify a group table)
|
---|
123 | // and they are not SZL_AUTOSIZE, they specify the
|
---|
124 | // size of the inner table of the group (to override
|
---|
125 | // the automatic formatting). Note that the dialog
|
---|
126 | // adds extra spacing to this size:
|
---|
127 | // -- the group control's cx will be
|
---|
128 | // szlControlProposed.cx
|
---|
129 | // + 2 * ulSpacing
|
---|
130 | // + 2 * GROUP_INNER_SPACING_X
|
---|
131 | // -- the group control's cy will be
|
---|
132 | // szlControlProposed.cy
|
---|
133 | // + 2 * ulSpacing
|
---|
134 | // + GROUP_INNER_SPACING_Y
|
---|
135 | // + GROUP_INNER_SPACING_TOP
|
---|
136 |
|
---|
137 | ULONG duSpacing;
|
---|
138 | // spacing around control; this is now in dialog
|
---|
139 | // units too V0.9.19 (2002-04-24) [umoeller]
|
---|
140 |
|
---|
141 | PVOID pvCtlData; // for WinCreateWindow
|
---|
142 |
|
---|
143 | } CONTROLDEF, *PCONTROLDEF;
|
---|
144 |
|
---|
145 | typedef const struct _CONTROLDEF *PCCONTROLDEF;
|
---|
146 |
|
---|
147 | /*
|
---|
148 | *@@ DLGHITEMTYPE:
|
---|
149 | *
|
---|
150 | */
|
---|
151 |
|
---|
152 | typedef enum _DLGHITEMTYPE
|
---|
153 | {
|
---|
154 | TYPE_START_NEW_TABLE, // beginning of a new table; may nest
|
---|
155 | TYPE_START_NEW_ROW, // beginning of a new row in a table
|
---|
156 | TYPE_CONTROL_DEF, // control definition
|
---|
157 | TYPE_END_TABLE // end of a table
|
---|
158 | } DLGHITEMTYPE;
|
---|
159 |
|
---|
160 | /*
|
---|
161 | *@@ DLGHITEM:
|
---|
162 | * dialog format array item.
|
---|
163 | *
|
---|
164 | * An array of these must be passed to dlghCreateDlg
|
---|
165 | * to tell it what controls the dialog contains.
|
---|
166 | * See dlghCreateDlg for details.
|
---|
167 | *
|
---|
168 | */
|
---|
169 |
|
---|
170 | typedef struct _DLGHITEM
|
---|
171 | {
|
---|
172 | DLGHITEMTYPE Type;
|
---|
173 | // one of:
|
---|
174 | // TYPE_START_NEW_TABLE, // beginning of a new table
|
---|
175 | // TYPE_START_NEW_ROW, // beginning of a new row in a table
|
---|
176 | // TYPE_CONTROL_DEF // control definition
|
---|
177 | // TYPE_END_TABLE // end of table
|
---|
178 |
|
---|
179 | const CONTROLDEF *pCtlDef;
|
---|
180 | // -- with TYPE_START_NEW_TABLE: if NULL, this starts
|
---|
181 | // an invisible table (for formatting only).
|
---|
182 | // Otherwise a _CONTROLDEF pointer to specify
|
---|
183 | // a control to be produced around the table.
|
---|
184 | // For example, you can specify a WC_STATIC
|
---|
185 | // with SS_GROUPBOX to create a group around
|
---|
186 | // the table.
|
---|
187 |
|
---|
188 | ULONG fl;
|
---|
189 | // -- with TYPE_START_NEW_TABLE. TABLE_* formatting flags.
|
---|
190 | #define TABLE_ALIGN_COLUMNS 0x0100
|
---|
191 |
|
---|
192 | // -- with TYPE_START_NEW_ROW: ROW_* formatting flags.
|
---|
193 | #define ROW_VALIGN_MASK 0x0003
|
---|
194 | #define ROW_VALIGN_BOTTOM 0x0000
|
---|
195 | #define ROW_VALIGN_CENTER 0x0001
|
---|
196 | #define ROW_VALIGN_TOP 0x0002
|
---|
197 |
|
---|
198 | } DLGHITEM, *PDLGHITEM;
|
---|
199 |
|
---|
200 | typedef const struct _DLGHITEM *PCDLGHITEM;
|
---|
201 |
|
---|
202 | // a few handy macros for defining templates
|
---|
203 |
|
---|
204 | #define START_TABLE { TYPE_START_NEW_TABLE, NULL, 0 }
|
---|
205 |
|
---|
206 | #define START_TABLE_ALIGN { TYPE_START_NEW_TABLE, NULL, TABLE_ALIGN_COLUMNS }
|
---|
207 | // added V0.9.20 (2002-08-08) [umoeller]
|
---|
208 |
|
---|
209 | #define START_GROUP_TABLE(pDef) { TYPE_START_NEW_TABLE, pDef, 0 }
|
---|
210 |
|
---|
211 | #define START_GROUP_TABLE_ALIGN(pDef) { TYPE_START_NEW_TABLE, pDef, TABLE_ALIGN_COLUMNS }
|
---|
212 | // added V0.9.20 (2002-08-08) [umoeller]
|
---|
213 |
|
---|
214 | #define END_TABLE { TYPE_END_TABLE, NULL, 0 }
|
---|
215 |
|
---|
216 | #define START_ROW(fl) { TYPE_START_NEW_ROW, NULL, fl }
|
---|
217 |
|
---|
218 | #define CONTROL_DEF(pDef) { TYPE_CONTROL_DEF, pDef, 0 }
|
---|
219 |
|
---|
220 | /* ******************************************************************
|
---|
221 | *
|
---|
222 | * Macros
|
---|
223 | *
|
---|
224 | ********************************************************************/
|
---|
225 |
|
---|
226 | #define LOAD_STRING ((PCSZ)-1)
|
---|
227 |
|
---|
228 | // if the following is defined, we ignore the Y factor
|
---|
229 | // when scaling dialog units to pixels but use the X
|
---|
230 | // factor twice. This will result in something specified
|
---|
231 | // to be 10x10 units to be square, but will result in
|
---|
232 | // problems because dialog units are based on the
|
---|
233 | // system default fonts and x is different from y then.
|
---|
234 | // #define USE_SQUARE_CORRELATION
|
---|
235 |
|
---|
236 | // if you still want something to be vaguely square,
|
---|
237 | // try the following macro to calculate the CY from a CX
|
---|
238 | #ifdef USE_SQUARE_CORRELATION
|
---|
239 | #define MAKE_SQUARE_CY(cx) (cx)
|
---|
240 | #else
|
---|
241 | #define MAKE_SQUARE_CY(cx) (cx * 200 / 250)
|
---|
242 | #endif
|
---|
243 |
|
---|
244 | #define DLG_OUTER_SPACING_X 4
|
---|
245 | // outer spacing applied around entire dialog;
|
---|
246 | // we now use 4 to match the spacing in Warp 4
|
---|
247 | // notebook pages V0.9.19 (2002-04-24) [umoeller]
|
---|
248 | #define DLG_OUTER_SPACING_Y 3
|
---|
249 |
|
---|
250 | #define COMMON_SPACING 1
|
---|
251 |
|
---|
252 | #define GROUP_INNER_SPACING_X 3
|
---|
253 | #define GROUP_OUTER_SPACING_BOTTOM 1
|
---|
254 | #define GROUP_INNER_SPACING_BOTTOM 3
|
---|
255 | #define GROUP_INNER_SPACING_TOP 8
|
---|
256 | #define GROUP_OUTER_SPACING_TOP 0
|
---|
257 |
|
---|
258 | #define STD_BUTTON_WIDTH 50
|
---|
259 |
|
---|
260 | #ifdef USE_SQUARE_CORRELATION
|
---|
261 | #define STD_BUTTON_HEIGHT 15
|
---|
262 | #define STD_SPIN_HEIGHT 10
|
---|
263 | #else
|
---|
264 | #define STD_BUTTON_HEIGHT 12
|
---|
265 | #define STD_SPIN_HEIGHT 8
|
---|
266 | #endif
|
---|
267 |
|
---|
268 | #define DEFAULT_TABLE_WIDTH 150
|
---|
269 |
|
---|
270 | #define MSGBOX_TEXTWIDTH 200
|
---|
271 |
|
---|
272 | // the following require INCL_WINSTATICS
|
---|
273 |
|
---|
274 | #define CONTROLDEF_GROUP(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
|
---|
275 | WS_VISIBLE | SS_GROUPBOX | DT_MNEMONIC, \
|
---|
276 | id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
|
---|
277 |
|
---|
278 | #define LOADDEF_GROUP(id, cx) CONTROLDEF_GROUP(LOAD_STRING, id, cx, SZL_AUTOSIZE)
|
---|
279 |
|
---|
280 | #define CONTROLDEF_TEXT(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
|
---|
281 | WS_VISIBLE | SS_TEXT | DT_LEFT | DT_VCENTER | DT_MNEMONIC, \
|
---|
282 | id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
|
---|
283 |
|
---|
284 | #define LOADDEF_TEXT(id) CONTROLDEF_TEXT(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
|
---|
285 |
|
---|
286 | #define CONTROLDEF_TEXT_CENTER(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
|
---|
287 | WS_VISIBLE | SS_TEXT | DT_CENTER | DT_VCENTER | DT_MNEMONIC, \
|
---|
288 | id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
|
---|
289 |
|
---|
290 | #define CONTROLDEF_TEXT_RIGHT(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
|
---|
291 | WS_VISIBLE | SS_TEXT | DT_RIGHT | DT_VCENTER | DT_MNEMONIC, \
|
---|
292 | id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
|
---|
293 |
|
---|
294 | #define LOADDEF_TEXT_RIGHT(id) CONTROLDEF_TEXT_RIGHT(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
|
---|
295 |
|
---|
296 | #define CONTROLDEF_TEXT_WORDBREAK(pcsz, id, cx) { WC_STATIC, pcsz, \
|
---|
297 | WS_VISIBLE | SS_TEXT | DT_LEFT | DT_TOP | DT_WORDBREAK, \
|
---|
298 | id, CTL_COMMON_FONT, 0, {cx, SZL_AUTOSIZE}, COMMON_SPACING }
|
---|
299 |
|
---|
300 | #define LOADDEF_TEXT_WORDBREAK(id, cx) CONTROLDEF_TEXT_WORDBREAK(LOAD_STRING, id, cx)
|
---|
301 |
|
---|
302 | #define CONTROLDEF_TEXT_WORDBREAK_MNEMONIC(pcsz, id, cx) { WC_STATIC, pcsz, \
|
---|
303 | WS_VISIBLE | SS_TEXT | DT_LEFT | DT_TOP | DT_WORDBREAK | DT_MNEMONIC, \
|
---|
304 | id, CTL_COMMON_FONT, 0, {cx, SZL_AUTOSIZE}, COMMON_SPACING }
|
---|
305 |
|
---|
306 | #define LOADDEF_TEXT_WORDBREAK_MNEMONIC(id, cx) CONTROLDEF_TEXT_WORDBREAK_MNEMONIC(LOAD_STRING, id, cx)
|
---|
307 |
|
---|
308 | #define CONTROLDEF_ICON(hptr, id) { WC_STATIC, (PCSZ)(hptr), \
|
---|
309 | WS_VISIBLE | SS_ICON | DT_LEFT | DT_VCENTER, \
|
---|
310 | id, CTL_COMMON_FONT, 0, {SZL_AUTOSIZE, SZL_AUTOSIZE}, COMMON_SPACING }
|
---|
311 |
|
---|
312 | #define CONTROLDEF_ICON_WIDER(hptr, id) { WC_STATIC, (PCSZ)(hptr), \
|
---|
313 | WS_VISIBLE | SS_ICON | DT_LEFT | DT_VCENTER, \
|
---|
314 | id, CTL_COMMON_FONT, 0, {SZL_AUTOSIZE, SZL_AUTOSIZE}, 2 * COMMON_SPACING }
|
---|
315 |
|
---|
316 | #define CONTROLDEF_BITMAP(hbm, id) { WC_STATIC, (PCSZ)(hbm), \
|
---|
317 | WS_VISIBLE | SS_BITMAP | DT_LEFT | DT_VCENTER, \
|
---|
318 | id, CTL_COMMON_FONT, 0, {SZL_AUTOSIZE, SZL_AUTOSIZE}, COMMON_SPACING }
|
---|
319 |
|
---|
320 | // the following require INCL_WINBUTTONS
|
---|
321 |
|
---|
322 | #define CONTROLDEF_DEFPUSHBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
|
---|
323 | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_DEFAULT, \
|
---|
324 | id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
|
---|
325 |
|
---|
326 | #define LOADDEF_DEFPUSHBUTTON(id) CONTROLDEF_DEFPUSHBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT)
|
---|
327 |
|
---|
328 | #define CONTROLDEF_PUSHBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
|
---|
329 | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON, \
|
---|
330 | id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
|
---|
331 |
|
---|
332 | #define LOADDEF_PUSHBUTTON(id) CONTROLDEF_PUSHBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT)
|
---|
333 |
|
---|
334 | #define CONTROLDEF_DEFNOFOCUSBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
|
---|
335 | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_DEFAULT | BS_NOPOINTERFOCUS, \
|
---|
336 | id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
|
---|
337 |
|
---|
338 | #define CONTROLDEF_NOFOCUSBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
|
---|
339 | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, \
|
---|
340 | id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
|
---|
341 |
|
---|
342 | #define LOADDEF_NOFOCUSBUTTON(id) CONTROLDEF_NOFOCUSBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT)
|
---|
343 |
|
---|
344 | #define CONTROLDEF_HELPPUSHBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
|
---|
345 | WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_HELP | BS_NOPOINTERFOCUS, \
|
---|
346 | id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
|
---|
347 |
|
---|
348 | #define LOADDEF_HELPPUSHBUTTON(id) CONTROLDEF_HELPPUSHBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT)
|
---|
349 |
|
---|
350 | #define CONTROLDEF_AUTOCHECKBOX(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
|
---|
351 | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX, \
|
---|
352 | id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
|
---|
353 |
|
---|
354 | #define LOADDEF_AUTOCHECKBOX(id) CONTROLDEF_AUTOCHECKBOX(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
|
---|
355 |
|
---|
356 | #define CONTROLDEF_FIRST_AUTORADIO(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
|
---|
357 | WS_VISIBLE | WS_TABSTOP | BS_AUTORADIOBUTTON | WS_GROUP, \
|
---|
358 | id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
|
---|
359 |
|
---|
360 | #define LOADDEF_FIRST_AUTORADIO(id) CONTROLDEF_FIRST_AUTORADIO(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
|
---|
361 |
|
---|
362 | #define CONTROLDEF_NEXT_AUTORADIO(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
|
---|
363 | WS_VISIBLE | WS_TABSTOP | BS_AUTORADIOBUTTON, \
|
---|
364 | id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
|
---|
365 |
|
---|
366 | #define LOADDEF_NEXT_AUTORADIO(id) CONTROLDEF_NEXT_AUTORADIO(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
|
---|
367 |
|
---|
368 | // the following require INCL_WINENTRYFIELDS
|
---|
369 |
|
---|
370 | #define CONTROLDEF_ENTRYFIELD(pcsz, id, cx, cy) { WC_ENTRYFIELD, pcsz, \
|
---|
371 | WS_VISIBLE | WS_TABSTOP | ES_MARGIN | ES_AUTOSCROLL, \
|
---|
372 | id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
|
---|
373 |
|
---|
374 | #define CONTROLDEF_ENTRYFIELD_RO(pcsz, id, cx, cy) { WC_ENTRYFIELD, pcsz, \
|
---|
375 | WS_VISIBLE | WS_TABSTOP | ES_MARGIN | ES_READONLY | ES_AUTOSCROLL, \
|
---|
376 | id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
|
---|
377 |
|
---|
378 | // the following require INCL_WINMLE
|
---|
379 |
|
---|
380 | #define CONTROLDEF_MLE(pcsz, id, cx, cy) { WC_MLE, pcsz, \
|
---|
381 | WS_VISIBLE | WS_TABSTOP | MLS_BORDER | MLS_IGNORETAB | MLS_WORDWRAP, \
|
---|
382 | id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
|
---|
383 |
|
---|
384 | // the following require INCL_WINLISTBOXES
|
---|
385 |
|
---|
386 | #define CONTROLDEF_LISTBOX(id, cx, cy) { WC_LISTBOX, NULL, \
|
---|
387 | WS_VISIBLE | WS_TABSTOP | LS_HORZSCROLL | LS_NOADJUSTPOS, \
|
---|
388 | id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
|
---|
389 |
|
---|
390 | // the following require INCL_WINLISTBOXES and INCL_WINENTRYFIELDS
|
---|
391 |
|
---|
392 | #define CONTROLDEF_DROPDOWN(id, cx, cy) { WC_COMBOBOX, NULL, \
|
---|
393 | WS_VISIBLE | WS_TABSTOP | LS_HORZSCROLL | CBS_DROPDOWN, \
|
---|
394 | id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
|
---|
395 |
|
---|
396 | #define CONTROLDEF_DROPDOWNLIST(id, cx, cy) { WC_COMBOBOX, NULL, \
|
---|
397 | WS_VISIBLE | WS_TABSTOP | LS_HORZSCROLL | CBS_DROPDOWNLIST, \
|
---|
398 | id, CTL_COMMON_FONT, 0, { cx, cy }, COMMON_SPACING }
|
---|
399 |
|
---|
400 | // the following require INCL_WINSTDSPIN
|
---|
401 |
|
---|
402 | #define CONTROLDEF_SPINBUTTON(id, cx, cy) { WC_SPINBUTTON, NULL, \
|
---|
403 | WS_VISIBLE | WS_TABSTOP | SPBS_MASTER | SPBS_NUMERICONLY | SPBS_JUSTCENTER | SPBS_FASTSPIN, \
|
---|
404 | id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
|
---|
405 |
|
---|
406 | // the following require INCL_WINSTDCNR
|
---|
407 |
|
---|
408 | #define CONTROLDEF_CONTAINER(id, cx, cy) { WC_CONTAINER, NULL, \
|
---|
409 | WS_VISIBLE | WS_TABSTOP | 0, \
|
---|
410 | id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
|
---|
411 |
|
---|
412 | #define CONTROLDEF_CONTAINER_EXTSEL(id, cx, cy) { WC_CONTAINER, NULL, \
|
---|
413 | WS_VISIBLE | WS_TABSTOP | CCS_EXTENDSEL, \
|
---|
414 | id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING }
|
---|
415 |
|
---|
416 | // the following require INCL_WINSTDSLIDER
|
---|
417 |
|
---|
418 | #define CONTROLDEF_SLIDER(id, cx, cy, pctldata) { WC_SLIDER, NULL, \
|
---|
419 | WS_VISIBLE | WS_TABSTOP | WS_GROUP | SLS_HORIZONTAL | SLS_PRIMARYSCALE1 \
|
---|
420 | | SLS_BUTTONSRIGHT | SLS_SNAPTOINCREMENT, \
|
---|
421 | id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING, pctldata }
|
---|
422 |
|
---|
423 | #define CONTROLDEF_VSLIDER(id, cx, cy, pctldata) { WC_SLIDER, NULL, \
|
---|
424 | WS_VISIBLE | WS_TABSTOP | WS_GROUP | SLS_VERTICAL | SLS_PRIMARYSCALE1 \
|
---|
425 | | SLS_BUTTONSRIGHT | SLS_SNAPTOINCREMENT, \
|
---|
426 | id, CTL_COMMON_FONT, 0, {cx, cy}, COMMON_SPACING, pctldata }
|
---|
427 |
|
---|
428 | /* ******************************************************************
|
---|
429 | *
|
---|
430 | * Dialog formatter entry points
|
---|
431 | *
|
---|
432 | ********************************************************************/
|
---|
433 |
|
---|
434 | #ifndef FCF_CLOSEBUTTON
|
---|
435 | #define FCF_CLOSEBUTTON 0x04000000L // toolkit 4 only
|
---|
436 | #endif
|
---|
437 |
|
---|
438 | #define FCF_FIXED_DLG FCF_TITLEBAR | FCF_SYSMENU | FCF_DLGBORDER | FCF_NOBYTEALIGN | FCF_CLOSEBUTTON
|
---|
439 | #define FCF_SIZEABLE_DLG FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_NOBYTEALIGN | FCF_CLOSEBUTTON
|
---|
440 |
|
---|
441 | APIRET XWPENTRY dlghCreateDlg(HWND *phwndDlg,
|
---|
442 | HWND hwndOwner,
|
---|
443 | ULONG flCreateFlags,
|
---|
444 | PFNWP pfnwpDialogProc,
|
---|
445 | PCSZ pcszDlgTitle,
|
---|
446 | PCDLGHITEM paDlgItems,
|
---|
447 | ULONG cDlgItems,
|
---|
448 | PVOID pCreateParams,
|
---|
449 | PCSZ pcszControlsFont);
|
---|
450 | typedef APIRET XWPENTRY DLGHCREATEDLG(HWND *phwndDlg,
|
---|
451 | HWND hwndOwner,
|
---|
452 | ULONG flCreateFlags,
|
---|
453 | PFNWP pfnwpDialogProc,
|
---|
454 | PCSZ pcszDlgTitle,
|
---|
455 | PCDLGHITEM paDlgItems,
|
---|
456 | ULONG cDlgItems,
|
---|
457 | PVOID pCreateParams,
|
---|
458 | PCSZ pcszControlsFont);
|
---|
459 | typedef DLGHCREATEDLG *PDLGHCREATEDLG;
|
---|
460 |
|
---|
461 | #define DFFL_CREATECONTROLS 0x0002
|
---|
462 |
|
---|
463 | APIRET dlghFormatDlg(HWND hwndDlg,
|
---|
464 | PCDLGHITEM paDlgItems,
|
---|
465 | ULONG cDlgItems,
|
---|
466 | PCSZ pcszControlsFont,
|
---|
467 | ULONG flFlags,
|
---|
468 | PSIZEL pszlClient,
|
---|
469 | PVOID *ppllControls);
|
---|
470 |
|
---|
471 | VOID dlghResizeFrame(HWND hwndDlg,
|
---|
472 | PSIZEL pszlClient);
|
---|
473 |
|
---|
474 | /* ******************************************************************
|
---|
475 | *
|
---|
476 | * Dialog arrays
|
---|
477 | *
|
---|
478 | ********************************************************************/
|
---|
479 |
|
---|
480 | /*
|
---|
481 | *@@ DLGARRAY:
|
---|
482 | * dialog array structure used with dlghCreateArray.
|
---|
483 | * See remarks there.
|
---|
484 | *
|
---|
485 | *@@added V0.9.16 (2001-10-15) [umoeller]
|
---|
486 | */
|
---|
487 |
|
---|
488 | typedef struct _DLGARRAY
|
---|
489 | {
|
---|
490 | DLGHITEM *paDlgItems; // array of DLGHITEM's, allocated once
|
---|
491 | // by dlghCreateArray
|
---|
492 | ULONG cDlgItemsMax, // copied from dlghCreateArray
|
---|
493 | cDlgItemsNow; // initially 0, raised after each
|
---|
494 | // dlghAppendToArray; pass this to the
|
---|
495 | // dialog formatter
|
---|
496 | } DLGARRAY, *PDLGARRAY;
|
---|
497 |
|
---|
498 | APIRET dlghCreateArray(ULONG cMaxItems, PDLGARRAY *ppArray);
|
---|
499 | typedef APIRET DLGHCREATEARRAY(ULONG cMaxItems, PDLGARRAY *ppArray);
|
---|
500 | typedef DLGHCREATEARRAY *PDLGHCREATEARRAY;
|
---|
501 |
|
---|
502 | APIRET dlghFreeArray(PDLGARRAY *ppArray);
|
---|
503 | typedef APIRET DLGHFREEARRAY(PDLGARRAY *ppArray);
|
---|
504 | typedef DLGHFREEARRAY *PDLGHFREEARRAY;
|
---|
505 |
|
---|
506 | APIRET dlghAppendToArray(PDLGARRAY pArray,
|
---|
507 | PCDLGHITEM paItems,
|
---|
508 | ULONG cItems);
|
---|
509 | typedef APIRET DLGHAPPENDTOARRAY(PDLGARRAY pArray,
|
---|
510 | PCDLGHITEM paItems,
|
---|
511 | ULONG cItems);
|
---|
512 | typedef DLGHAPPENDTOARRAY *PDLGHAPPENDTOARRAY;
|
---|
513 |
|
---|
514 | /* ******************************************************************
|
---|
515 | *
|
---|
516 | * Standard dialogs
|
---|
517 | *
|
---|
518 | ********************************************************************/
|
---|
519 |
|
---|
520 | /*
|
---|
521 | *@@ MSGBOXSTRINGS:
|
---|
522 | *
|
---|
523 | *@@added V0.9.13 (2001-06-21) [umoeller]
|
---|
524 | */
|
---|
525 |
|
---|
526 | typedef struct _MSGBOXSTRINGS
|
---|
527 | {
|
---|
528 | const char *pcszYes, // "~Yes"
|
---|
529 | *pcszNo, // "~No"
|
---|
530 | *pcszOK, // "~OK"
|
---|
531 | *pcszCancel, // "~Cancel"
|
---|
532 | *pcszAbort, // "~Abort"
|
---|
533 | *pcszRetry, // "~Retry"
|
---|
534 | *pcszIgnore, // "~Ignore"
|
---|
535 | *pcszEnter, // "~Help"
|
---|
536 | *pcszYesToAll, // "Yes to ~all"
|
---|
537 | *pcszHelp; // "~Help"
|
---|
538 | } MSGBOXSTRINGS, *PMSGBOXSTRINGS;
|
---|
539 |
|
---|
540 | /* the following are in os2.h somewhere:
|
---|
541 | #define MB_OK 0x0000
|
---|
542 | #define MB_OKCANCEL 0x0001
|
---|
543 | #define MB_RETRYCANCEL 0x0002
|
---|
544 | #define MB_ABORTRETRYIGNORE 0x0003
|
---|
545 | #define MB_YESNO 0x0004
|
---|
546 | #define MB_YESNOCANCEL 0x0005
|
---|
547 | #define MB_CANCEL 0x0006
|
---|
548 | #define MB_ENTER 0x0007
|
---|
549 | #define MB_ENTERCANCEL 0x0008 */
|
---|
550 | // we add:
|
---|
551 | #define MB_YES_YES2ALL_NO 0x0009
|
---|
552 |
|
---|
553 | /* the following are in os2.h somewhere:
|
---|
554 | #define MBID_OK 1
|
---|
555 | #define MBID_CANCEL 2
|
---|
556 | #define MBID_ABORT 3
|
---|
557 | #define MBID_RETRY 4
|
---|
558 | #define MBID_IGNORE 5
|
---|
559 | #define MBID_YES 6
|
---|
560 | #define MBID_NO 7
|
---|
561 | #define MBID_HELP 8
|
---|
562 | #define MBID_ENTER 9 */
|
---|
563 | // we add:
|
---|
564 | #define MBID_YES2ALL 10
|
---|
565 |
|
---|
566 | typedef VOID APIENTRY FNHELP(HWND hwndDlg);
|
---|
567 | typedef FNHELP *PFNHELP;
|
---|
568 |
|
---|
569 | APIRET dlghCreateMessageBox(HWND *phwndDlg,
|
---|
570 | HWND hwndOwner,
|
---|
571 | HPOINTER hptrIcon,
|
---|
572 | PCSZ pcszTitle,
|
---|
573 | PCSZ pcszMessage,
|
---|
574 | PFNHELP pfnHelp,
|
---|
575 | ULONG flFlags,
|
---|
576 | PCSZ pcszFont,
|
---|
577 | const MSGBOXSTRINGS *pStrings,
|
---|
578 | PULONG pulAlarmFlag);
|
---|
579 |
|
---|
580 | ULONG dlghMessageBox(HWND hwndOwner,
|
---|
581 | HPOINTER hptrIcon,
|
---|
582 | PCSZ pcszTitle,
|
---|
583 | PCSZ pcszMessage,
|
---|
584 | PFNHELP pfnHelp,
|
---|
585 | ULONG flFlags,
|
---|
586 | PCSZ pcszFont,
|
---|
587 | const MSGBOXSTRINGS *pStrings);
|
---|
588 |
|
---|
589 | #define TEBF_REMOVETILDE 0x0001
|
---|
590 | #define TEBF_REMOVEELLIPSE 0x0002
|
---|
591 | #define TEBF_SELECTALL 0x0004
|
---|
592 |
|
---|
593 | PSZ dlghTextEntryBox(HWND hwndOwner,
|
---|
594 | PCSZ pcszTitle,
|
---|
595 | PCSZ pcszDescription,
|
---|
596 | PCSZ pcszDefault,
|
---|
597 | PCSZ pcszOK,
|
---|
598 | PCSZ pcszCancel,
|
---|
599 | ULONG ulMaxLen,
|
---|
600 | ULONG fl,
|
---|
601 | PCSZ pcszFont);
|
---|
602 |
|
---|
603 | /* ******************************************************************
|
---|
604 | *
|
---|
605 | * Dialog input handlers
|
---|
606 | *
|
---|
607 | ********************************************************************/
|
---|
608 |
|
---|
609 | VOID dlghSetPrevFocus(PVOID pvllWindows);
|
---|
610 |
|
---|
611 | VOID dlghSetNextFocus(PVOID pvllWindows);
|
---|
612 |
|
---|
613 | HWND dlghProcessMnemonic(PVOID pvllWindows,
|
---|
614 | USHORT usch);
|
---|
615 |
|
---|
616 | BOOL dlghEnter(PVOID pvllWindows);
|
---|
617 |
|
---|
618 | #endif
|
---|
619 |
|
---|
620 | #if __cplusplus
|
---|
621 | }
|
---|
622 | #endif
|
---|
623 |
|
---|