aboutsummaryrefslogtreecommitdiff
path: root/libXaw/spec/Dialog
blob: d14bca0b47d304b62e0bb8ccec561cdc518cac47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
.\" $Xorg: Dialog,v 1.3 2000/08/17 19:42:26 cpqbld Exp $
.NH 2
Dialog Widget
.LP
.XS
	Dialog Widget
.XE
.IN "Dialog widget" "" "@DEF@"
.Ds 0
.TA 2.0i
.ta 2.0i
.sp
Application Header file	<X11/Xaw/Dialog.h>
.IN "Dialog.h" ""
Class Header file	<X11/Xaw/DialogP.h>
.IN "DialogP.h" ""
Class		dialogWidgetClass
.IN "dialogWidgetClass" ""
Class Name	Dialog
.IN "Dialog widget" "class name"
Superclass	Form
.sp
.De
.LP
The Dialog widget implements a commonly used interaction semantic to
prompt for auxiliary input from a user.  For example, you can use a
Dialog widget when an application requires a small piece of information,
such as a filename, from the user.  A Dialog widget, which is simply a
special case of the Form widget, provides a convenient way to create a
preconfigured form.
.LP
The typical Dialog widget contains three areas.  The first line
contains a description of the function of the Dialog widget, for
example, the string \fIFilename:\fP.  The second line contains an area
into which the user types input.  The third line can contain buttons
that let the user confirm or cancel the Dialog input.  Any of these
areas may be omitted by the application.
.NH 3
Resources
.LP
When creating a Dialog widget instance, the following resources are
retrieved from the argument list or the resource database:
.IN "Dialog widget" "resources"
.TS H
expand;
lw(1i) lw(1i) lw(1i) lw(.5i) lw(2i).
_
.sp 3p
.TB
Name	Class	Type	Notes	Default Value
.sp 3p
_
.TH
.R
.sp 3p
accelerators	Accelerators	AcceleratorTable		NULL
ancestorSensitive	AncestorSensitive	Boolean	D	True
background	Background	Pixel		XtDefaultBackground
backgroundPixmap	Pixmap	Pixmap		XtUnspecifiedPixmap
borderColor	BorderColor	Pixel		XtDefaultForeground
borderPixmap	Pixmap	Pixmap		XtUnspecifiedPixmap
borderWidth	BorderWidth	Dimension		1
children	ReadOnly	WidgetList	R	NULL
colormap	Colormap	Colormap		Parent's Colormap
defaultDistance	Thickness	int		4
depth	Depth	int	C	Parent's Depth
destroyCallback	Callback	XtCallbackList		NULL
height	Height	Dimension	A	Enough space to contain all children
icon	Icon	Bitmap		None
label	Label	String		"label"
mappedWhenManaged	MappedWhenManaged	Boolean		True
numChildren	ReadOnly	Cardinal	R	0
screen	Screen	Screen	R	Parent's Screen
sensitive	Sensitive	Boolean		True
translations	Translations	TranslationTable		NULL
value	Value	String		no value widget
width	Width	Dimension	A	Enough space to contain all children
x	Position	Position		0
y	Position	Position		0
.sp 3p
_
.TE
.Ac
.As
.Bg
.Gp
.Bc
.Bp
.Bw
.Ch
.Cm
.Dd
.Dp
.Dc
.Hw
.IP \fBicon\fP 1.5i
A pixmap image to be displayed immediately to the left of the
Dialog widget's label.
.IP \fBlabel\fP 1.5i
A string to be displayed at the top of the Dialog widget.
.Mm
.Nc
.Sc
.Se
.Tr
.IP \fBvalue\fP 1.5i
An initial value for the string field that the user will enter text
into.  By default, no text entry field is available to the user.
Specifying an initial value for \fBvalue\fP activates the text entry
field.  If string input is desired, but no initial value is to be
specified then set this resource to "" (empty string).
.Xy
.NH 3
Constraint Resources
.LP
.IN "Dialog widget" "constraint resources"
Each child of the Dialog widget may request special layout resources
be applied to it.  These \fIconstraint\fP resources allow the Dialog
widget's children to specify individual layout requirements.
.LP
.TS H
lw(1i) lw(1i) lw(1i) lw(.5i) lw(2i).
_
.sp 3p
.TB
Name	Class	Type	Notes	Default Value
.sp 3p
_
.TH
.R
.sp 3p
bottom	Edge	XawEdgeType		XawRubber
fromHoriz	Widget	Widget		NULL (left edge of Dialog)
fromVert	Widget	Widget 		NULL (top edge of Dialog)
horizDistance	Thickness	int		\fBdefaultDistance\fP resource
left	Edge	XawEdgeType		XawRubber
.IN "XawEdgeType" ""
resizable	Boolean	Boolean		FALSE
right	Edge	XawEdgeType		XawRubber
.IN "XawRubber" ""
top	Edge	XawEdgeType		XawRubber
vertDistance	Thickness	int		\fBdefaultDistance\fP resource
.sp 3p
_
.TE
.Bt
.Fh
.Hd
.Rl
.NH 3
Layout Semantics
.IN "Dialog widget" "layout semantics"
.LP
.Lt Dialog
.LP
.TS H
lw(1.5i) lw(1i) lw(3i).
_
.sp 3p
.TB
Edge Type	Resource Name	Description
.sp 3p
_
.TH
.R
.sp 3p
XawChainBottom	ChainBottom	Edge remains a fixed distance from bottom of Dialog
.IN "XawChainBottom" ""
XawChainLeft	ChainLeft	Edge remains a fixed distance from left of Dialog
.IN "XawChainLeft" ""
XawChainRight	ChainRight	Edge remains a fixed distance from right of Dialog
.IN "XawChainRight" ""
XawChainTop	ChainTop	Edge remains a fixed distance from top of Dialog
.IN "XawChainTop" ""
XawRubber	Rubber	Edges will move a proportional distance
.IN "XawRubber" ""
.sp 3p
_
.TE
.NH 4
Example
.LP
If you wish to force the Dialog to never resize one or more of its children
then set \fBleft\fP and \fBright\fP to \fBXawChainLeft\fP and
\fBtop\fP and \fBbottom\fP to \fBXawChainTop\fP.  This will cause
the child to remain a fixed distance from the top and left
edges of the Dialog, and to never resize.
.NH 4
Special Considerations
.IN "Dialog widget" "special considerations"
.LP
The Dialog widget automatically sets the \fBtop\fP and \fBbottom\fP
resources for all Children that are subclasses of the Command widget,
as well as the widget children that are used to contain the \fBlabel\fP,
\fBvalue\fP, and \fBicon\fP.  This policy allows the buttons at the
bottom of the Dialog to interact correctly with the predefined children,
and makes it possible for a client to simply create and manage a new
Command button without having to specify its constraints.
.LP
The Dialog will also set \fBfromLeft\fP to the last button in the
.IN "fromLeft" ""
Dialog for each new button added to the Dialog widget.
.LP
The automatically added constraints cannot be overridden, as they are
policy decisions of the Dialog widget.  If a more flexible Dialog is
desired, the application is free to use the Form widget to create its
own Dialog policy.
.NH 3
Automatically Created Children.
.IN "Dialog widget" "automatically created children"
.LP
The Dialog uses Label widgets to contain the \fBlabel\fP and \fBicon\fP.
These widgets are named \fIlabel\fP and \fIicon\fP respectively.  The
Dialog \fBvalue\fP is contained in an AsciiText widget whose name is
\fIvalue\fP.  Using \fBXtNameToWidget\fP the application can change
.IN "XtNameToWidget" ""
those resources associated with each of these widgets that are not
available through the Dialog widget itself.
.LP
.NH 3
Convenience Routines
.LP
To return the character string in the text field, use
.PN XawDialogGetValueString .
.IN "XawDialogGetValueString" "" "@DEF@"
.FD 0
String XawDialogGetValueString(\fIw\fP)
.br
	Widget \fIw\fP;
.FN
.IP \fIw\fP 1i
Specifies the Dialog widget.
.LP
This function returns a copy of the value string of the Dialog
widget.  This string is allocated by the AsciiText widget and will
remain valid and unchanged until another call to
\fBXawDialogGetValueString\fP or an \fBXtGetValues\fP call on the
\fBvalue\fP widget, when the string will be automatically freed, and
a new string is returned.  This string may be freed earlier by calling
the function \fBXawAsciiSourceFreeString\fP.
.IN "XawAsciiSourceFreeString" ""
.LP
.sp
To add a new button to the Dialog widget use
\fBXawDialogAddButton\fP.
.IN "XawDialogAddButton" "" "@DEF@"
.FD 0
void XawDialogAddButton(\fIw\fP, \fIname\fP, \fIfunc\fP, \fIclient_data\fP)
.br
	Widget \fIw\fP;
.br
	String \fIname\fP;
.br
	XtCallbackProc \fIfunc\fP;
.br
	XtPointer \fIclient_data\fP;
.FN
.IP \fIw\fP 1i
Specifies the Dialog widget.
.IP \fIname\fP 1i
Specifies the name of the new Command button to be added to the Dialog.
.IP \fIfunc\fP 1i
Specifies a callback function to be called when this button is activated.  If
NULL is specified then no callback is added.
.IP \fIclient_data\fP 1i
Specifies the client_data to be passed to the \fIfunc\fP.
.LP
This function is merely a shorthand for the code sequence:
.sp
.Ds 0
.SM
.TA 1i 2i
.ta 1i 2i
{
	Widget button = XtCreateManagedWidget(name, commandWidgetClass, w, NULL, ZERO);
	XtAddCallback(button, XtNcallback, func, client_data);
}
.NL
.De
.sp