source: trunk/include/helpers/dialog.h@ 315

Last change on this file since 315 was 239, checked in by umoeller, 23 years ago

Misc fixes.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 29.9 KB
Line 
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 M”ller.
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
28extern "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_CONTROLDEF (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_ROOT_TABLE_INHERIT_SIZE (ERROR_DLG_FIRST + 11)
58 // TABLE_INHERIT_SIZE set for root table, which is invalid
59 #define DLGERR_GPIQUERYTEXTBOX (ERROR_DLG_FIRST + 12)
60 // GpiQueryTextBox failed
61 #define DLGERR_GPIQUERYBITMAPINFOHEADER (ERROR_DLG_FIRST + 13)
62 // GpiQueryBitmapInfoHeader failed
63
64 #define ERROR_DLG_LAST (ERROR_DLG_FIRST + 12)
65
66 /* ******************************************************************
67 *
68 * Structures
69 *
70 ********************************************************************/
71
72 #define SZL_AUTOSIZE (-1)
73 #define SZL_REMAINDER (0)
74
75 #define CTL_COMMON_FONT ((PCSZ)-1)
76
77 /*
78 *@@ CONTROLDEF:
79 * defines a single control. Used
80 * with the TYPE_CONTROL_DEF type in
81 * DLGHITEM.
82 *
83 *@@changed V0.9.12 (2001-05-31) [umoeller]: added control data
84 */
85
86 typedef struct _CONTROLDEF
87 {
88 const char *pcszClass; // registered PM window class
89 const char *pcszText;
90 // window text (class-specific)
91 // special hacks:
92 // -- For WS_STATIC with SS_BITMAP or SS_ICON set,
93 // you may specify the exact HPOINTER here.
94 // The dlg routine will then subclass the static
95 //
96
97 ULONG flStyle; // standard window styles
98
99 USHORT usID; // dlg item ID
100
101 const char *pcszFont; // font presparam, or NULL for no presparam,
102 // or CTL_COMMON_FONT for standard dialog
103 // font specified on input to dlghCreateDlg
104
105 // USHORT usAdjustPosition;
106 // flags for winhAdjustControls; any combination of
107 // XAC_MOVEX, XAC_MOVEY, XAC_SIZEX, XAC_SIZEY
108 // removed V1.0.0 (2002-08-18) [umoeller]
109
110 SIZEL szlDlgUnits;
111 // proposed size for the control content rectangle.
112 // Starting with V0.9.19, this is specified in
113 // dialog units to fix the bad alignment problems
114 // with lower resolutions. The dialog formatter
115 // applies an internal factor to these things based on
116 // what WinMapDlgPoints gives us.
117 //
118 // This size then becomes the column's content
119 // rectangle, to which spacing is applied to get
120 // the control's box.
121 //
122 // A number of special flags are available per
123 // cx and cy field:
124 //
125 // -- SZL_AUTOSIZE (-1): determine size automatically.
126 // The behavior of this is control-specific:
127 // -- Statics with SS_BITMAP or SS_ICON and
128 // single-line SS_TEXT statics may
129 // specify this for either cx or cy.
130 // -- Same applies to pushbuttons, checkboxes
131 // and radio buttons.
132 // -- Multi-line statics and XTextView controls
133 // can specify SZL_AUTOSIZE for cy only because
134 // we cannot determine the height without knowing
135 // the width.
136 //
137 // -- Any other _negative_ value is considered a
138 // percentage of the largest row width in the
139 // table. For example, -50 would mean 50% of
140 // the largest row in the table. This is valid
141 // for the CX field only.
142 // For this, we take the _box_ of the widest
143 // row, subtract the left spacing of the first
144 // column in that row and the right spacing of
145 // the last column in that row (because this
146 // field specifies the content rectangle, but
147 // the row already had spacing applied).
148 //
149 // If the CONTROLDEF appears with a START_NEW_TABLE
150 // type in _DLGHITEM (to specify a group table)
151 // and they are not SZL_AUTOSIZE, they specify the
152 // size of the inner table of the group (to override
153 // the automatic formatting). Note that the dialog
154 // adds extra spacing to this size:
155 // -- the group control's cx will be
156 // szlControlProposed.cx
157 // + 2 * ulSpacing
158 // + 2 * GROUP_INNER_SPACING_X
159 // -- the group control's cy will be
160 // szlControlProposed.cy
161 // + 2 * ulSpacing
162 // + GROUP_INNER_SPACING_Y
163 // + GROUP_INNER_SPACING_TOP
164
165 ULONG duSpacing;
166 // spacing around control; this is now in dialog
167 // units too V0.9.19 (2002-04-24) [umoeller]
168
169 PVOID pvCtlData; // for WinCreateWindow
170
171 } CONTROLDEF, *PCONTROLDEF;
172
173 typedef const struct _CONTROLDEF *PCCONTROLDEF;
174
175 /*
176 *@@ DLGHITEMTYPE:
177 *
178 */
179
180 typedef enum _DLGHITEMTYPE
181 {
182 TYPE_START_NEW_TABLE, // beginning of a new table; may nest
183 TYPE_START_NEW_ROW, // beginning of a new row in a table
184 TYPE_CONTROL_DEF, // control definition
185 TYPE_END_TABLE // end of a table
186 } DLGHITEMTYPE;
187
188 /*
189 *@@ DLGHITEM:
190 * dialog format array item.
191 *
192 * An array of these must be passed to dlghCreateDlg
193 * to tell it what controls the dialog contains.
194 * See dlghCreateDlg for details.
195 *
196 */
197
198 typedef struct _DLGHITEM
199 {
200 DLGHITEMTYPE Type;
201 // one of:
202 // TYPE_START_NEW_TABLE, // beginning of a new table
203 // TYPE_START_NEW_ROW, // beginning of a new row in a table
204 // TYPE_CONTROL_DEF // control definition
205 // TYPE_END_TABLE // end of table
206
207 ULONG ul1; // const CONTROLDEF *pCtlDef;
208 // -- with TYPE_START_NEW_TABLE: if NULL, this starts
209 // an invisible table (for formatting only).
210 // Otherwise a _CONTROLDEF pointer to specify
211 // a control to be produced around the table.
212 // For example, you can specify a WC_STATIC
213 // with SS_GROUPBOX to create a group around
214 // the table.
215
216 ULONG ul2;
217 // -- with TYPE_START_NEW_TABLE. TABLE_* formatting flags.
218 #define TABLE_ALIGN_COLUMNS 0x0100
219 // used with START_TABLE_ALIGN to align the table's
220 // columns horizontalle
221 #define TABLE_INHERIT_SIZE 0x0200
222 // if set, the table width is set to the
223 // widest row in the parent table. Useful
224 // for making several group boxes align
225 // vertically.
226 // @@todo get rid of this, remove size
227 // from CONTROLDEF, and make size a field
228 // of DLGHITEM so that we can finally treat
229 // tables like controls WRT size
230
231 // -- with TYPE_START_NEW_ROW: ROW_* formatting flags.
232 #define ROW_VALIGN_MASK 0x0003
233 #define ROW_VALIGN_BOTTOM 0x0000
234 #define ROW_VALIGN_CENTER 0x0001
235 #define ROW_VALIGN_TOP 0x0002
236
237 } DLGHITEM, *PDLGHITEM;
238
239 typedef const struct _DLGHITEM *PCDLGHITEM;
240
241 // a few handy macros for defining templates
242
243 #define START_TABLE { TYPE_START_NEW_TABLE, (ULONG)NULL, 0 }
244
245 #define START_TABLE_EXT(fl) { TYPE_START_NEW_TABLE, (ULONG)NULL, fl }
246 // added V1.0.0 (2002-08-16) [umoeller]
247
248 #define START_TABLE_ALIGN START_TABLE_EXT(TABLE_ALIGN_COLUMNS)
249
250 #define START_GROUP_TABLE(pDef) { TYPE_START_NEW_TABLE, (ULONG)pDef, 0 }
251
252 #define START_GROUP_TABLE_EXT(pDef, fl) { TYPE_START_NEW_TABLE, (ULONG)pDef, fl }
253 // added V1.0.0 (2002-08-16) [umoeller]
254
255 #define START_GROUP_TABLE_ALIGN(pDef) START_GROUP_TABLE_EXT(pDef, TABLE_ALIGN_COLUMNS)
256
257 #define END_TABLE { TYPE_END_TABLE, (ULONG)NULL, 0 }
258
259 #define START_ROW(fl) { TYPE_START_NEW_ROW, (ULONG)NULL, fl }
260
261 #define CONTROL_DEF(pDef) { TYPE_CONTROL_DEF, (ULONG)pDef, 0 }
262
263 /* ******************************************************************
264 *
265 * Macros
266 *
267 ********************************************************************/
268
269 #define LOAD_STRING ((PCSZ)-1)
270
271 // if the following is defined, we ignore the Y factor
272 // when scaling dialog units to pixels but use the X
273 // factor twice. This will result in something specified
274 // to be 10x10 units to be square, but will result in
275 // problems because dialog units are based on the
276 // system default fonts and x is different from y then.
277 // #define USE_SQUARE_CORRELATION
278
279 // if you still want something to be vaguely square,
280 // try the following macro to calculate the CY from a CX
281 #ifdef USE_SQUARE_CORRELATION
282 #define MAKE_SQUARE_CY(cx) (cx)
283 #else
284 #define MAKE_SQUARE_CY(cx) (cx * 200 / 250)
285 #endif
286
287 #define DLG_OUTER_SPACING_X 4
288 // outer spacing applied around entire dialog;
289 // we now use 4 to match the spacing in Warp 4
290 // notebook pages V0.9.19 (2002-04-24) [umoeller]
291 #define DLG_OUTER_SPACING_Y 3
292
293 #ifdef DEBUG_DIALOG_WINDOWS
294 #define COMMON_SPACING 5
295 #else
296 #define COMMON_SPACING 1
297 #endif
298
299 #define GROUP_INNER_SPACING_X 3
300 #define GROUP_INNER_SPACING_BOTTOM 3
301 #define GROUP_INNER_SPACING_TOP 8
302 #define GROUP_OUTER_SPACING_X COMMON_SPACING
303 #define GROUP_OUTER_SPACING_BOTTOM COMMON_SPACING
304 #define GROUP_OUTER_SPACING_TOP COMMON_SPACING
305
306 #define STD_BUTTON_WIDTH 50
307
308 #ifdef USE_SQUARE_CORRELATION
309 #define STD_BUTTON_HEIGHT 15
310 #define STD_SPIN_HEIGHT 10
311 #else
312 #define STD_BUTTON_HEIGHT 12
313 #define STD_SPIN_HEIGHT 8
314 #endif
315
316 #define DEFAULT_TABLE_WIDTH 150
317
318 #define MSGBOX_TEXTWIDTH 200
319
320 // the following require INCL_WINSTATICS
321
322 #define CONTROLDEF_GROUP(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
323 WS_VISIBLE | SS_GROUPBOX | DT_MNEMONIC, \
324 id, CTL_COMMON_FONT, { cx, cy }, 0 }
325
326 #define LOADDEF_GROUP(id, cx) CONTROLDEF_GROUP(LOAD_STRING, id, cx, SZL_AUTOSIZE)
327
328 #define CONTROLDEF_SPACING(cx, cy) { WC_STATIC, NULL, \
329 SS_TEXT, \
330 -1, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING }
331
332 #define CONTROLDEF_TEXT(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
333 WS_VISIBLE | SS_TEXT | DT_LEFT | DT_VCENTER | DT_MNEMONIC, \
334 id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING }
335
336 #define LOADDEF_TEXT(id) CONTROLDEF_TEXT(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
337
338 #define CONTROLDEF_TEXT_CENTER(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
339 WS_VISIBLE | SS_TEXT | DT_CENTER | DT_VCENTER | DT_MNEMONIC, \
340 id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING }
341
342 #define CONTROLDEF_TEXT_RIGHT(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
343 WS_VISIBLE | SS_TEXT | DT_RIGHT | DT_VCENTER | DT_MNEMONIC, \
344 id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING }
345
346 #define LOADDEF_TEXT_RIGHT(id) CONTROLDEF_TEXT_RIGHT(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
347
348 #define CONTROLDEF_TEXT_WORDBREAK(pcsz, id, cx) { WC_STATIC, pcsz, \
349 WS_VISIBLE | SS_TEXT | DT_LEFT | DT_TOP | DT_WORDBREAK, \
350 id, CTL_COMMON_FONT, {cx, SZL_AUTOSIZE}, COMMON_SPACING }
351
352 #define CONTROLDEF_TEXT_WORDBREAK_CY(pcsz, id, cx, cy) { WC_STATIC, pcsz, \
353 WS_VISIBLE | SS_TEXT | DT_LEFT | DT_TOP | DT_WORDBREAK, \
354 id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING }
355
356 #define LOADDEF_TEXT_WORDBREAK(id, cx) CONTROLDEF_TEXT_WORDBREAK(LOAD_STRING, id, cx)
357
358 #define CONTROLDEF_TEXT_WORDBREAK_MNEMONIC(pcsz, id, cx) { WC_STATIC, pcsz, \
359 WS_VISIBLE | SS_TEXT | DT_LEFT | DT_TOP | DT_WORDBREAK | DT_MNEMONIC, \
360 id, CTL_COMMON_FONT, {cx, SZL_AUTOSIZE}, COMMON_SPACING }
361
362 #define LOADDEF_TEXT_WORDBREAK_MNEMONIC(id, cx) CONTROLDEF_TEXT_WORDBREAK_MNEMONIC(LOAD_STRING, id, cx)
363
364 #define CONTROLDEF_ICON(hptr, id) { WC_STATIC, (PCSZ)(hptr), \
365 WS_VISIBLE | SS_ICON | DT_LEFT | DT_VCENTER, \
366 id, CTL_COMMON_FONT, {SZL_AUTOSIZE, SZL_AUTOSIZE}, COMMON_SPACING }
367
368 #define CONTROLDEF_ICON_WIDER(hptr, id) { WC_STATIC, (PCSZ)(hptr), \
369 WS_VISIBLE | SS_ICON | DT_LEFT | DT_VCENTER, \
370 id, CTL_COMMON_FONT, {SZL_AUTOSIZE, SZL_AUTOSIZE}, 2 * COMMON_SPACING }
371
372 #define CONTROLDEF_BITMAP(hbm, id) { WC_STATIC, (PCSZ)(hbm), \
373 WS_VISIBLE | SS_BITMAP | DT_LEFT | DT_VCENTER, \
374 id, CTL_COMMON_FONT, {SZL_AUTOSIZE, SZL_AUTOSIZE}, COMMON_SPACING }
375
376 // the following require INCL_WINBUTTONS
377
378 #define CONTROLDEF_DEFPUSHBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
379 WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_DEFAULT, \
380 id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING }
381
382 #define LOADDEF_DEFPUSHBUTTON(id) CONTROLDEF_DEFPUSHBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT)
383
384 #define CONTROLDEF_PUSHBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
385 WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON, \
386 id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING }
387
388 #define LOADDEF_PUSHBUTTON(id) CONTROLDEF_PUSHBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT)
389
390 #define CONTROLDEF_DEFNOFOCUSBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
391 WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_DEFAULT | BS_NOPOINTERFOCUS, \
392 id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING }
393
394 #define CONTROLDEF_NOFOCUSBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
395 WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, \
396 id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING }
397
398 #define LOADDEF_NOFOCUSBUTTON(id) CONTROLDEF_NOFOCUSBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT)
399
400 #define CONTROLDEF_HELPPUSHBUTTON(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
401 WS_VISIBLE | WS_TABSTOP | BS_PUSHBUTTON | BS_HELP | BS_NOPOINTERFOCUS, \
402 id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING }
403
404 #define LOADDEF_HELPPUSHBUTTON(id) CONTROLDEF_HELPPUSHBUTTON(LOAD_STRING, id, STD_BUTTON_WIDTH, STD_BUTTON_HEIGHT)
405
406 #define CONTROLDEF_AUTOCHECKBOX(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
407 WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX, \
408 id, CTL_COMMON_FONT, { cx, cy }, COMMON_SPACING }
409
410 #define LOADDEF_AUTOCHECKBOX(id) CONTROLDEF_AUTOCHECKBOX(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
411
412 #define CONTROLDEF_FIRST_AUTORADIO(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
413 WS_VISIBLE | WS_TABSTOP | BS_AUTORADIOBUTTON | WS_GROUP, \
414 id, CTL_COMMON_FONT, { cx, cy }, COMMON_SPACING }
415
416 #define LOADDEF_FIRST_AUTORADIO(id) \
417 CONTROLDEF_FIRST_AUTORADIO(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
418
419 #define CONTROLDEF_NEXT_AUTORADIO(pcsz, id, cx, cy) { WC_BUTTON, pcsz, \
420 WS_VISIBLE | WS_TABSTOP | BS_AUTORADIOBUTTON, \
421 id, CTL_COMMON_FONT, { cx, cy }, COMMON_SPACING }
422
423 #define LOADDEF_NEXT_AUTORADIO(id) CONTROLDEF_NEXT_AUTORADIO(LOAD_STRING, id, SZL_AUTOSIZE, SZL_AUTOSIZE)
424
425 // the following require INCL_WINENTRYFIELDS
426
427 #define CONTROLDEF_ENTRYFIELD(pcsz, id, cx, cy) { WC_ENTRYFIELD, pcsz, \
428 WS_VISIBLE | WS_TABSTOP | ES_MARGIN | ES_AUTOSCROLL, \
429 id, CTL_COMMON_FONT, { cx, cy }, COMMON_SPACING }
430
431 // CONTROLDEF_ENTRYFIELD_PASSWD added V1.0.1 (2003-01-05) [umoeller]
432 #define CONTROLDEF_ENTRYFIELD_PASSWD(pcsz, id, cx, cy) { WC_ENTRYFIELD, pcsz, \
433 WS_VISIBLE | WS_TABSTOP | ES_MARGIN | ES_AUTOSCROLL | ES_UNREADABLE, \
434 id, CTL_COMMON_FONT, { cx, cy }, COMMON_SPACING }
435
436 #define CONTROLDEF_ENTRYFIELD_RO(pcsz, id, cx, cy) { WC_ENTRYFIELD, pcsz, \
437 WS_VISIBLE | WS_TABSTOP | ES_MARGIN | ES_READONLY | ES_AUTOSCROLL, \
438 id, CTL_COMMON_FONT, { cx, cy }, COMMON_SPACING }
439
440 // the following require INCL_WINMLE
441
442 #define CONTROLDEF_MLE(pcsz, id, cx, cy) { WC_MLE, pcsz, \
443 WS_VISIBLE | WS_TABSTOP | MLS_BORDER | MLS_IGNORETAB | MLS_WORDWRAP, \
444 id, CTL_COMMON_FONT, { cx, cy }, COMMON_SPACING }
445
446 // the following require INCL_WINLISTBOXES
447
448 #define CONTROLDEF_LISTBOX(id, cx, cy) { WC_LISTBOX, NULL, \
449 WS_VISIBLE | WS_TABSTOP | LS_HORZSCROLL | LS_NOADJUSTPOS, \
450 id, CTL_COMMON_FONT, { cx, cy }, COMMON_SPACING }
451
452 // the following require INCL_WINLISTBOXES and INCL_WINENTRYFIELDS
453
454 #define CONTROLDEF_DROPDOWN(id, cx, cy) { WC_COMBOBOX, NULL, \
455 WS_VISIBLE | WS_TABSTOP | LS_HORZSCROLL | CBS_DROPDOWN, \
456 id, CTL_COMMON_FONT, { cx, cy }, COMMON_SPACING }
457
458 #define CONTROLDEF_DROPDOWNLIST(id, cx, cy) { WC_COMBOBOX, NULL, \
459 WS_VISIBLE | WS_TABSTOP | LS_HORZSCROLL | CBS_DROPDOWNLIST, \
460 id, CTL_COMMON_FONT, { cx, cy }, COMMON_SPACING }
461
462 // the following require INCL_WINSTDSPIN
463
464 #define CONTROLDEF_SPINBUTTON(id, cx, cy) { WC_SPINBUTTON, NULL, \
465 WS_VISIBLE | WS_TABSTOP | SPBS_MASTER | SPBS_NUMERICONLY | SPBS_JUSTCENTER | SPBS_FASTSPIN, \
466 id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING }
467
468 // the following require INCL_WINSTDCNR
469
470 #define CONTROLDEF_CONTAINER(id, cx, cy) { WC_CONTAINER, NULL, \
471 WS_VISIBLE | WS_TABSTOP | 0, \
472 id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING }
473
474 #define CONTROLDEF_CONTAINER_EXTSEL(id, cx, cy) { WC_CONTAINER, NULL, \
475 WS_VISIBLE | WS_TABSTOP | CCS_EXTENDSEL, \
476 id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING }
477
478 // the following require INCL_WINSTDSLIDER
479
480 #define CONTROLDEF_SLIDER(id, cx, cy, pctldata) { WC_SLIDER, NULL, \
481 WS_VISIBLE | WS_TABSTOP | WS_GROUP | SLS_HORIZONTAL | SLS_PRIMARYSCALE1 \
482 | SLS_BUTTONSRIGHT | SLS_SNAPTOINCREMENT, \
483 id, CTL_COMMON_FONT, {cx, cy}, 0, pctldata }
484 // id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING, pctldata }
485
486 #define CONTROLDEF_VSLIDER(id, cx, cy, pctldata) { WC_SLIDER, NULL, \
487 WS_VISIBLE | WS_TABSTOP | WS_GROUP | SLS_VERTICAL | SLS_PRIMARYSCALE1 \
488 | SLS_BUTTONSRIGHT | SLS_SNAPTOINCREMENT, \
489 id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING, pctldata }
490
491 // the following require #include helpers\comctl.h
492 #define CONTROLDEF_SEPARATORLINE(id, cx, cy) { WC_CCTL_SEPARATOR, NULL, \
493 WS_VISIBLE, \
494 id, NULL, {cx, cy}, COMMON_SPACING }
495
496 // the following require #include helpers\textview.h
497
498 #define CONTROLDEF_XTEXTVIEW(text, id, cx, pctldata) { WC_XTEXTVIEW, text, \
499 WS_VISIBLE | XS_STATIC | XS_WORDWRAP, \
500 id, CTL_COMMON_FONT, {cx, SZL_AUTOSIZE}, COMMON_SPACING, pctldata }
501
502 #define CONTROLDEF_XTEXTVIEW_HTML(text, id, cx, pctldata) { WC_XTEXTVIEW, text, \
503 WS_VISIBLE | XS_STATIC | XS_WORDWRAP | XS_HTML, \
504 id, CTL_COMMON_FONT, {cx, SZL_AUTOSIZE}, COMMON_SPACING, pctldata }
505
506 /* ******************************************************************
507 *
508 * Dialog formatter entry points
509 *
510 ********************************************************************/
511
512 #ifndef FCF_CLOSEBUTTON
513 #define FCF_CLOSEBUTTON 0x04000000L // toolkit 4 only
514 #endif
515
516 #define FCF_FIXED_DLG FCF_TITLEBAR | FCF_SYSMENU | FCF_DLGBORDER | FCF_NOBYTEALIGN | FCF_CLOSEBUTTON
517 #define FCF_SIZEABLE_DLG FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_NOBYTEALIGN | FCF_CLOSEBUTTON
518
519 APIRET XWPENTRY dlghCreateDlg(HWND *phwndDlg,
520 HWND hwndOwner,
521 ULONG flCreateFlags,
522 PFNWP pfnwpDialogProc,
523 PCSZ pcszDlgTitle,
524 PCDLGHITEM paDlgItems,
525 ULONG cDlgItems,
526 PVOID pCreateParams,
527 PCSZ pcszControlsFont);
528 typedef APIRET XWPENTRY DLGHCREATEDLG(HWND *phwndDlg,
529 HWND hwndOwner,
530 ULONG flCreateFlags,
531 PFNWP pfnwpDialogProc,
532 PCSZ pcszDlgTitle,
533 PCDLGHITEM paDlgItems,
534 ULONG cDlgItems,
535 PVOID pCreateParams,
536 PCSZ pcszControlsFont);
537 typedef DLGHCREATEDLG *PDLGHCREATEDLG;
538
539 #define DFFL_CREATECONTROLS 0x0002
540
541 APIRET dlghFormatDlg(HWND hwndDlg,
542 PCDLGHITEM paDlgItems,
543 ULONG cDlgItems,
544 PCSZ pcszControlsFont,
545 ULONG flFlags,
546 PSIZEL pszlClient,
547 PVOID *ppllControls);
548
549 VOID dlghResizeFrame(HWND hwndDlg,
550 PSIZEL pszlClient);
551
552 /* ******************************************************************
553 *
554 * Dialog arrays
555 *
556 ********************************************************************/
557
558 /*
559 *@@ DLGARRAY:
560 * dialog array structure used with dlghCreateArray.
561 * See remarks there.
562 *
563 *@@added V0.9.16 (2001-10-15) [umoeller]
564 */
565
566 typedef struct _DLGARRAY
567 {
568 DLGHITEM *paDlgItems; // array of DLGHITEM's, allocated once
569 // by dlghCreateArray
570 ULONG cDlgItemsMax, // copied from dlghCreateArray
571 cDlgItemsNow; // initially 0, raised after each
572 // dlghAppendToArray; pass this to the
573 // dialog formatter
574 } DLGARRAY, *PDLGARRAY;
575
576 APIRET dlghCreateArray(ULONG cMaxItems, PDLGARRAY *ppArray);
577 typedef APIRET DLGHCREATEARRAY(ULONG cMaxItems, PDLGARRAY *ppArray);
578 typedef DLGHCREATEARRAY *PDLGHCREATEARRAY;
579
580 APIRET dlghFreeArray(PDLGARRAY *ppArray);
581 typedef APIRET DLGHFREEARRAY(PDLGARRAY *ppArray);
582 typedef DLGHFREEARRAY *PDLGHFREEARRAY;
583
584 APIRET dlghAppendToArray(PDLGARRAY pArray,
585 PCDLGHITEM paItems,
586 ULONG cItems);
587 typedef APIRET DLGHAPPENDTOARRAY(PDLGARRAY pArray,
588 PCDLGHITEM paItems,
589 ULONG cItems);
590 typedef DLGHAPPENDTOARRAY *PDLGHAPPENDTOARRAY;
591
592 /* ******************************************************************
593 *
594 * Standard dialogs
595 *
596 ********************************************************************/
597
598 /*
599 *@@ MSGBOXSTRINGS:
600 *
601 *@@added V0.9.13 (2001-06-21) [umoeller]
602 */
603
604 typedef struct _MSGBOXSTRINGS
605 {
606 const char *pcszYes, // "~Yes"
607 *pcszNo, // "~No"
608 *pcszOK, // "~OK"
609 *pcszCancel, // "~Cancel"
610 *pcszAbort, // "~Abort"
611 *pcszRetry, // "~Retry"
612 *pcszIgnore, // "~Ignore"
613 *pcszEnter, // "~Help"
614 *pcszYesToAll, // "Yes to ~all"
615 *pcszHelp; // "~Help"
616 } MSGBOXSTRINGS, *PMSGBOXSTRINGS;
617
618 /* the following are in os2.h somewhere:
619 #define MB_OK 0x0000
620 #define MB_OKCANCEL 0x0001
621 #define MB_RETRYCANCEL 0x0002
622 #define MB_ABORTRETRYIGNORE 0x0003
623 #define MB_YESNO 0x0004
624 #define MB_YESNOCANCEL 0x0005
625 #define MB_CANCEL 0x0006
626 #define MB_ENTER 0x0007
627 #define MB_ENTERCANCEL 0x0008 */
628 // we add:
629 #define MB_YES_YES2ALL_NO 0x0009
630
631 /* the following are in os2.h somewhere:
632 #define MBID_OK 1
633 #define MBID_CANCEL 2
634 #define MBID_ABORT 3
635 #define MBID_RETRY 4
636 #define MBID_IGNORE 5
637 #define MBID_YES 6
638 #define MBID_NO 7
639 #define MBID_HELP 8
640 #define MBID_ENTER 9 */
641 // we add:
642 #define MBID_YES2ALL 10
643
644 typedef VOID APIENTRY FNHELP(HWND hwndDlg);
645 typedef FNHELP *PFNHELP;
646
647 APIRET dlghCreateMessageBox(HWND *phwndDlg,
648 HWND hwndOwner,
649 HPOINTER hptrIcon,
650 PCSZ pcszTitle,
651 PCSZ pcszMessage,
652 PFNHELP pfnHelp,
653 ULONG flFlags,
654 PCSZ pcszFont,
655 const MSGBOXSTRINGS *pStrings,
656 PULONG pulAlarmFlag);
657
658 ULONG dlghMessageBox(HWND hwndOwner,
659 HPOINTER hptrIcon,
660 PCSZ pcszTitle,
661 PCSZ pcszMessage,
662 PFNHELP pfnHelp,
663 ULONG flFlags,
664 PCSZ pcszFont,
665 const MSGBOXSTRINGS *pStrings);
666
667 #define TEBF_REMOVETILDE 0x0001
668 #define TEBF_REMOVEELLIPSE 0x0002
669 #define TEBF_SELECTALL 0x0004
670
671 PSZ dlghTextEntryBox(HWND hwndOwner,
672 PCSZ pcszTitle,
673 PCSZ pcszDescription,
674 PCSZ pcszDefault,
675 PCSZ pcszOK,
676 PCSZ pcszCancel,
677 ULONG ulMaxLen,
678 ULONG fl,
679 PCSZ pcszFont);
680
681 /* ******************************************************************
682 *
683 * Dialog input handlers
684 *
685 ********************************************************************/
686
687 VOID dlghSetPrevFocus(PVOID pvllWindows);
688
689 VOID dlghSetNextFocus(PVOID pvllWindows);
690
691 HWND dlghProcessMnemonic(PVOID pvllWindows,
692 USHORT usch);
693
694 BOOL dlghEnter(PVOID pvllWindows);
695
696#endif
697
698#if __cplusplus
699}
700#endif
701
Note: See TracBrowser for help on using the repository browser.