upload tizen2.0 source
[framework/uifw/xorg/lib/libxaw.git] / specs / CH1.xml
1 <chapter id='Athena_Widgets_and_The_Intrinsics'>
2 <title>Athena Widgets and The Intrinsics</title>
3 <para>
4 The X Toolkit is made up of two distinct pieces, the Xt Intrinsics and a
5 widget set.  The Athena widget set is a sample implementation of a
6 widget set built upon the Intrinsics.  In the X Toolkit, a widget is the
7 combination of an X window or subwindow and its associated input and
8 output semantics.
9 </para>
10 <para>
11 Because the Intrinsics provide the same basic functionality to all widget
12 sets it may be possible to use widgets from the Athena widget set with
13 other widget sets based upon the Intrinsics.  Since widget sets may also
14 implement private protocols, all functionality may not be available when
15 mixing and matching widget sets.  For information about the Intrinsics, see
16 the <emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis>.
17 </para>
18 <para>
19 The Athena widget set is a library package layered on top of the Intrinsics
20 and Xlib that provides a set of user interface tools sufficient to build
21 a wide variety of applications.  This layer extends the basic
22 abstractions provided by X and provides the next layer of functionality
23 primarily by supplying a cohesive set of sample widgets.  Although the
24 Intrinsics are a Consortium standard, there is no standard widget set.
25 </para>
26
27 <para>
28 To the extent possible, the Intrinsics are "policy-free".  The application
29 environment and widget set, not the Intrinsics, define, implement, and
30 enforce:
31 </para>
32
33 <itemizedlist>
34   <listitem><para>Policy</para></listitem>
35   <listitem><para>Consistency</para></listitem>
36   <listitem><para>Style</para></listitem>
37 </itemizedlist>
38
39 <para>
40 Each individual widget implementation defines its own policy.  The X Toolkit
41 design allows for, but does not necessarily encourage, the free mixing
42 of radically differing widget implementations.
43 </para>
44
45 <sect1 id='Introduction_to_the_X_Toolkit'>
46 <title>Introduction to the X Toolkit</title>
47 <para>
48 <!-- .LP -->
49 <!-- .XS -->
50 <!--    Introduction to the X Toolkit -->
51 <!-- .XE -->
52 <!-- .IN "introduction" "" "@DEF@" -->
53 The X Toolkit provides tools that simplify the design of
54 application user interfaces in the X Window System programming environment.
55 It assists application programmers by providing a set of common
56 underlying user-interface functions.  It also lets widget programmers
57 modify existing widgets, by subclassing, or add new widgets.  By using
58 the X Toolkit in their applications, programmers can present a similar
59 user interface across applications to all workstation users.
60 </para>
61 <para>
62 <!-- .LP -->
63 The X Toolkit consists of:
64 </para>
65 <itemizedlist>
66   <listitem>
67     <para>
68 A set of Intrinsics functions for building widgets
69     </para>
70   </listitem>
71   <listitem>
72     <para>
73 An architectural model for constructing widgets
74     </para>
75   </listitem>
76   <listitem>
77     <para>
78 A widget set for application programming
79     </para>
80   </listitem>
81 </itemizedlist>
82 <para>
83 <!-- .LP -->
84 While the majority of the Intrinsics functions are intended
85 for the widget programmer,
86 a subset of the Intrinsics functions are to be used by application programmers
87 (see  <emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis>).
88 The architectural model lets the widget programmer design new widgets
89 by using the Intrinsics and by combining other widgets.
90 The application interface layers built on top of the X Toolkit include a
91 coordinated set of widgets and composition policies.
92 Some of these widgets and policies are specific to a single
93 application domain, and others are common to a variety of
94 applications.
95 </para>
96 <para>
97 <!-- .LP -->
98 The remainder of this chapter discusses the X Toolkit and Athena widget set:
99 </para>
100 <itemizedlist>
101   <listitem>
102     <para>
103 Terminology
104     </para>
105   </listitem>
106   <listitem>
107     <para>
108 Model
109     </para>
110   </listitem>
111   <listitem>
112     <para>
113 Conventions used in this manual
114     </para>
115   </listitem>
116   <listitem>
117     <para>
118 Format of the Widget Reference Chapters
119     </para>
120   </listitem>
121 </itemizedlist>
122 </sect1>
123 <sect1 id="Terminology">
124 <title>Terminology</title>
125 <para>
126 <!-- .LP -->
127 <!-- .XS -->
128 <!--    Terminology -->
129 <!-- .XE -->
130 </para>
131 <para>
132 <!-- .LP -->
133 In addition to the terms already defined for X programming (see
134 <emphasis remap='I'>Xlib - C Language Interface</emphasis>),
135 the following terms are specific to the Intrinsics and Athena widget set
136 and used throughout this document.
137 </para>
138 <para>
139 <!-- .LP -->
140 <function>Application programmer</function>
141 <!-- .IN "application programmer" "" "@DEF@" -->
142 </para>
143 <itemizedlist>
144   <listitem>
145     <para>
146 A programmer who uses the X Toolkit to produce an application user interface.
147     </para>
148   </listitem>
149 </itemizedlist>
150 <para>
151 <!-- .LP -->
152 <function>Child</function>
153 <!-- .IN "child" "" "@DEF" -->
154 </para>
155 <itemizedlist>
156   <listitem>
157     <para>
158 A widget that is contained within another "parent" widget.
159     </para>
160   </listitem>
161 </itemizedlist>
162 <para>
163 <!-- .LP -->
164 <function>Class</function>
165 <!-- .IN "class" "" "@DEF@" -->
166 </para>
167 <itemizedlist>
168   <listitem>
169     <para>
170 The general group to which a specific object belongs.
171     </para>
172   </listitem>
173 </itemizedlist>
174 <para>
175 <!-- .LP -->
176 <function>Client</function>
177 <!-- .IN "client" "" "@DEF@" -->
178 </para>
179 <itemizedlist>
180   <listitem>
181     <para>
182 A function that uses a widget in an application or for composing
183 other widgets.
184     </para>
185   </listitem>
186 </itemizedlist>
187 <para>
188 <!-- .LP -->
189 <function>FullName</function>
190 <!-- .IN "FullName" "" "@DEF" -->
191 </para>
192 <itemizedlist>
193   <listitem>
194     <para>
195 The name of a widget instance appended to the full name of its parent.
196     </para>
197   </listitem>
198 </itemizedlist>
199 <para>
200 <!-- .LP -->
201 <function>Instance</function>
202 <!-- .IN "instance" "" "@DEF@" -->
203 </para>
204 <itemizedlist>
205   <listitem>
206     <para>
207 A specific widget object as opposed to a general widget class.
208     </para>
209   </listitem>
210 </itemizedlist>
211 <para>
212 <!-- .LP -->
213 <function>Method</function>
214 <!-- .IN "method" "" "@DEF@" -->
215 </para>
216 <itemizedlist>
217   <listitem>
218     <para>
219 A function or procedure implemented by a widget class.
220     </para>
221   </listitem>
222 </itemizedlist>
223 <para>
224 <!-- .LP -->
225 <function>Name</function>
226 <!-- .IN "name" "widget" "@DEF@" -->
227 </para>
228 <itemizedlist>
229   <listitem>
230     <para>
231 The name that is specific to an instance of a widget for a given client.
232 This name is specified at creation time and cannot be modified.
233     </para>
234   </listitem>
235 </itemizedlist>
236 <para>
237 <!-- .LP -->
238 <function>Object</function>
239 <!-- .IN "object" "" "@DEF@" -->
240 </para>
241 <itemizedlist>
242   <listitem>
243     <para>
244 A data abstraction consisting of private data and private and public
245 functions that operate on the private data.
246 Users of the abstraction can interact with the object only through calls
247 to the object's public functions.
248 In the X Toolkit,
249 some of the object's public functions are called directly by the application,
250 while others are called indirectly when the application calls the common
251 Intrinsics functions.
252 In general, if a function is common to all widgets,
253 an application uses a single Intrinsics function to invoke the function for all
254 types of widgets.
255 If a function is unique to a single widget type,
256 the widget exports the function.
257     </para>
258   </listitem>
259 </itemizedlist>
260 <para>
261 <!-- .LP -->
262 <function>Parent</function>
263 <!-- .IN "parent" "" "@DEF@" -->
264 </para>
265 <itemizedlist>
266   <listitem>
267     <para>
268 A widget that contains at least one other ("child") widget.
269 A parent widget is also known as a composite widget.
270     </para>
271   </listitem>
272 </itemizedlist>
273 <para>
274 <!-- .LP -->
275 <function>Resource</function>
276 <!-- .IN "resource" "" "@DEF@" -->
277 </para>
278 <itemizedlist>
279   <listitem>
280     <para>
281 A named piece of data in a widget that can be set by a client,
282 by an application, or by user defaults.
283     </para>
284   </listitem>
285 </itemizedlist>
286 <para>
287 <!-- .LP -->
288 <function>Superclass</function>
289 <!-- .IN "superclass" "" "@DEF@" -->
290 </para>
291 <itemizedlist>
292   <listitem>
293     <para>
294 A larger class of which a specific class is a member.
295 All members of a class are also members of the superclass.
296     </para>
297   </listitem>
298 </itemizedlist>
299 <para>
300 <!-- .LP -->
301 <function>User</function>
302 <!-- .IN "user" "" "@DEF@" -->
303 </para>
304 <itemizedlist>
305   <listitem>
306     <para>
307 A person interacting with a workstation.
308     </para>
309   </listitem>
310 </itemizedlist>
311 <para>
312 <!-- .LP -->
313 <function>Widget</function>
314 <!-- .IN "widget" "" "@DEF@" -->
315 </para>
316 <itemizedlist>
317   <listitem>
318     <para>
319 An object providing a user-interface abstraction (for example, a Scrollbar
320 widget).
321     </para>
322   </listitem>
323 </itemizedlist>
324 <para>
325 <!-- .LP -->
326 <function>Widget class</function>
327 <!-- .IN "widget class" "" "@DEF@" -->
328 </para>
329 <itemizedlist>
330   <listitem>
331     <para>
332 The general group to which a specific widget belongs,
333 otherwise known as the type of the widget.
334     </para>
335   </listitem>
336 </itemizedlist>
337 <para>
338 <!-- .LP -->
339 <function>Widget programmer</function>
340 <!-- .IN "widget programmer" "" "@DEF@" -->
341 </para>
342 <itemizedlist>
343   <listitem>
344     <para>
345 A programmer who adds new widgets to the X Toolkit.
346     </para>
347   </listitem>
348 </itemizedlist>
349 </sect1>
350 <sect1 id="Underlying_Model">
351 <title>Underlying Model</title>
352 <para>
353 <!-- .LP -->
354 <!-- .XS -->
355 <!--    Underlying Model -->
356 <!-- .XE -->
357 <!-- .IN "underlying model" "" "@DEF@" -->
358 The underlying architectural model is based on the following premises:
359 <!-- .KS -->
360 </para>
361 <itemizedlist>
362   <listitem>
363     <para>
364     </para>
365   </listitem>
366   <listitem>
367     <para>
368 Every user-interface widget is associated with an X window.
369 The X window ID for a widget is readily available from the widget.
370 Standard Xlib calls can be used by widgets for many of their input and
371 output operations.
372 <!-- .KE -->
373 <!-- .KS -->
374     </para>
375   </listitem>
376   <listitem>
377     <para>
378     </para>
379   </listitem>
380   <listitem>
381     <para>
382 The data for every widget is private to the widget and its subclasses.
383 That is, the data is neither directly accessible
384 nor visible outside of the module implementing the widget.
385 All program interaction with the widget is performed by a set of operations
386 (methods) that are defined for the widget.
387 <!-- .KE -->
388 <!-- .KS -->
389     </para>
390   </listitem>
391   <listitem>
392     <para>
393     </para>
394   </listitem>
395   <listitem>
396     <para>
397 Widget semantics are clearly separated from widget layout geometry.
398 Widgets are concerned with implementing specific user-interface
399 semantics.  They have little control over issues such as their size or
400 placement relative to other widget peers.  Mechanisms are provided for
401 associating geometric managers with widgets and for widgets to make
402 suggestions about their own geometry.
403 <!-- .KE -->
404     </para>
405   </listitem>
406 </itemizedlist>
407 </sect1>
408 <sect1 id="Conventions_Used_in_this_Manual">
409 <title>Conventions Used in this Manual</title>
410 <itemizedlist>
411   <listitem>
412     <para>
413 <!-- .IN "conventions" "used in manual" "@DEF@" -->
414 All resources available to the widgets are listed with each widget.  Many
415 of these are available to more than one widget class due to the object
416 oriented nature of the Intrinsics.  The new resources for each widget are
417 listed in bold text, and the inherited resources are listed in plain text.
418     </para>
419   </listitem>
420   <listitem>
421     <para>
422 Global symbols are printed in <function>bold</function> and can be function names,
423 symbols defined in include files, or structure names.  Arguments are
424 printed in <emphasis remap='I'>italics</emphasis>.
425     </para>
426   </listitem>
427   <listitem>
428     <para>
429 Each function is introduced by a general discussion that distinguishes
430 it from other functions.  The function declaration itself follows, and
431 each argument is specifically explained.  General discussion of the
432 function, if any is required, follows the arguments.  Where
433 applicable, the last paragraph of the explanation lists the return values
434 of the function.
435     </para>
436   </listitem>
437   <listitem>
438     <para>
439 To eliminate any ambiguity between those arguments that you pass and
440 those that a function returns to you, the explanations for all
441 arguments that you pass start with the word <emphasis remap='I'>specifies</emphasis> or, in the
442 case of multiple arguments, the word <emphasis remap='I'>specify</emphasis>. The explanations
443 for all arguments that are returned to you start with the word
444 <emphasis remap='I'>returns</emphasis> or, in the case of multiple arguments, the word
445 <emphasis remap='I'>return</emphasis>.  The explanations for all arguments that you can pass
446 and are returned start with the words <emphasis remap='I'>specifies and returns</emphasis>.
447     </para>
448   </listitem>
449   <listitem>
450     <para>
451 Any pointer to a structure that is used to return a value is
452 designated as such by the <emphasis remap='I'>_return</emphasis> suffix as part of its name.
453 All other pointers passed to these functions are used for reading
454 only.  A few arguments use pointers to structures that are used for
455 both input and output and are indicated by using the <emphasis remap='I'>_in_out</emphasis>
456 suffix.
457 <!-- .IN "_return" "" "@DEF@" -->
458 <!-- .IN "_in_out" "" "@DEF@" -->
459     </para>
460   </listitem>
461 </itemizedlist>
462 </sect1>
463 <sect1 id="Format_of_the_Widget_Reference_Chapters">
464 <title>Format of the Widget Reference Chapters</title>
465 <para>
466 <!-- .LP -->
467 <!-- .IN "conventions" "chapter format" "@DEF@" -->
468 <!-- .IN "chapter format" "" "@DEF@" -->
469 The majority of this document is a reference guide for the Athena
470 widget set.  Chapters three through six give the programmer all
471 information necessary to use the widgets.  The layout of the chapters
472 follows a specific pattern to allow the programmer to easily find the
473 desired information.
474 </para>
475 <para>
476 <!-- .LP -->
477 The first few pages of every chapter give an overview of the widgets
478 in that section.  Widgets are grouped into chapters by functionality.
479 <variablelist>
480   <varlistentry>
481     <term>
482       "Chapter <!-- xref -->
483     </term>
484     <listitem>
485       <para>
486 Simple Widgets
487       </para>
488     </listitem>
489   </varlistentry>
490   <varlistentry>
491     <term>
492       "Chapter <!-- xref -->
493     </term>
494     <listitem>
495       <para>
496 Menus
497       </para>
498     </listitem>
499   </varlistentry>
500   <varlistentry>
501     <term>
502       "Chapter <!-- xref -->
503     </term>
504     <listitem>
505       <para>
506 Text Widgets
507       </para>
508     </listitem>
509   </varlistentry>
510   <varlistentry>
511     <term>
512       "Chapter <!-- xref -->
513     </term>
514     <listitem>
515       <para>
516 Composite and Constraint Widget
517     </para>
518   </listitem>
519   </varlistentry>
520 </variablelist>
521 </para>
522 <para>
523 <!-- .LP -->
524 Following the introduction will be a description of each widget in that
525 chapter.  When no functional grouping is obvious the widgets are listed
526 in alphabetical order, such as in chapters three and six.
527 </para>
528 <para>
529 <!-- .LP -->
530 The first section of each widget's description is a table that
531 contains general information about this widget class.  Here is the
532 table for the Box widget, and an explanation of all the entries.
533 <literallayout class="monospaced">
534 <!-- .TA 2.0i -->
535 <!-- .ta 2.0i -->
536 <!-- .sp -->
537 Application Header file &lt;X11/Xaw/Box.h&gt;
538 Class Header file       &lt;X11/Xaw/BoxP.h&gt;
539 Class           boxWidgetClass
540 Class Name      Box
541 Superclass      Composite
542 <!-- .sp -->
543 </literallayout>
544 <variablelist>
545   <varlistentry>
546     <term>
547       <function>Application Header File</function>
548     </term>
549     <listitem>
550       <para>
551 <!-- .IN "application header file" "" "@DEF@" -->
552 This file must be included when an application uses this widget.
553 It usually contains the class definition, and some resource macros.
554 This is often called the ``public'' header file.
555 <!-- .IN "class header file" "" "@DEF@" -->
556       </para>
557     </listitem>
558   </varlistentry>
559   <varlistentry>
560     <term>
561       <function>Class Header File</function>
562     </term>
563     <listitem>
564       <para>
565 This file will only be used by widget programmers.  It will need to be
566 included by any widget that subclasses this widget.  This is often
567 called the ``private'' header file.
568 <!-- .IN "class" "" "@DEF@" -->
569       </para>
570     </listitem>
571   </varlistentry>
572   <varlistentry>
573     <term>
574       <function>Class</function>
575     </term>
576     <listitem>
577       <para>
578 This is the widget class of this widget.  This global symbol is passed to
579 <function>XtCreateWidget</function> so that the Intrinsics will know which type of widget
580 to create.
581 <!-- .IN "class name" "" "@DEF@" -->
582       </para>
583     </listitem>
584   </varlistentry>
585   <varlistentry>
586     <term>
587       <function>Class Name</function>
588     </term>
589     <listitem>
590       <para>
591 This is the resource name of this class.  This name can be used in
592 a resource file to match any widget of this class.
593 <!-- .IN "superclass" "" -->
594       </para>
595     </listitem>
596   </varlistentry>
597   <varlistentry>
598     <term>
599       <function>Superclass</function>
600     </term>
601     <listitem>
602       <para>
603 This is the superclass that this widget class is descended from.  If
604 you understand how the superclass works it will allow you to more quickly
605 understand what this widget does, since much of its functionality may be
606 inherited from its superclass.
607 <!-- .sp -->
608     </para>
609   </listitem>
610   </varlistentry>
611 </variablelist>
612 </para>
613 <para>
614 <!-- .LP -->
615 After this table follows a general description of the default behavior of
616 this widget, as seen by the user.  In many cases this functionality
617 may be overridden by the application programmer, or by the user.
618 </para>
619 <para>
620 <!-- .LP -->
621 The next section is a table showing the
622 name, class, type and default value of each resource that is available
623 to this widget.  There is also a column containing notes describing
624 special restrictions placed upon individual resources.
625 <!-- .IN "notes" "" "@DEF@" -->
626 <!-- .IN "A, note" "" "@DEF@" -->
627 <!-- .IN "D, note" "" "@DEF@" -->
628 <!-- .IN "C, note" "" "@DEF@" -->
629 <!-- .IN "R, note" "" "@DEF@" -->
630 <variablelist>
631   <varlistentry>
632     <term>
633       A
634     </term>
635     <listitem>
636       <para>
637 This resource may be automatically adjusted when another
638 resource is changed.
639       </para>
640     </listitem>
641   </varlistentry>
642   <varlistentry>
643     <term>
644       C
645     </term>
646     <listitem>
647       <para>
648 This resource is only settable at widget creation time, and may not
649 be modified with <xref linkend='XtSetValues' xrefstyle='select: title'/>.
650       </para>
651     </listitem>
652   </varlistentry>
653   <varlistentry>
654     <term>
655       D
656     </term>
657     <listitem>
658       <para>
659 Do not modify this resource.  While setting this resource will
660 work, it can cause unexpected behavior.  When this symbol appears
661 there is another, preferred, interface provided by the X Toolkit.
662       </para>
663     </listitem>
664   </varlistentry>
665   <varlistentry>
666     <term>
667       R
668     </term>
669     <listitem>
670       <para>
671 This resource is READ-ONLY, and may not be modified.
672     </para>
673   </listitem>
674   </varlistentry>
675 </variablelist>
676 </para>
677 <para>
678 <!-- .LP -->
679 After the resource table is a detailed description of every resource
680 available to that widget.  Many of these are redundant, but printing
681 them with each widget saves page flipping.  The names of the resources
682 that are inherited are printed in plain text, while the names of the
683 resources that are new to this class are printed in <function>bold</function>.
684 If you have already read the description of the superclass you need
685 only pay attention to the resources printed in bold.
686 </para>
687 <para>
688 <!-- .LP -->
689 For each composite widget there is a section on layout semantics that
690 follows the resource description.  This section will describe the
691 effect of constraint resources on the layout of the children, as well
692 as a general description of where it prefers to place its children.
693 </para>
694 <para>
695 <!-- .LP -->
696 Descriptions of default translations and action routines come next, for
697 widgets to which they apply.  The last item in each widget's
698 documentation is the description of all convenience routines provided by
699 the widget.
700 </para>
701 </sect1>
702 <sect1 id="Input_Focus">
703 <title>Input Focus</title>
704 <!-- .XS -->
705 <!--    Input Focus -->
706 <!-- .XE -->
707 <!-- .IN "input focus" "" "@DEF@" -->
708 <!-- .IN "input" "" "@DEF@" -->
709 <!-- .IN "XtNinput" "" "@DEF@" -->
710 <para>
711 <!-- .LP -->
712 The Intrinsics define a resource on all Shell widgets that interact with
713 the window manager called <function>input</function>.  This resource requests the
714 assistance of window manager in acquiring the input focus.  The
715 resource defaults to <function>False</function> in the Intrinsics, but is redefined to
716 default to <function>True</function> when an application is using the Athena widget
717 set.  An application programmer may override this default and set the
718 resource back to <function>False</function> if the application does not need the window
719 manager to give it the input focus.  See the
720 <emphasis remap='I'>X Toolkit Intrinsics - C Language Interface</emphasis> for details
721 on the <emphasis remap='I'>input</emphasis> resource.
722
723 </para>
724 </sect1>
725 </chapter>