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

Last change on this file since 85 was 85, checked in by umoeller, 24 years ago

Misc changes.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 10.5 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 DLGERR_FIRST 10000
45 #define DLGERR_ROW_BEFORE_TABLE (DLGERR_FIRST)
46 #define DLGERR_CONTROL_BEFORE_ROW (DLGERR_FIRST + 1)
47 #define DLGERR_NULL_CTL_DEF (DLGERR_FIRST + 2)
48 #define DLGERR_CANNOT_CREATE_FRAME (DLGERR_FIRST + 3)
49 #define DLGERR_INVALID_CODE (DLGERR_FIRST + 4)
50 #define DLGERR_TABLE_NOT_CLOSED (DLGERR_FIRST + 5)
51 #define DLGERR_TOO_MANY_TABLES_CLOSED (DLGERR_FIRST + 6)
52
53 /* ******************************************************************
54 *
55 * Structures
56 *
57 ********************************************************************/
58
59 #define SZL_AUTOSIZE (-1)
60
61 #define CTL_COMMON_FONT ((const char *)-1)
62
63 #define ROW_VALIGN_MASK 0x0003
64 #define ROW_VALIGN_BOTTOM 0x0000
65 #define ROW_VALIGN_CENTER 0x0001
66 #define ROW_VALIGN_TOP 0x0002
67
68 /*
69 *@@ CONTROLDEF:
70 * defines a single control. Used
71 * with the TYPE_CONTROL_DEF type in
72 * DLGHITEM.
73 *
74 *@@changed V0.9.12 (2001-05-31) [umoeller]: added control data
75 */
76
77 typedef struct _CONTROLDEF
78 {
79 const char *pcszClass; // registered PM window class
80 const char *pcszText;
81 // window text (class-specific)
82 // special hacks:
83 // -- For WS_STATIC with SS_BITMAP or SS_ICON set,
84 // you may specify the exact HPOINTER here.
85 // The dlg routine will then subclass the static
86 //
87
88 ULONG flStyle; // standard window styles
89
90 USHORT usID; // dlg item ID
91
92 const char *pcszFont; // font presparam, or NULL for no presparam,
93 // or CTL_COMMON_FONT for standard dialog
94 // font specified on input to dlghCreateDlg
95
96 USHORT usAdjustPosition;
97 // flags for winhAdjustControls; any combination of
98 // XAC_MOVEX, XAC_MOVEY, XAC_SIZEX, XAC_SIZEY
99
100 SIZEL szlControlProposed;
101 // proposed size; a number of special flags are
102 // available (per cx, cy field):
103 // -- SZL_AUTOSIZE: determine size automatically.
104 // Works only for statics with SS_TEXT and
105 // SS_BITMAP.
106 // This field is IGNORED if the CONTROLDEF appears
107 // with a START_NEW_TABLE type in _DLGHITEM.
108
109 ULONG ulSpacing; // spacing around control
110
111 PVOID pvCtlData; // for WinCreateWindow
112
113 } CONTROLDEF, *PCONTROLDEF;
114
115 /*
116 *@@ DLGHITEMTYPE:
117 *
118 */
119
120 typedef enum _DLGHITEMTYPE
121 {
122 TYPE_START_NEW_TABLE, // beginning of a new table; may nest
123 TYPE_START_NEW_ROW, // beginning of a new row in a table
124 TYPE_CONTROL_DEF, // control definition
125 TYPE_END_TABLE // end of a table
126 } DLGHITEMTYPE;
127
128 // a few handy macros for defining templates
129
130 #define START_TABLE { TYPE_START_NEW_TABLE, 0 }
131
132 // this macro is slightly insane, but performs type checking
133 // in case the user gives a pointer which is not of CONTROLDEF
134 #define START_GROUP_TABLE(pDef) { TYPE_START_NEW_TABLE, \
135 ( (ULONG)(&(pDef)->pcszClass) ) }
136
137 #define END_TABLE { TYPE_END_TABLE, 0 }
138
139 #define START_ROW(fl) { TYPE_START_NEW_ROW, fl }
140
141 #define CONTROL_DEF(pDef) { TYPE_CONTROL_DEF, \
142 ( (ULONG)(&(pDef)->pcszClass) ) }
143
144 /*
145 *@@ DLGHITEM:
146 * dialog format array item.
147 *
148 * An array of these must be passed to dlghCreateDlg
149 * to tell it what controls the dialog contains.
150 * See dlghCreateDlg for details.
151 *
152 */
153
154 typedef struct _DLGHITEM
155 {
156 DLGHITEMTYPE Type;
157 // one of:
158 // TYPE_START_NEW_TABLE, // beginning of a new table
159 // TYPE_START_NEW_ROW, // beginning of a new row in a table
160 // TYPE_CONTROL_DEF // control definition
161 // TYPE_END_TABLE // end of table
162
163 ULONG ulData;
164 // -- with TYPE_START_NEW_TABLE: if NULL, this starts
165 // an invisible table (for formatting only).
166 // Otherwise a _CONTROLDEF pointer to specify
167 // a control to be produced around the table.
168 // For example, you can specify a WC_STATIC
169 // with SS_GROUPBOX to create a group around
170 // the table.
171 // -- with TYPE_START_NEW_ROW: ROW_* formatting flags.
172 // -- with TYPE_CONTROL_DEF: _CONTROLDEF pointer to a control definition
173 } DLGHITEM, *PDLGHITEM;
174
175 /* ******************************************************************
176 *
177 * APIs
178 *
179 ********************************************************************/
180
181 APIRET XWPENTRY dlghCreateDlg(HWND *phwndDlg,
182 HWND hwndOwner,
183 ULONG flCreateFlags,
184 PFNWP pfnwpDialogProc,
185 const char *pcszDlgTitle,
186 PDLGHITEM paDlgItems,
187 ULONG cDlgItems,
188 PVOID pCreateParams,
189 const char *pcszControlsFont);
190 typedef APIRET XWPENTRY DLGHCREATEDLG(HWND *phwndDlg,
191 HWND hwndOwner,
192 ULONG flCreateFlags,
193 PFNWP pfnwpDialogProc,
194 const char *pcszDlgTitle,
195 PDLGHITEM paDlgItems,
196 ULONG cDlgItems,
197 PVOID pCreateParams,
198 const char *pcszControlsFont);
199 typedef DLGHCREATEDLG *PDLGHCREATEDLG;
200
201 /*
202 *@@ MSGBOXSTRINGS:
203 *
204 *@@added V0.9.13 (2001-06-21) [umoeller]
205 */
206
207 typedef struct _MSGBOXSTRINGS
208 {
209 const char *pcszYes, // "~Yes"
210 *pcszNo, // "~No"
211 *pcszOK, // "~OK"
212 *pcszCancel, // "~Cancel"
213 *pcszAbort, // "~Abort"
214 *pcszRetry, // "~Retry"
215 *pcszIgnore, // "~Ignore"
216 *pcszEnter,
217 *pcszYesToAll; // "Yes to ~all"
218 } MSGBOXSTRINGS, *PMSGBOXSTRINGS;
219
220 /* the following are in os2.h somewhere:
221 #define MB_OK 0x0000
222 #define MB_OKCANCEL 0x0001
223 #define MB_RETRYCANCEL 0x0002
224 #define MB_ABORTRETRYIGNORE 0x0003
225 #define MB_YESNO 0x0004
226 #define MB_YESNOCANCEL 0x0005
227 #define MB_CANCEL 0x0006
228 #define MB_ENTER 0x0007
229 #define MB_ENTERCANCEL 0x0008 */
230 // we add:
231 #define MB_YES_YES2ALL_NO 0x0009
232
233 /* the following are in os2.h somewhere:
234 #define MBID_OK 1
235 #define MBID_CANCEL 2
236 #define MBID_ABORT 3
237 #define MBID_RETRY 4
238 #define MBID_IGNORE 5
239 #define MBID_YES 6
240 #define MBID_NO 7
241 #define MBID_HELP 8
242 #define MBID_ENTER 9 */
243 // we add:
244 #define MBID_YES2ALL 10
245
246 APIRET dlghCreateMessageBox(HWND *phwndDlg,
247 HWND hwndOwner,
248 HPOINTER hptrIcon,
249 const char *pcszTitle,
250 const char *pcszMessage,
251 ULONG flFlags,
252 const char *pcszFont,
253 const MSGBOXSTRINGS *pStrings,
254 PULONG pulAlarmFlag);
255
256 ULONG dlghMessageBox(HWND hwndOwner,
257 HPOINTER hptrIcon,
258 const char *pcszTitle,
259 const char *pcszMessage,
260 ULONG flFlags,
261 const char *pcszFont,
262 const MSGBOXSTRINGS *pStrings);
263
264 VOID dlghSetPrevFocus(PVOID pvllWindows);
265
266 VOID dlghSetNextFocus(PVOID pvllWindows);
267
268 HWND dlghProcessMnemonic(PVOID pvllWindows,
269 USHORT usch);
270
271 BOOL dlghEnter(PVOID pvllWindows);
272
273#endif
274
275#if __cplusplus
276}
277#endif
278
Note: See TracBrowser for help on using the repository browser.