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

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

Dialog mgr.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 7.0 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 *@@include <os2.h>
10 *@@include #include "dialog.h"
11 */
12
13/* Copyright (C) 2001 Ulrich M”ller.
14 * This file is part of the "XWorkplace helpers" source package.
15 * This is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published
17 * by the Free Software Foundation, in version 2 as it comes in the
18 * "COPYING" file of the XWorkplace main distribution.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 */
24
25#if __cplusplus
26extern "C" {
27#endif
28
29#ifndef DIALOG_HEADER_INCLUDED
30 #define DIALOG_HEADER_INCLUDED
31
32 #ifndef NULL_POINT
33 #define NULL_POINT {0, 0}
34 #endif
35
36 /* ******************************************************************
37 *
38 * Error codes
39 *
40 ********************************************************************/
41
42 #define DLGERR_FIRST 10000
43 #define DLGERR_ROW_BEFORE_TABLE (DLGERR_FIRST)
44 #define DLGERR_CONTROL_BEFORE_ROW (DLGERR_FIRST + 1)
45 #define DLGERR_NULL_CTL_DEF (DLGERR_FIRST + 2)
46 #define DLGERR_CANNOT_CREATE_FRAME (DLGERR_FIRST + 3)
47 #define DLGERR_INVALID_CODE (DLGERR_FIRST + 4)
48 #define DLGERR_TABLE_NOT_CLOSED (DLGERR_FIRST + 5)
49 #define DLGERR_TOO_MANY_TABLES_CLOSED (DLGERR_FIRST + 6)
50
51 /* ******************************************************************
52 *
53 * Structures
54 *
55 ********************************************************************/
56
57 #define SZL_AUTOSIZE (-1)
58
59 #define CTL_COMMON_FONT ((const char *)-1)
60
61 #define ROW_VALIGN_MASK 0x0003
62 #define ROW_VALIGN_BOTTOM 0x0000
63 #define ROW_VALIGN_CENTER 0x0001
64 #define ROW_VALIGN_TOP 0x0002
65
66 /*
67 *@@ CONTROLDEF:
68 * defines a single control. Used
69 * with the TYPE_CONTROL_DEF type in
70 * DLGHITEM.
71 *
72 *@@added V0.9.9 (2001-04-01) [umoeller]
73 */
74
75 typedef struct _CONTROLDEF
76 {
77 const char *pcszClass; // registered PM window class
78 const char *pcszText;
79 // window text (class-specific)
80 // special hacks:
81 // -- For WS_STATIC with SS_BITMAP or SS_ICON set,
82 // you may specify the exact HPOINTER here.
83 // The dlg routine will then subclass the static
84 //
85
86 ULONG flStyle; // standard window styles
87
88 USHORT usID; // dlg item ID
89
90 const char *pcszFont; // font presparam, or NULL for no presparam,
91 // or CTL_COMMON_FONT for standard dialog
92 // font specified on input to dlghCreateDlg
93
94 USHORT usAdjustPosition;
95 // flags for winhAdjustControls; any combination of
96 // XAC_MOVEX, XAC_MOVEY, XAC_SIZEX, XAC_SIZEY
97
98 SIZEL szlControlProposed;
99 // proposed size; a number of special flags are
100 // available (per cx, cy field):
101 // -- SZL_AUTOSIZE: determine size automatically.
102 // Works only for statics with SS_TEXT and
103 // SS_BITMAP.
104 // This field is IGNORED if the CONTROLDEF appears
105 // with a START_NEW_TABLE type in _DLGHITEM.
106
107 ULONG ulSpacing; // spacing around control
108
109 } CONTROLDEF, *PCONTROLDEF;
110
111 /*
112 *@@ DLGHITEMTYPE:
113 *
114 *@@added V0.9.9 (2001-04-01) [umoeller]
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 *@@added V0.9.9 (2001-04-01) [umoeller]
150 */
151
152 typedef struct _DLGHITEM
153 {
154 DLGHITEMTYPE Type;
155 // one of:
156 // TYPE_START_NEW_TABLE, // beginning of a new table
157 // TYPE_START_NEW_ROW, // beginning of a new row in a table
158 // TYPE_CONTROL_DEF // control definition
159 // TYPE_END_TABLE // end of table
160
161 ULONG ulData;
162 // -- with TYPE_START_NEW_TABLE: if NULL, this starts
163 // an invisible table (for formatting only).
164 // Otherwise a _CONTROLDEF pointer to specify
165 // a control to be produced around the table.
166 // For example, you can specify a WC_STATIC
167 // with SS_GROUPBOX to create a group around
168 // the table.
169 // -- with TYPE_START_NEW_ROW: ROW_* formatting flags.
170 // -- with TYPE_CONTROL_DEF: _CONTROLDEF pointer to a control definition
171 } DLGHITEM, *PDLGHITEM;
172
173 /* ******************************************************************
174 *
175 * APIs
176 *
177 ********************************************************************/
178
179 APIRET dlghCreateDlg(HWND *phwndDlg,
180 HWND hwndOwner,
181 ULONG flCreateFlags,
182 PFNWP pfnwpDialogProc,
183 const char *pcszDlgTitle,
184 PDLGHITEM paDlgItems,
185 ULONG cDlgItems,
186 PVOID pCreateParams,
187 const char *pcszControlsFont);
188
189#endif
190
191#if __cplusplus
192}
193#endif
194
Note: See TracBrowser for help on using the repository browser.