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