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

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

Misc updates.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 7.2 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 */
75
76 typedef struct _CONTROLDEF
77 {
78 const char *pcszClass; // registered PM window class
79 const char *pcszText;
80 // window text (class-specific)
81 // special hacks:
82 // -- For WS_STATIC with SS_BITMAP or SS_ICON set,
83 // you may specify the exact HPOINTER here.
84 // The dlg routine will then subclass the static
85 //
86
87 ULONG flStyle; // standard window styles
88
89 USHORT usID; // dlg item ID
90
91 const char *pcszFont; // font presparam, or NULL for no presparam,
92 // or CTL_COMMON_FONT for standard dialog
93 // font specified on input to dlghCreateDlg
94
95 USHORT usAdjustPosition;
96 // flags for winhAdjustControls; any combination of
97 // XAC_MOVEX, XAC_MOVEY, XAC_SIZEX, XAC_SIZEY
98
99 SIZEL szlControlProposed;
100 // proposed size; a number of special flags are
101 // available (per cx, cy field):
102 // -- SZL_AUTOSIZE: determine size automatically.
103 // Works only for statics with SS_TEXT and
104 // SS_BITMAP.
105 // This field is IGNORED if the CONTROLDEF appears
106 // with a START_NEW_TABLE type in _DLGHITEM.
107
108 ULONG ulSpacing; // spacing around control
109
110 } CONTROLDEF, *PCONTROLDEF;
111
112 /*
113 *@@ DLGHITEMTYPE:
114 *
115 */
116
117 typedef enum _DLGHITEMTYPE
118 {
119 TYPE_START_NEW_TABLE, // beginning of a new table; may nest
120 TYPE_START_NEW_ROW, // beginning of a new row in a table
121 TYPE_CONTROL_DEF, // control definition
122 TYPE_END_TABLE // end of a table
123 } DLGHITEMTYPE;
124
125 // a few handy macros for defining templates
126
127 #define START_TABLE { TYPE_START_NEW_TABLE, 0 }
128
129 // this macro is slightly insane, but performs type checking
130 // in case the user gives a pointer which is not of CONTROLDEF
131 #define START_GROUP_TABLE(pDef) { TYPE_START_NEW_TABLE, \
132 ( (ULONG)(&(pDef)->pcszClass) ) }
133
134 #define END_TABLE { TYPE_END_TABLE, 0 }
135
136 #define START_ROW(fl) { TYPE_START_NEW_ROW, fl }
137
138 #define CONTROL_DEF(pDef) { TYPE_CONTROL_DEF, \
139 ( (ULONG)(&(pDef)->pcszClass) ) }
140
141 /*
142 *@@ DLGHITEM:
143 * dialog format array item.
144 *
145 * An array of these must be passed to dlghCreateDlg
146 * to tell it what controls the dialog contains.
147 * See dlghCreateDlg for details.
148 *
149 */
150
151 typedef struct _DLGHITEM
152 {
153 DLGHITEMTYPE Type;
154 // one of:
155 // TYPE_START_NEW_TABLE, // beginning of a new table
156 // TYPE_START_NEW_ROW, // beginning of a new row in a table
157 // TYPE_CONTROL_DEF // control definition
158 // TYPE_END_TABLE // end of table
159
160 ULONG ulData;
161 // -- with TYPE_START_NEW_TABLE: if NULL, this starts
162 // an invisible table (for formatting only).
163 // Otherwise a _CONTROLDEF pointer to specify
164 // a control to be produced around the table.
165 // For example, you can specify a WC_STATIC
166 // with SS_GROUPBOX to create a group around
167 // the table.
168 // -- with TYPE_START_NEW_ROW: ROW_* formatting flags.
169 // -- with TYPE_CONTROL_DEF: _CONTROLDEF pointer to a control definition
170 } DLGHITEM, *PDLGHITEM;
171
172 /* ******************************************************************
173 *
174 * APIs
175 *
176 ********************************************************************/
177
178 APIRET dlghCreateDlg(HWND *phwndDlg,
179 HWND hwndOwner,
180 ULONG flCreateFlags,
181 PFNWP pfnwpDialogProc,
182 const char *pcszDlgTitle,
183 PDLGHITEM paDlgItems,
184 ULONG cDlgItems,
185 PVOID pCreateParams,
186 const char *pcszControlsFont);
187
188 VOID dlghSetPrevFocus(PVOID pvllWindows);
189
190 VOID dlghSetNextFocus(PVOID pvllWindows);
191
192 HWND dlghProcessMnemonic(PVOID pvllWindows,
193 USHORT usch);
194
195 BOOL dlghEnter(PVOID pvllWindows);
196
197#endif
198
199#if __cplusplus
200}
201#endif
202
Note: See TracBrowser for help on using the repository browser.