source: branches/branch-1-0/include/helpers/dialog.h@ 264

Last change on this file since 264 was 229, checked in by umoeller, 23 years ago

Sources as of 1.0.0.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 29.6 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 #define CONTROLDEF_ENTRYFIELD_RO(pcsz, id, cx, cy) { WC_ENTRYFIELD, pcsz, \
432 WS_VISIBLE | WS_TABSTOP | ES_MARGIN | ES_READONLY | ES_AUTOSCROLL, \
433 id, CTL_COMMON_FONT, { cx, cy }, COMMON_SPACING }
434
435 // the following require INCL_WINMLE
436
437 #define CONTROLDEF_MLE(pcsz, id, cx, cy) { WC_MLE, pcsz, \
438 WS_VISIBLE | WS_TABSTOP | MLS_BORDER | MLS_IGNORETAB | MLS_WORDWRAP, \
439 id, CTL_COMMON_FONT, { cx, cy }, COMMON_SPACING }
440
441 // the following require INCL_WINLISTBOXES
442
443 #define CONTROLDEF_LISTBOX(id, cx, cy) { WC_LISTBOX, NULL, \
444 WS_VISIBLE | WS_TABSTOP | LS_HORZSCROLL | LS_NOADJUSTPOS, \
445 id, CTL_COMMON_FONT, { cx, cy }, COMMON_SPACING }
446
447 // the following require INCL_WINLISTBOXES and INCL_WINENTRYFIELDS
448
449 #define CONTROLDEF_DROPDOWN(id, cx, cy) { WC_COMBOBOX, NULL, \
450 WS_VISIBLE | WS_TABSTOP | LS_HORZSCROLL | CBS_DROPDOWN, \
451 id, CTL_COMMON_FONT, { cx, cy }, COMMON_SPACING }
452
453 #define CONTROLDEF_DROPDOWNLIST(id, cx, cy) { WC_COMBOBOX, NULL, \
454 WS_VISIBLE | WS_TABSTOP | LS_HORZSCROLL | CBS_DROPDOWNLIST, \
455 id, CTL_COMMON_FONT, { cx, cy }, COMMON_SPACING }
456
457 // the following require INCL_WINSTDSPIN
458
459 #define CONTROLDEF_SPINBUTTON(id, cx, cy) { WC_SPINBUTTON, NULL, \
460 WS_VISIBLE | WS_TABSTOP | SPBS_MASTER | SPBS_NUMERICONLY | SPBS_JUSTCENTER | SPBS_FASTSPIN, \
461 id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING }
462
463 // the following require INCL_WINSTDCNR
464
465 #define CONTROLDEF_CONTAINER(id, cx, cy) { WC_CONTAINER, NULL, \
466 WS_VISIBLE | WS_TABSTOP | 0, \
467 id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING }
468
469 #define CONTROLDEF_CONTAINER_EXTSEL(id, cx, cy) { WC_CONTAINER, NULL, \
470 WS_VISIBLE | WS_TABSTOP | CCS_EXTENDSEL, \
471 id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING }
472
473 // the following require INCL_WINSTDSLIDER
474
475 #define CONTROLDEF_SLIDER(id, cx, cy, pctldata) { WC_SLIDER, NULL, \
476 WS_VISIBLE | WS_TABSTOP | WS_GROUP | SLS_HORIZONTAL | SLS_PRIMARYSCALE1 \
477 | SLS_BUTTONSRIGHT | SLS_SNAPTOINCREMENT, \
478 id, CTL_COMMON_FONT, {cx, cy}, 0, pctldata }
479 // id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING, pctldata }
480
481 #define CONTROLDEF_VSLIDER(id, cx, cy, pctldata) { WC_SLIDER, NULL, \
482 WS_VISIBLE | WS_TABSTOP | WS_GROUP | SLS_VERTICAL | SLS_PRIMARYSCALE1 \
483 | SLS_BUTTONSRIGHT | SLS_SNAPTOINCREMENT, \
484 id, CTL_COMMON_FONT, {cx, cy}, COMMON_SPACING, pctldata }
485
486 // the following require #include helpers\comctl.h
487 #define CONTROLDEF_SEPARATORLINE(id, cx, cy) { WC_SEPARATORLINE, NULL, \
488 WS_VISIBLE, \
489 id, NULL, {cx, cy}, COMMON_SPACING }
490
491 // the following require #include helpers\textview.h
492
493 #define CONTROLDEF_XTEXTVIEW(text, id, cx, pctldata) { WC_XTEXTVIEW, text, \
494 WS_VISIBLE | XS_STATIC | XS_WORDWRAP, \
495 id, CTL_COMMON_FONT, {cx, SZL_AUTOSIZE}, COMMON_SPACING, pctldata }
496
497 #define CONTROLDEF_XTEXTVIEW_HTML(text, id, cx, pctldata) { WC_XTEXTVIEW, text, \
498 WS_VISIBLE | XS_STATIC | XS_WORDWRAP | XS_HTML, \
499 id, CTL_COMMON_FONT, {cx, SZL_AUTOSIZE}, COMMON_SPACING, pctldata }
500
501 /* ******************************************************************
502 *
503 * Dialog formatter entry points
504 *
505 ********************************************************************/
506
507 #ifndef FCF_CLOSEBUTTON
508 #define FCF_CLOSEBUTTON 0x04000000L // toolkit 4 only
509 #endif
510
511 #define FCF_FIXED_DLG FCF_TITLEBAR | FCF_SYSMENU | FCF_DLGBORDER | FCF_NOBYTEALIGN | FCF_CLOSEBUTTON
512 #define FCF_SIZEABLE_DLG FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_NOBYTEALIGN | FCF_CLOSEBUTTON
513
514 APIRET XWPENTRY dlghCreateDlg(HWND *phwndDlg,
515 HWND hwndOwner,
516 ULONG flCreateFlags,
517 PFNWP pfnwpDialogProc,
518 PCSZ pcszDlgTitle,
519 PCDLGHITEM paDlgItems,
520 ULONG cDlgItems,
521 PVOID pCreateParams,
522 PCSZ pcszControlsFont);
523 typedef APIRET XWPENTRY DLGHCREATEDLG(HWND *phwndDlg,
524 HWND hwndOwner,
525 ULONG flCreateFlags,
526 PFNWP pfnwpDialogProc,
527 PCSZ pcszDlgTitle,
528 PCDLGHITEM paDlgItems,
529 ULONG cDlgItems,
530 PVOID pCreateParams,
531 PCSZ pcszControlsFont);
532 typedef DLGHCREATEDLG *PDLGHCREATEDLG;
533
534 #define DFFL_CREATECONTROLS 0x0002
535
536 APIRET dlghFormatDlg(HWND hwndDlg,
537 PCDLGHITEM paDlgItems,
538 ULONG cDlgItems,
539 PCSZ pcszControlsFont,
540 ULONG flFlags,
541 PSIZEL pszlClient,
542 PVOID *ppllControls);
543
544 VOID dlghResizeFrame(HWND hwndDlg,
545 PSIZEL pszlClient);
546
547 /* ******************************************************************
548 *
549 * Dialog arrays
550 *
551 ********************************************************************/
552
553 /*
554 *@@ DLGARRAY:
555 * dialog array structure used with dlghCreateArray.
556 * See remarks there.
557 *
558 *@@added V0.9.16 (2001-10-15) [umoeller]
559 */
560
561 typedef struct _DLGARRAY
562 {
563 DLGHITEM *paDlgItems; // array of DLGHITEM's, allocated once
564 // by dlghCreateArray
565 ULONG cDlgItemsMax, // copied from dlghCreateArray
566 cDlgItemsNow; // initially 0, raised after each
567 // dlghAppendToArray; pass this to the
568 // dialog formatter
569 } DLGARRAY, *PDLGARRAY;
570
571 APIRET dlghCreateArray(ULONG cMaxItems, PDLGARRAY *ppArray);
572 typedef APIRET DLGHCREATEARRAY(ULONG cMaxItems, PDLGARRAY *ppArray);
573 typedef DLGHCREATEARRAY *PDLGHCREATEARRAY;
574
575 APIRET dlghFreeArray(PDLGARRAY *ppArray);
576 typedef APIRET DLGHFREEARRAY(PDLGARRAY *ppArray);
577 typedef DLGHFREEARRAY *PDLGHFREEARRAY;
578
579 APIRET dlghAppendToArray(PDLGARRAY pArray,
580 PCDLGHITEM paItems,
581 ULONG cItems);
582 typedef APIRET DLGHAPPENDTOARRAY(PDLGARRAY pArray,
583 PCDLGHITEM paItems,
584 ULONG cItems);
585 typedef DLGHAPPENDTOARRAY *PDLGHAPPENDTOARRAY;
586
587 /* ******************************************************************
588 *
589 * Standard dialogs
590 *
591 ********************************************************************/
592
593 /*
594 *@@ MSGBOXSTRINGS:
595 *
596 *@@added V0.9.13 (2001-06-21) [umoeller]
597 */
598
599 typedef struct _MSGBOXSTRINGS
600 {
601 const char *pcszYes, // "~Yes"
602 *pcszNo, // "~No"
603 *pcszOK, // "~OK"
604 *pcszCancel, // "~Cancel"
605 *pcszAbort, // "~Abort"
606 *pcszRetry, // "~Retry"
607 *pcszIgnore, // "~Ignore"
608 *pcszEnter, // "~Help"
609 *pcszYesToAll, // "Yes to ~all"
610 *pcszHelp; // "~Help"
611 } MSGBOXSTRINGS, *PMSGBOXSTRINGS;
612
613 /* the following are in os2.h somewhere:
614 #define MB_OK 0x0000
615 #define MB_OKCANCEL 0x0001
616 #define MB_RETRYCANCEL 0x0002
617 #define MB_ABORTRETRYIGNORE 0x0003
618 #define MB_YESNO 0x0004
619 #define MB_YESNOCANCEL 0x0005
620 #define MB_CANCEL 0x0006
621 #define MB_ENTER 0x0007
622 #define MB_ENTERCANCEL 0x0008 */
623 // we add:
624 #define MB_YES_YES2ALL_NO 0x0009
625
626 /* the following are in os2.h somewhere:
627 #define MBID_OK 1
628 #define MBID_CANCEL 2
629 #define MBID_ABORT 3
630 #define MBID_RETRY 4
631 #define MBID_IGNORE 5
632 #define MBID_YES 6
633 #define MBID_NO 7
634 #define MBID_HELP 8
635 #define MBID_ENTER 9 */
636 // we add:
637 #define MBID_YES2ALL 10
638
639 typedef VOID APIENTRY FNHELP(HWND hwndDlg);
640 typedef FNHELP *PFNHELP;
641
642 APIRET dlghCreateMessageBox(HWND *phwndDlg,
643 HWND hwndOwner,
644 HPOINTER hptrIcon,
645 PCSZ pcszTitle,
646 PCSZ pcszMessage,
647 PFNHELP pfnHelp,
648 ULONG flFlags,
649 PCSZ pcszFont,
650 const MSGBOXSTRINGS *pStrings,
651 PULONG pulAlarmFlag);
652
653 ULONG dlghMessageBox(HWND hwndOwner,
654 HPOINTER hptrIcon,
655 PCSZ pcszTitle,
656 PCSZ pcszMessage,
657 PFNHELP pfnHelp,
658 ULONG flFlags,
659 PCSZ pcszFont,
660 const MSGBOXSTRINGS *pStrings);
661
662 #define TEBF_REMOVETILDE 0x0001
663 #define TEBF_REMOVEELLIPSE 0x0002
664 #define TEBF_SELECTALL 0x0004
665
666 PSZ dlghTextEntryBox(HWND hwndOwner,
667 PCSZ pcszTitle,
668 PCSZ pcszDescription,
669 PCSZ pcszDefault,
670 PCSZ pcszOK,
671 PCSZ pcszCancel,
672 ULONG ulMaxLen,
673 ULONG fl,
674 PCSZ pcszFont);
675
676 /* ******************************************************************
677 *
678 * Dialog input handlers
679 *
680 ********************************************************************/
681
682 VOID dlghSetPrevFocus(PVOID pvllWindows);
683
684 VOID dlghSetNextFocus(PVOID pvllWindows);
685
686 HWND dlghProcessMnemonic(PVOID pvllWindows,
687 USHORT usch);
688
689 BOOL dlghEnter(PVOID pvllWindows);
690
691#endif
692
693#if __cplusplus
694}
695#endif
696
Note: See TracBrowser for help on using the repository browser.