~ubuntu-branches/debian/sid/libxt/sid

« back to all changes in this revision

Viewing changes to specs/CH05.xml

  • Committer: Package Import Robot
  • Author(s): Julien Cristau
  • Date: 2012-04-22 11:13:54 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20120422111354-bgq2l0n9x262ez70
Tags: 1:1.1.3-1
* New upstream release.
* Bump xutils-dev build-dep for newer macros.
* Enable unit tests.
* Drop -D_REENTRANT from CFLAGS, unneeded.
* No need to override dh_auto_install.
* Add a libxt-doc package for the specs.
* Remove David Nusinow from Uploaders.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<chapter id='Pop_Up_Widgets'>
 
2
<title>Pop-Up Widgets</title>
 
3
<para>
 
4
Pop-up widgets are used to create windows outside of the
 
5
window hierarchy defined by the widget tree.
 
6
Each pop-up child has a window that is a descendant of the root window,
 
7
so that the pop-up window is not clipped by the pop-up widget's parent window.
 
8
Therefore, pop-ups are created and attached differently to their widget parent
 
9
than normal widget children.
 
10
</para>
 
11
 
 
12
<para>
 
13
A parent of a pop-up widget does not actively manage its pop-up children;
 
14
in fact, it usually does not operate upon them in any way.
 
15
The <emphasis remap='I'>popup_list</emphasis> field in the
 
16
<function>CorePart</function>
 
17
structure contains the list of its pop-up children.
 
18
This pop-up list exists mainly to provide the proper place in the widget
 
19
hierarchy for the pop-up to get resources and to provide a place for
 
20
<xref linkend='XtDestroyWidget' xrefstyle='select: title'/>
 
21
to look for all extant children.
 
22
</para>
 
23
 
 
24
<para>
 
25
A
 
26
composite
 
27
widget can have both normal and pop-up children.
 
28
A pop-up can be popped up from almost anywhere, not just by its parent.
 
29
The term <emphasis remap='I'>child</emphasis> always refers to a normal, geometry-managed widget
 
30
on the composite widget's list of children, and the term
 
31
<emphasis remap='I'>pop-up child</emphasis> always refers to a
 
32
widget on the pop-up list.
 
33
</para>
 
34
 
 
35
<sect1 id="Pop_Up_Widget_Types">
 
36
<title>Pop-Up Widget Types</title>
 
37
<para>
 
38
There are three kinds of pop-up widgets:
 
39
</para>
 
40
 
 
41
<itemizedlist spacing='compact'>
 
42
  <listitem>
 
43
    <para>
 
44
Modeless pop-ups
 
45
    </para>
 
46
    <para>
 
47
A modeless pop-up (for example, a dialog box that does not prevent
 
48
continued interaction with the rest of the application)
 
49
can usually be manipulated by the window manager
 
50
and looks like any other application window from the
 
51
user's point of view.
 
52
The application main window itself is a special case of a modeless pop-up.
 
53
    </para>
 
54
  </listitem>
 
55
  <listitem>
 
56
    <para>
 
57
Modal pop-ups
 
58
    </para>
 
59
    <para>
 
60
A modal pop-up (for example, a dialog box that requires user input to
 
61
continue)
 
62
can sometimes be manipulated by the window manager,
 
63
and except for events that occur in the dialog box,
 
64
it disables user-event distribution to the rest of the application.
 
65
    </para>
 
66
  </listitem>
 
67
  <listitem>
 
68
    <para>
 
69
Spring-loaded pop-ups
 
70
    </para>
 
71
    <para>
 
72
A spring-loaded pop-up (for example, a menu)
 
73
can seldom be manipulated by the window manager,
 
74
and except for events that occur in the pop-up or its descendants,
 
75
it disables user-event distribution to all other applications.
 
76
    </para>
 
77
  </listitem>
 
78
</itemizedlist>
 
79
<para>
 
80
Modal pop-ups and spring-loaded pop-ups are very similar and should be coded as
 
81
if they were the same.
 
82
In fact, the same widget (for example, a ButtonBox or Menu widget) can be used both
 
83
as a modal pop-up and as a spring-loaded pop-up within the same application.
 
84
The main difference is that spring-loaded pop-ups are brought up
 
85
with the pointer and, because of the grab that the pointer button causes,
 
86
require different processing by the Intrinsics.
 
87
Furthermore, all user input remap events occurring outside the spring-loaded
 
88
pop-up (e.g., in a descendant) are also delivered to the spring-loaded
 
89
pop-up after they have been dispatched to the appropriate descendant, so
 
90
that, for example, button-up can take down a spring-loaded pop-up no
 
91
matter where the
 
92
button-up occurs.
 
93
</para>
 
94
 
 
95
<para>
 
96
Any kind of pop-up, in turn, can pop up other widgets.
 
97
Modal and spring-loaded pop-ups can constrain user events to
 
98
the most recent such pop-up or allow user events to be dispatched
 
99
to any of the modal or spring-loaded pop-ups
 
100
currently mapped.
 
101
</para>
 
102
 
 
103
<para>
 
104
Regardless of their type,
 
105
all pop-up widget classes are responsible for communicating with the
 
106
X window manager and therefore are subclasses of
 
107
one of the
 
108
Shell
 
109
widget classes.
 
110
</para>
 
111
</sect1>
 
112
 
 
113
<sect1 id="Creating_a_Pop_Up_Shell">
 
114
<title>Creating a Pop-Up Shell</title>
 
115
<para>
 
116
For a widget to be popped up,
 
117
it must be the child of a pop-up shell widget.
 
118
None of the Intrinsics-supplied shells will
 
119
simultaneously manage more than one child.
 
120
Both the shell and child taken together are referred to as the pop-up.
 
121
When you need to use a pop-up,
 
122
you always refer to the pop-up by the pop-up shell,
 
123
not the child.
 
124
</para>
 
125
 
 
126
<para>
 
127
To create a pop-up shell, use
 
128
<xref linkend='XtCreatePopupShell' xrefstyle='select: title'/>.
 
129
</para>
 
130
 
 
131
<funcsynopsis id='XtCreatePopupShell'>
 
132
<funcprototype>
 
133
<funcdef>Widget <function>XtCreatePopupShell</function></funcdef>
 
134
   <paramdef>String <parameter>name</parameter></paramdef>
 
135
   <paramdef>WidgetClass <parameter>widget_class</parameter></paramdef>
 
136
   <paramdef>Widget <parameter>parent</parameter></paramdef>
 
137
   <paramdef>ArgList <parameter>args</parameter></paramdef>
 
138
   <paramdef>Cardinal <parameter>num_args</parameter></paramdef>
 
139
</funcprototype>
 
140
</funcsynopsis>
 
141
 
 
142
<variablelist>
 
143
  <varlistentry>
 
144
    <term>
 
145
      <emphasis remap='I'>name</emphasis>
 
146
    </term>
 
147
    <listitem>
 
148
      <para>
 
149
Specifies the instance name for the created shell widget.
 
150
      </para>
 
151
    </listitem>
 
152
  </varlistentry>
 
153
  <varlistentry>
 
154
    <term>
 
155
      <emphasis remap='I'>widget_class</emphasis>
 
156
    </term>
 
157
    <listitem>
 
158
      <para>
 
159
Specifies the widget class pointer for the created shell widget.
 
160
      </para>
 
161
    </listitem>
 
162
  </varlistentry>
 
163
  <varlistentry>
 
164
    <term>
 
165
      <emphasis remap='I'>parent</emphasis>
 
166
    </term>
 
167
    <listitem>
 
168
      <para>
 
169
Specifies the parent widget.  Must be of class Core or any subclass thereof.
 
170
      </para>
 
171
    </listitem>
 
172
  </varlistentry>
 
173
  <varlistentry>
 
174
    <term>
 
175
      <emphasis remap='I'>args</emphasis>
 
176
    </term>
 
177
    <listitem>
 
178
      <para>
 
179
Specifies the argument list to override any other resource specifications.
 
180
      </para>
 
181
    </listitem>
 
182
  </varlistentry>
 
183
  <varlistentry>
 
184
    <term>
 
185
      <emphasis remap='I'>num_args</emphasis>
 
186
    </term>
 
187
    <listitem>
 
188
      <para>
 
189
Specifies the number of entries in the argument list.
 
190
    </para>
 
191
  </listitem>
 
192
  </varlistentry>
 
193
</variablelist>
 
194
 
 
195
<para>
 
196
The
 
197
<xref linkend='XtCreatePopupShell' xrefstyle='select: title'/>
 
198
function ensures that the specified class is a subclass of
 
199
Shell
 
200
and, rather than using insert_child to attach the widget to the parent's
 
201
<emphasis remap='I'>children</emphasis> list,
 
202
attaches the shell to the parent's <emphasis remap='I'>popup_list</emphasis> directly.
 
203
</para>
 
204
 
 
205
<para>
 
206
The screen resource for this widget is determined by first scanning
 
207
<emphasis remap='I'>args</emphasis> for the XtNscreen argument.  If no XtNscreen argument is
 
208
found, the resource database associated with the parent's screen
 
209
is queried for the resource <emphasis remap='I'>name</emphasis>.screen, class
 
210
<emphasis remap='I'>Class</emphasis>.Screen where <emphasis remap='I'>Class</emphasis> is the <emphasis remap='I'>class_name</emphasis>
 
211
field from the
 
212
<function>CoreClassPart</function>
 
213
of the specified <emphasis remap='I'>widget_class</emphasis>.
 
214
If this query fails, the parent's screen is used.
 
215
Once the screen is determined,
 
216
the resource database associated with that screen is used to retrieve
 
217
all remaining resources for the widget not specified in
 
218
<emphasis remap='I'>args</emphasis>.
 
219
</para>
 
220
 
 
221
<para>
 
222
A spring-loaded pop-up invoked from a translation table via
 
223
<xref linkend='XtMenuPopup' xrefstyle='select: title'/>
 
224
must already exist
 
225
at the time that the translation is invoked,
 
226
so the translation manager can find the shell by name.
 
227
Pop-ups invoked in other ways can be created when
 
228
the pop-up actually is needed.
 
229
This delayed creation of the shell is particularly useful when you pop up
 
230
an unspecified number of pop-ups.
 
231
You can look to see if an appropriate unused shell (that is, not
 
232
currently popped up) exists and create a new shell if needed.
 
233
</para>
 
234
 
 
235
<para>
 
236
To create a pop-up shell using varargs lists, use
 
237
<xref linkend='XtVaCreatePopupShell' xrefstyle='select: title'/>.
 
238
</para>
 
239
 
 
240
<funcsynopsis id='XtVaCreatePopupShell'>
 
241
<funcprototype>
 
242
<funcdef>Widget <function>XtVaCreatePopupShell</function></funcdef>
 
243
   <paramdef>String <parameter>name</parameter></paramdef>
 
244
   <paramdef>WidgetClass <parameter>widget_class</parameter></paramdef>
 
245
   <paramdef>Widget <parameter>parent</parameter></paramdef>
 
246
   <paramdef><parameter>...</parameter></paramdef>
 
247
</funcprototype>
 
248
</funcsynopsis>
 
249
 
 
250
<variablelist>
 
251
  <varlistentry>
 
252
    <term>
 
253
      <emphasis remap='I'>name</emphasis>
 
254
    </term>
 
255
    <listitem>
 
256
      <para>
 
257
Specifies the instance name for the created shell widget.
 
258
      </para>
 
259
    </listitem>
 
260
  </varlistentry>
 
261
  <varlistentry>
 
262
    <term>
 
263
      <emphasis remap='I'>widget_class</emphasis>
 
264
    </term>
 
265
    <listitem>
 
266
      <para>
 
267
Specifies the widget class pointer for the created shell widget.
 
268
      </para>
 
269
    </listitem>
 
270
  </varlistentry>
 
271
  <varlistentry>
 
272
    <term>
 
273
      <emphasis remap='I'>parent</emphasis>
 
274
    </term>
 
275
    <listitem>
 
276
      <para>
 
277
Specifies the parent widget.  Must be of class Core or any subclass thereof.
 
278
      </para>
 
279
    </listitem>
 
280
  </varlistentry>
 
281
  <varlistentry>
 
282
    <term>...</term>
 
283
    <listitem>
 
284
      <para>
 
285
Specifies the variable argument list to override any other
 
286
resource specifications.
 
287
    </para>
 
288
  </listitem>
 
289
  </varlistentry>
 
290
</variablelist>
 
291
 
 
292
 
 
293
<para>
 
294
<xref linkend='XtVaCreatePopupShell' xrefstyle='select: title'/>
 
295
is identical in function to
 
296
<xref linkend='XtCreatePopupShell' xrefstyle='select: title'/>
 
297
with <emphasis remap='I'>the</emphasis> args and <emphasis remap='I'>num_args</emphasis> parameters replaced by a varargs list as
 
298
described in Section 2.5.1.
 
299
</para>
 
300
</sect1>
 
301
 
 
302
<sect1 id="Creating_Pop_Up_Children">
 
303
<title>Creating Pop-Up Children</title>
 
304
<para>
 
305
Once a pop-up shell is created,
 
306
the single child of the pop-up shell can be created
 
307
either statically or dynamically.
 
308
</para>
 
309
 
 
310
<para>
 
311
At startup,
 
312
an application can create the child of the pop-up shell,
 
313
which is appropriate for pop-up children composed of a fixed set
 
314
of widgets.
 
315
The application can change the state of the subparts of
 
316
the pop-up child as the application state changes.
 
317
For example, if an application creates a static menu,
 
318
it can call
 
319
<xref linkend='XtSetSensitive' xrefstyle='select: title'/>
 
320
(or, in general,
 
321
<xref linkend='XtSetValues' xrefstyle='select: title'/>)
 
322
on any of the buttons that make up the menu.
 
323
Creating the pop-up child early means that pop-up time is minimized,
 
324
especially if the application calls
 
325
<xref linkend='XtRealizeWidget' xrefstyle='select: title'/>
 
326
on the pop-up shell at startup.
 
327
When the menu is needed,
 
328
all the widgets that make up the menu already exist and need only be mapped.
 
329
The menu should pop up as quickly as the X server can respond.
 
330
</para>
 
331
 
 
332
<para>
 
333
Alternatively,
 
334
an application can postpone the creation of the child until it is needed,
 
335
which minimizes application startup time and allows the pop-up child to
 
336
reconfigure itself each time it is popped up.
 
337
In this case,
 
338
the pop-up child creation routine might poll the application
 
339
to find out if it should change the sensitivity of any of its subparts.
 
340
</para>
 
341
 
 
342
<para>
 
343
Pop-up child creation does not map the pop-up,
 
344
even if you create the child and call
 
345
<xref linkend='XtRealizeWidget' xrefstyle='select: title'/>
 
346
on the pop-up shell.
 
347
</para>
 
348
 
 
349
<para>
 
350
All shells have pop-up and pop-down callbacks,
 
351
which provide the opportunity either to make last-minute changes to a
 
352
pop-up child before it is popped up or to change it after it is popped down.
 
353
Note that excessive use of pop-up callbacks can make
 
354
popping up occur more slowly.
 
355
</para>
 
356
</sect1>
 
357
 
 
358
<sect1 id="Mapping_a_Pop_Up_Widget">
 
359
<title>Mapping a Pop-Up Widget</title>
 
360
<para>
 
361
Pop-ups can be popped up through several mechanisms:
 
362
</para>
 
363
<itemizedlist spacing='compact'>
 
364
  <listitem>
 
365
    <para>
 
366
A call to
 
367
<xref linkend='XtPopup' xrefstyle='select: title'/>
 
368
or
 
369
<xref linkend='XtPopupSpringLoaded' xrefstyle='select: title'/>.
 
370
    </para>
 
371
  </listitem>
 
372
  <listitem>
 
373
    <para>
 
374
One of the supplied callback procedures
 
375
<xref linkend='XtCallbackNone' xrefstyle='select: title'/>,
 
376
<xref linkend='XtCallbackNonexclusive' xrefstyle='select: title'/>,
 
377
or
 
378
<xref linkend='XtCallbackExclusive' xrefstyle='select: title'/>.
 
379
    </para>
 
380
  </listitem>
 
381
  <listitem>
 
382
    <para>
 
383
The standard translation action
 
384
<xref linkend='XtMenuPopup' xrefstyle='select: title'/>.
 
385
    </para>
 
386
  </listitem>
 
387
</itemizedlist>
 
388
 
 
389
<para>
 
390
Some of these routines take an argument of type
 
391
<function>XtGrabKind</function>,
 
392
which is defined as
 
393
</para>
 
394
<literallayout >
 
395
typedef enum {XtGrabNone, XtGrabNonexclusive, XtGrabExclusive} XtGrabKind;
 
396
</literallayout>
 
397
 
 
398
<para>
 
399
The create_popup_child_proc procedure pointer
 
400
in the shell widget instance record is of type
 
401
<xref linkend='XtCreatePopupChildProc' xrefstyle='select: title'/>.
 
402
</para>
 
403
 
 
404
<funcsynopsis id='XtCreatePopupChildProc'>
 
405
<funcprototype>
 
406
<funcdef>void <function>*XtCreatePopupChildProc</function></funcdef>
 
407
   <paramdef>Widget <parameter>w</parameter></paramdef>
 
408
</funcprototype>
 
409
</funcsynopsis>
 
410
 
 
411
<variablelist>
 
412
  <varlistentry>
 
413
    <term>
 
414
      <emphasis remap='I'>w</emphasis>
 
415
    </term>
 
416
    <listitem>
 
417
      <para>
 
418
Specifies the shell widget being popped up.
 
419
    </para>
 
420
  </listitem>
 
421
  </varlistentry>
 
422
</variablelist>
 
423
 
 
424
 
 
425
<para>
 
426
To map a pop-up from within an application, use
 
427
<xref linkend='XtPopup' xrefstyle='select: title'/>.
 
428
</para>
 
429
 
 
430
<funcsynopsis id='XtPopup'>
 
431
<funcprototype>
 
432
<funcdef>void <function>XtPopup</function></funcdef>
 
433
   <paramdef>Widget <parameter>popup_shell</parameter></paramdef>
 
434
   <paramdef>XtGrabKind <parameter>grab_kind</parameter></paramdef>
 
435
</funcprototype>
 
436
</funcsynopsis>
 
437
 
 
438
<variablelist>
 
439
  <varlistentry>
 
440
    <term>
 
441
      <emphasis remap='I'>popup_shell</emphasis>
 
442
    </term>
 
443
    <listitem>
 
444
      <para>
 
445
Specifies the shell widget.
 
446
      </para>
 
447
    </listitem>
 
448
  </varlistentry>
 
449
  <varlistentry>
 
450
    <term>
 
451
      <emphasis remap='I'>grab_kind</emphasis>
 
452
    </term>
 
453
    <listitem>
 
454
      <para>
 
455
Specifies the way in which user events should be constrained.
 
456
    </para>
 
457
  </listitem>
 
458
  </varlistentry>
 
459
</variablelist>
 
460
 
 
461
<para>
 
462
The
 
463
<xref linkend='XtPopup' xrefstyle='select: title'/>
 
464
function performs the following:
 
465
</para>
 
466
<itemizedlist spacing='compact'>
 
467
  <listitem>
 
468
    <para>
 
469
Calls
 
470
<xref linkend='XtCheckSubclass' xrefstyle='select: title'/>
 
471
to ensure <emphasis remap='I'>popup_shell</emphasis>'s class is a subclass of
 
472
<function>shellWidgetClass</function>.
 
473
    </para>
 
474
  </listitem>
 
475
  <listitem>
 
476
    <para>
 
477
Raises the window and returns if the shell's <emphasis remap='I'>popped_up</emphasis> field is already
 
478
<function>True</function>.
 
479
    </para>
 
480
  </listitem>
 
481
  <listitem>
 
482
    <para>
 
483
Calls the callback procedures on the shell's <emphasis remap='I'>popup_callback</emphasis> list,
 
484
specifying a pointer to the value of <emphasis remap='I'>grab_kind</emphasis> as the <emphasis remap='I'>call_data</emphasis>
 
485
argument.
 
486
    </para>
 
487
  </listitem>
 
488
  <listitem>
 
489
    <para>
 
490
Sets the shell <emphasis remap='I'>popped_up</emphasis> field to
 
491
<function>True</function>,
 
492
the shell <emphasis remap='I'>spring_loaded</emphasis> field to
 
493
<function>False</function>,
 
494
and the shell <emphasis remap='I'>grab_kind</emphasis> field from <emphasis remap='I'>grab_kind</emphasis>.
 
495
    </para>
 
496
  </listitem>
 
497
  <listitem>
 
498
    <para>
 
499
If the shell's <emphasis remap='I'>create_popup_child_proc</emphasis> field is non-NULL,
 
500
<xref linkend='XtPopup' xrefstyle='select: title'/>
 
501
calls it with <emphasis remap='I'>popup_shell</emphasis> as the parameter.
 
502
    </para>
 
503
  </listitem>
 
504
  <listitem>
 
505
    <para>
 
506
If <emphasis remap='I'>grab_kind</emphasis> is either
 
507
<function>XtGrabNonexclusive</function>
 
508
or
 
509
<function>XtGrabExclusive</function>,
 
510
it calls
 
511
    </para>
 
512
<literallayout >
 
513
XtAddGrab(<emphasis remap='I'>popup_shell</emphasis>, (<emphasis remap='I'>grab_kind</emphasis> == XtGrabExclusive), False)
 
514
</literallayout>
 
515
  </listitem>
 
516
  <listitem>
 
517
    <para>
 
518
Calls
 
519
<xref linkend='XtRealizeWidget' xrefstyle='select: title'/>
 
520
with <emphasis remap='I'>popup_shell</emphasis> specified.
 
521
    </para>
 
522
  </listitem>
 
523
  <listitem>
 
524
    <para>
 
525
Calls
 
526
<function>XMapRaised</function>
 
527
with the window of <emphasis remap='I'>popup_shell</emphasis>.
 
528
    </para>
 
529
  </listitem>
 
530
</itemizedlist>
 
531
<para>
 
532
To map a spring-loaded pop-up from within an application, use
 
533
<xref linkend='XtPopupSpringLoaded' xrefstyle='select: title'/>.
 
534
</para>
 
535
 
 
536
<funcsynopsis id='XtPopupSpringLoaded'>
 
537
<funcprototype>
 
538
<funcdef>void <function>XtPopupSpringLoaded</function></funcdef>
 
539
   <paramdef>Widget <parameter>popup_shell</parameter></paramdef>
 
540
</funcprototype>
 
541
</funcsynopsis>
 
542
 
 
543
<variablelist>
 
544
  <varlistentry>
 
545
    <term>
 
546
      <emphasis remap='I'>popup_shell</emphasis>
 
547
    </term>
 
548
    <listitem>
 
549
      <para>
 
550
Specifies the shell widget to be popped up.
 
551
    </para>
 
552
  </listitem>
 
553
  </varlistentry>
 
554
</variablelist>
 
555
 
 
556
<para>
 
557
The
 
558
<xref linkend='XtPopupSpringLoaded' xrefstyle='select: title'/>
 
559
function performs exactly as
 
560
<xref linkend='XtPopup' xrefstyle='select: title'/>
 
561
except that it sets the shell <emphasis remap='I'>spring_loaded</emphasis> field to
 
562
<function>True</function>
 
563
and always calls
 
564
<xref linkend='XtAddGrab' xrefstyle='select: title'/>
 
565
with <emphasis remap='I'>exclusive</emphasis>
 
566
<function>True</function>
 
567
and <emphasis remap='I'>spring-loaded</emphasis>
 
568
<function>True</function>.
 
569
</para>
 
570
 
 
571
<para>
 
572
To map a pop-up from a given widget's callback list,
 
573
you also can register one of the
 
574
<xref linkend='XtCallbackNone' xrefstyle='select: title'/>,
 
575
<xref linkend='XtCallbackNonexclusive' xrefstyle='select: title'/>,
 
576
or
 
577
<xref linkend='XtCallbackExclusive' xrefstyle='select: title'/>
 
578
convenience routines as callbacks, using the pop-up shell widget as the
 
579
client data.
 
580
</para>
 
581
 
 
582
<funcsynopsis id='XtCallbackNone'>
 
583
<funcprototype>
 
584
<funcdef>void <function>XtCallbackNone</function></funcdef>
 
585
   <paramdef>Widget <parameter>w</parameter></paramdef>
 
586
   <paramdef>XtPointer <parameter>client_data</parameter></paramdef>
 
587
   <paramdef>XtPointer <parameter>call_data</parameter></paramdef>
 
588
</funcprototype>
 
589
</funcsynopsis>
 
590
 
 
591
<variablelist>
 
592
  <varlistentry>
 
593
    <term>
 
594
      <emphasis remap='I'>w</emphasis>
 
595
    </term>
 
596
    <listitem>
 
597
      <para>
 
598
Specifies the widget.
 
599
      </para>
 
600
    </listitem>
 
601
  </varlistentry>
 
602
  <varlistentry>
 
603
    <term>
 
604
      <emphasis remap='I'>client_data</emphasis>
 
605
    </term>
 
606
    <listitem>
 
607
      <para>
 
608
Specifies the pop-up shell.
 
609
      </para>
 
610
    </listitem>
 
611
  </varlistentry>
 
612
  <varlistentry>
 
613
    <term>
 
614
      <emphasis remap='I'>call_data</emphasis>
 
615
    </term>
 
616
    <listitem>
 
617
      <para>
 
618
Specifies the callback data argument,
 
619
which is not used by this procedure.
 
620
    </para>
 
621
  </listitem>
 
622
  </varlistentry>
 
623
</variablelist>
 
624
 
 
625
 
 
626
<funcsynopsis id='XtCallbackNonexclusive'>
 
627
<funcprototype>
 
628
<funcdef>void <function>XtCallbackNonexclusive</function></funcdef>
 
629
   <paramdef>Widget <parameter>w</parameter></paramdef>
 
630
   <paramdef>XtPointer <parameter>client_data</parameter></paramdef>
 
631
   <paramdef>XtPointer <parameter>call_data</parameter></paramdef>
 
632
</funcprototype>
 
633
</funcsynopsis>
 
634
 
 
635
<variablelist>
 
636
  <varlistentry>
 
637
    <term>
 
638
      <emphasis remap='I'>w</emphasis>
 
639
    </term>
 
640
    <listitem>
 
641
      <para>
 
642
Specifies the widget.
 
643
      </para>
 
644
    </listitem>
 
645
  </varlistentry>
 
646
  <varlistentry>
 
647
    <term>
 
648
      <emphasis remap='I'>client_data</emphasis>
 
649
    </term>
 
650
    <listitem>
 
651
      <para>
 
652
Specifies the pop-up shell.
 
653
      </para>
 
654
    </listitem>
 
655
  </varlistentry>
 
656
  <varlistentry>
 
657
    <term>
 
658
      <emphasis remap='I'>call_data</emphasis>
 
659
    </term>
 
660
    <listitem>
 
661
      <para>
 
662
Specifies the callback data argument,
 
663
which is not used by this procedure.
 
664
    </para>
 
665
  </listitem>
 
666
  </varlistentry>
 
667
</variablelist>
 
668
 
 
669
 
 
670
<funcsynopsis id='XtCallbackExclusive'>
 
671
<funcprototype>
 
672
<funcdef>void <function>XtCallbackExclusive</function></funcdef>
 
673
   <paramdef>Widget <parameter>w</parameter></paramdef>
 
674
   <paramdef>XtPointer <parameter>client_data</parameter></paramdef>
 
675
   <paramdef>XtPointer <parameter>call_data</parameter></paramdef>
 
676
</funcprototype>
 
677
</funcsynopsis>
 
678
 
 
679
<variablelist>
 
680
  <varlistentry>
 
681
    <term>
 
682
      <emphasis remap='I'>w</emphasis>
 
683
    </term>
 
684
    <listitem>
 
685
      <para>
 
686
Specifies the widget.
 
687
      </para>
 
688
    </listitem>
 
689
  </varlistentry>
 
690
  <varlistentry>
 
691
    <term>
 
692
      <emphasis remap='I'>client_data</emphasis>
 
693
    </term>
 
694
    <listitem>
 
695
      <para>
 
696
Specifies the pop-up shell.
 
697
      </para>
 
698
    </listitem>
 
699
  </varlistentry>
 
700
  <varlistentry>
 
701
    <term>
 
702
      <emphasis remap='I'>call_data</emphasis>
 
703
    </term>
 
704
    <listitem>
 
705
      <para>
 
706
Specifies the callback data argument,
 
707
which is not used by this procedure.
 
708
    </para>
 
709
  </listitem>
 
710
  </varlistentry>
 
711
</variablelist>
 
712
 
 
713
<para>
 
714
The
 
715
<xref linkend='XtCallbackNone' xrefstyle='select: title'/>,
 
716
<xref linkend='XtCallbackNonexclusive' xrefstyle='select: title'/>,
 
717
and
 
718
<xref linkend='XtCallbackExclusive' xrefstyle='select: title'/>
 
719
functions call
 
720
<xref linkend='XtPopup' xrefstyle='select: title'/>
 
721
with the shell specified by the <emphasis remap='I'>client_data</emphasis> argument
 
722
and <emphasis remap='I'>grab_kind</emphasis> set as the name specifies.
 
723
<xref linkend='XtCallbackNone' xrefstyle='select: title'/>,
 
724
<xref linkend='XtCallbackNonexclusive' xrefstyle='select: title'/>,
 
725
and
 
726
<xref linkend='XtCallbackExclusive' xrefstyle='select: title'/>
 
727
specify
 
728
<function>XtGrabNone</function>,
 
729
<function>XtGrabNonexclusive</function>,
 
730
and
 
731
<function>XtGrabExclusive</function>,
 
732
respectively.
 
733
Each function then sets the widget that executed the callback list
 
734
to be insensitive by calling
 
735
<xref linkend='XtSetSensitive' xrefstyle='select: title'/>.
 
736
Using these functions in callbacks is not required.
 
737
In particular,
 
738
an application must provide customized code for
 
739
callbacks that create pop-up shells dynamically or that must do more than
 
740
desensitizing the button.
 
741
</para>
 
742
 
 
743
<para>
 
744
Within a translation table,
 
745
to pop up a menu when a key or pointer button is pressed or when the pointer
 
746
is moved into a widget, use
 
747
<xref linkend='XtMenuPopup' xrefstyle='select: title'/>,
 
748
or its synonym,
 
749
<function>MenuPopup</function>.
 
750
From a translation writer's point of view,
 
751
the definition for this translation action is
 
752
</para>
 
753
 
 
754
<funcsynopsis id='XtMenuPopup'>
 
755
<funcprototype>
 
756
<funcdef>void <function>XtMenuPopup</function></funcdef>
 
757
   <paramdef>String <parameter>shell_name</parameter></paramdef>
 
758
</funcprototype>
 
759
</funcsynopsis>
 
760
 
 
761
<variablelist>
 
762
  <varlistentry>
 
763
    <term>
 
764
      <emphasis remap='I'>shell_name</emphasis>
 
765
    </term>
 
766
    <listitem>
 
767
      <para>
 
768
Specifies the name of the shell widget to pop up.
 
769
    </para>
 
770
  </listitem>
 
771
  </varlistentry>
 
772
</variablelist>
 
773
 
 
774
<para>
 
775
<xref linkend='XtMenuPopup' xrefstyle='select: title'/>
 
776
is known to the translation manager,
 
777
which registers the corresponding built-in action procedure
 
778
<function>XtMenuPopupAction</function>
 
779
using
 
780
<xref linkend='XtRegisterGrabAction' xrefstyle='select: title'/>
 
781
specifying <emphasis remap='I'>owner_events</emphasis>
 
782
<function>True</function>,
 
783
<emphasis remap='I'>event_mask</emphasis>
 
784
<function>ButtonPressMask</function>
 
785
<function>|</function>
 
786
<function>ButtonReleaseMask</function>,
 
787
and <emphasis remap='I'>pointer_mode</emphasis> and <emphasis remap='I'>keyboard_mode</emphasis>
 
788
<function>GrabModeAsync</function>.
 
789
</para>
 
790
 
 
791
<para>
 
792
If
 
793
<xref linkend='XtMenuPopup' xrefstyle='select: title'/>
 
794
is invoked on
 
795
<function>ButtonPress</function>,
 
796
it calls
 
797
<xref linkend='XtPopupSpringLoaded' xrefstyle='select: title'/>
 
798
on the specified shell widget.
 
799
If
 
800
<xref linkend='XtMenuPopup' xrefstyle='select: title'/>
 
801
is invoked on
 
802
<function>KeyPress</function>
 
803
or
 
804
<function>EnterWindow</function>,
 
805
it calls
 
806
<xref linkend='XtPopup' xrefstyle='select: title'/>
 
807
on the specified shell widget with <emphasis remap='I'>grab_kind</emphasis> set to
 
808
<function>XtGrabNonexclusive</function>.
 
809
Otherwise, the translation manager generates a
 
810
warning message and ignores the action.
 
811
</para>
 
812
 
 
813
<para>
 
814
<xref linkend='XtMenuPopup' xrefstyle='select: title'/>
 
815
tries to find the shell by searching the widget tree starting at
 
816
the widget in which it is invoked.
 
817
If it finds a shell with the specified name in the pop-up children of
 
818
that widget, it pops up the shell with the appropriate parameters.
 
819
Otherwise, it moves up the parent chain to find a pop-up child with the
 
820
specified name.
 
821
If
 
822
<xref linkend='XtMenuPopup' xrefstyle='select: title'/>
 
823
gets to the application top-level shell widget and has not
 
824
found a matching shell, it generates a warning and returns immediately.
 
825
</para>
 
826
</sect1>
 
827
 
 
828
<sect1 id="Unmapping_a_Pop_Up_Widget">
 
829
<title>Unmapping a Pop-Up Widget</title>
 
830
<para>
 
831
Pop-ups can be popped down through several mechanisms:
 
832
</para>
 
833
<itemizedlist spacing='compact'>
 
834
  <listitem>
 
835
    <para>
 
836
A call to
 
837
<xref linkend='XtPopdown' xrefstyle='select: title'/>
 
838
    </para>
 
839
  </listitem>
 
840
  <listitem>
 
841
    <para>
 
842
The supplied callback procedure
 
843
<xref linkend='XtCallbackPopdown' xrefstyle='select: title'/>
 
844
    </para>
 
845
  </listitem>
 
846
  <listitem>
 
847
    <para>
 
848
The standard translation action
 
849
<xref linkend='XtMenuPopdown' xrefstyle='select: title'/>
 
850
    </para>
 
851
  </listitem>
 
852
</itemizedlist>
 
853
<para>
 
854
To unmap a pop-up from within an application, use
 
855
<xref linkend='XtPopdown' xrefstyle='select: title'/>.
 
856
</para>
 
857
 
 
858
<funcsynopsis id='XtPopdown'>
 
859
<funcprototype>
 
860
<funcdef>void <function>XtPopdown</function></funcdef>
 
861
   <paramdef>Widget <parameter>popup_shell</parameter></paramdef>
 
862
</funcprototype>
 
863
</funcsynopsis>
 
864
 
 
865
<variablelist>
 
866
  <varlistentry>
 
867
    <term>
 
868
      <emphasis remap='I'>popup_shell</emphasis>
 
869
    </term>
 
870
    <listitem>
 
871
      <para>
 
872
Specifies the shell widget to pop down.
 
873
    </para>
 
874
  </listitem>
 
875
  </varlistentry>
 
876
</variablelist>
 
877
 
 
878
<para>
 
879
The
 
880
<xref linkend='XtPopdown' xrefstyle='select: title'/>
 
881
function performs the following:
 
882
</para>
 
883
<itemizedlist spacing='compact'>
 
884
  <listitem>
 
885
    <para>
 
886
Calls
 
887
<xref linkend='XtCheckSubclass' xrefstyle='select: title'/>
 
888
to ensure <emphasis remap='I'>popup_shell</emphasis>'s class is a subclass of
 
889
<function>shellWidgetClass</function>.
 
890
    </para>
 
891
  </listitem>
 
892
  <listitem>
 
893
    <para>
 
894
Checks that the <emphasis remap='I'>popped_up</emphasis> field of <emphasis remap='I'>popup_shell</emphasis> is
 
895
<function>True</function>;
 
896
otherwise, it returns immediately.
 
897
    </para>
 
898
  </listitem>
 
899
  <listitem>
 
900
    <para>
 
901
Unmaps <emphasis remap='I'>popup_shell</emphasis>'s window and, if <emphasis remap='I'>override_redirect</emphasis> is
 
902
<function>False</function>,
 
903
sends a synthetic
 
904
<function>UnmapNotify</function>
 
905
event as specified by the <emphasis remap='I'>Inter-Client Communication Conventions Manual</emphasis>.
 
906
    </para>
 
907
  </listitem>
 
908
  <listitem>
 
909
    <para>
 
910
If <emphasis remap='I'>popup_shell</emphasis>'s <emphasis remap='I'>grab_kind</emphasis> is either
 
911
<function>XtGrabNonexclusive</function>
 
912
or
 
913
<function>XtGrabExclusive</function>,
 
914
it calls
 
915
<xref linkend='XtRemoveGrab' xrefstyle='select: title'/>.
 
916
    </para>
 
917
  </listitem>
 
918
  <listitem>
 
919
    <para>
 
920
Sets <emphasis remap='I'>popup_shell</emphasis>'s <emphasis remap='I'>popped_up</emphasis> field to
 
921
<function>False</function>.
 
922
    </para>
 
923
  </listitem>
 
924
  <listitem>
 
925
    <para>
 
926
Calls the callback procedures on the shell's <emphasis remap='I'>popdown_callback</emphasis> list,
 
927
specifying a pointer to the value of the shell's <emphasis remap='I'>grab_kind</emphasis> field
 
928
as the <emphasis remap='I'>call_data</emphasis> argument.
 
929
    </para>
 
930
  </listitem>
 
931
</itemizedlist>
 
932
<para>
 
933
To pop down a pop-up from a callback list, you may use the callback
 
934
<xref linkend='XtCallbackPopdown' xrefstyle='select: title'/>.
 
935
</para>
 
936
 
 
937
<funcsynopsis id='XtCallbackPopdown'>
 
938
<funcprototype>
 
939
<funcdef>void <function>XtCallbackPopdown</function></funcdef>
 
940
   <paramdef>Widget <parameter>w</parameter></paramdef>
 
941
   <paramdef>XtPointer <parameter>client_data</parameter></paramdef>
 
942
   <paramdef>XtPointer <parameter>call_data</parameter></paramdef>
 
943
</funcprototype>
 
944
</funcsynopsis>
 
945
 
 
946
<variablelist>
 
947
  <varlistentry>
 
948
    <term>
 
949
      <emphasis remap='I'>w</emphasis>
 
950
    </term>
 
951
    <listitem>
 
952
      <para>
 
953
Specifies the widget.
 
954
      </para>
 
955
    </listitem>
 
956
  </varlistentry>
 
957
  <varlistentry>
 
958
    <term>
 
959
      <emphasis remap='I'>client_data</emphasis>
 
960
    </term>
 
961
    <listitem>
 
962
      <para>
 
963
Specifies a pointer to the
 
964
<function>XtPopdownID</function>
 
965
structure.
 
966
      </para>
 
967
    </listitem>
 
968
  </varlistentry>
 
969
  <varlistentry>
 
970
    <term>
 
971
      <emphasis remap='I'>call_data</emphasis>
 
972
    </term>
 
973
    <listitem>
 
974
      <para>
 
975
Specifies the callback data argument,
 
976
which is not used by this procedure.
 
977
    </para>
 
978
  </listitem>
 
979
  </varlistentry>
 
980
</variablelist>
 
981
 
 
982
<para>
 
983
The
 
984
<xref linkend='XtCallbackPopdown' xrefstyle='select: title'/>
 
985
function casts the <emphasis remap='I'>client_data</emphasis> parameter to a pointer of type
 
986
<function>XtPopdownID</function>.
 
987
</para>
 
988
<literallayout >
 
989
typedef struct {
 
990
        Widget shell_widget;
 
991
        Widget enable_widget;
 
992
} XtPopdownIDRec, *XtPopdownID;
 
993
</literallayout>
 
994
<para>
 
995
The <emphasis remap='I'>shell_widget</emphasis> is the pop-up shell to pop down,
 
996
and the <emphasis remap='I'>enable_widget</emphasis> is usually the widget that was used to pop it up
 
997
in one of the pop-up callback convenience procedures.
 
998
</para>
 
999
 
 
1000
<para>
 
1001
<xref linkend='XtCallbackPopdown' xrefstyle='select: title'/>
 
1002
calls
 
1003
<xref linkend='XtPopdown' xrefstyle='select: title'/>
 
1004
with the specified <emphasis remap='I'>shell_widget</emphasis>
 
1005
and then calls
 
1006
<xref linkend='XtSetSensitive' xrefstyle='select: title'/>
 
1007
to resensitize <emphasis remap='I'>enable_widget</emphasis>.
 
1008
</para>
 
1009
 
 
1010
<para>
 
1011
Within a translation table,
 
1012
to pop down a spring-loaded menu when a key or pointer button is
 
1013
released or when the
 
1014
pointer is moved into a widget, use
 
1015
<xref linkend='XtMenuPopdown' xrefstyle='select: title'/>
 
1016
or its synonym,
 
1017
<function>MenuPopdown</function>.
 
1018
From a translation writer's point of view,
 
1019
the definition for this translation action is
 
1020
</para>
 
1021
 
 
1022
<funcsynopsis id='XtMenuPopdown'>
 
1023
<funcprototype>
 
1024
<funcdef>void <function>XtMenuPopdown</function></funcdef>
 
1025
   <paramdef>String <parameter>shell_name</parameter></paramdef>
 
1026
</funcprototype>
 
1027
</funcsynopsis>
 
1028
 
 
1029
<variablelist>
 
1030
  <varlistentry>
 
1031
    <term>
 
1032
      <emphasis remap='I'>shell_name</emphasis>
 
1033
    </term>
 
1034
    <listitem>
 
1035
      <para>
 
1036
Specifies the name of the shell widget to pop down.
 
1037
    </para>
 
1038
  </listitem>
 
1039
  </varlistentry>
 
1040
</variablelist>
 
1041
 
 
1042
<para>
 
1043
If a shell name is not given,
 
1044
<xref linkend='XtMenuPopdown' xrefstyle='select: title'/>
 
1045
calls
 
1046
<xref linkend='XtPopdown' xrefstyle='select: title'/>
 
1047
with the widget for which the translation is specified.
 
1048
If <emphasis remap='I'>shell_name</emphasis> is specified in the translation table,
 
1049
<xref linkend='XtMenuPopdown' xrefstyle='select: title'/>
 
1050
tries to find the shell by looking up the widget tree starting at the
 
1051
widget in which it is invoked.
 
1052
If it finds a shell with the specified name in the pop-up children
 
1053
of that widget, it pops down the shell;
 
1054
otherwise, it moves up the parent chain to find a pop-up child with the
 
1055
specified name.
 
1056
If
 
1057
<xref linkend='XtMenuPopdown' xrefstyle='select: title'/>
 
1058
gets to the application top-level shell widget
 
1059
and cannot find a matching shell,
 
1060
it generates a warning and returns immediately.
 
1061
</para>
 
1062
</sect1>
 
1063
</chapter>