home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / X / mit / doc / Xaw / CH1 < prev    next >
Encoding:
Text File  |  1991-07-25  |  14.0 KB  |  407 lines

  1. .af % 1
  2. .pn 1
  3. .bp 1
  4. \&
  5. .sp 1
  6. .ce 3
  7. \s+1\fBChapter 1\fP\s-1
  8.  
  9. \s+1\fBAthena Widgets and The Intrinsics\fP\s-1
  10. .sp 2
  11. .nr H1 1
  12. .nr H2 0
  13. .nr H3 0
  14. .nr H4 0
  15. .nr H5 0
  16. .LP
  17. .XS
  18. Chapter 1 \- Athena Widgets and The \*(xI
  19. .XE
  20. The X Toolkit is made up of two distinct pieces, the Xt \*(xI and a
  21. widget set.  The Athena widget set is a sample implementation of a
  22. widget set built upon the \*(xI.  In the \*(tk, a widget is the
  23. combination of an X window or subwindow and its associated input and
  24. output semantics.
  25. .LP
  26. Because the \*(xI provide the same basic functionality to all widget
  27. sets it may be possible to use widgets from the Athena widget set with
  28. other widget sets based upon the \*(xI.  Since widget sets may also
  29. implement private protocols, all functionality may not be available when
  30. mixing and matching widget sets.  For information about the \*(xI, see
  31. the \fI\*(xT\fP.
  32. .LP
  33. The Athena widget set is a library package layered on top of the \*(xI
  34. and Xlib that provides a set of user interface tools sufficient to build
  35. a wide variety of applications.  This layer extends the basic
  36. abstractions provided by X and provides the next layer of functionality
  37. primarily by supplying a cohesive set of sample widgets.  Although the
  38. \*(xI are a Consortium standard, there is no standard widget set.
  39. .LP
  40. To the extent possible, the \*(xI are "policy-free".  The application
  41. environment and widget set, not the \*(xI, define, implement, and
  42. enforce:
  43. .IP \(bu 5
  44. Policy
  45. .IP \(bu 5
  46. Consistency
  47. .IP \(bu 5
  48. Style 
  49. .LP
  50. Each individual widget implementation defines its own policy.  The \*(tk
  51. design allows for, but does not necessarily encourage, the free mixing
  52. of radically differing widget implementations.
  53. .NH 2
  54. Introduction to the \*(tk 
  55. .LP
  56. .XS
  57.     Introduction to the \*(tk
  58. .XE
  59. .IN "introduction" "" "@DEF@"
  60. The \*(tk provides tools that simplify the design of
  61. application user interfaces in the X Window System programming environment.
  62. It assists application programmers by providing a set of common
  63. underlying user-interface functions.  It also lets widget programmers
  64. modify existing widgets, by subclassing, or add new widgets.  By using
  65. the \*(tk in their applications, programmers can present a similar
  66. user interface across applications to all workstation users.
  67. .LP
  68. The \*(tk consists of:
  69. .IP \(bu 5
  70. A set of \*(xI functions for building widgets
  71. .IP \(bu 5
  72. An architectural model for constructing widgets 
  73. .IP \(bu 5
  74. A widget set for application programming
  75. .LP
  76. While the majority of the \*(xI functions are intended 
  77. for the widget programmer,
  78. a subset of the \*(xI functions are to be used by application programmers
  79. (see  \fI\*(xT\fP).
  80. The architectural model lets the widget programmer design new widgets
  81. by using the \*(xI and by combining other widgets.
  82. The application interface layers built on top of the \*(tk include a
  83. coordinated set of widgets and composition policies.
  84. Some of these widgets and policies are specific to a single
  85. application domain, and others are common to a variety of
  86. applications. 
  87. .LP
  88. The remainder of this chapter discusses the \*(tk and Athena widget set:
  89. .IP \(bu 5
  90. Terminology
  91. .IP \(bu 5
  92. Model
  93. .IP \(bu 5
  94. Conventions used in this manual
  95. .IP \(bu 5
  96. Format of the Widget Reference Chapters
  97. .LE
  98. .NH 2 
  99. Terminology
  100. .LP
  101. .XS
  102.     Terminology
  103. .XE
  104. .LP
  105. In addition to the terms already defined for X programming (see \fI\*(xL\fP),
  106. the following terms are specific to the \*(xI and Athena widget set
  107. and used throughout this document. 
  108. .LP
  109. \fBApplication programmer\fP
  110. .IN "application programmer" "" "@DEF@"
  111. .IP
  112. A programmer who uses the \*(tk to produce an application user interface.
  113. .LP
  114. \fBChild\fP
  115. .IN "child" "" "@DEF"
  116. .IP
  117. A widget that is contained within another "parent" widget.
  118. .LP
  119. \fBClass\fP
  120. .IN "class" "" "@DEF@"
  121. .IP
  122. The general group to which a specific object belongs.
  123. .LP
  124. \fBClient\fP
  125. .IN "client" "" "@DEF@"
  126. .IP
  127. A function that uses a widget in an application or for composing
  128. other widgets.
  129. .LP
  130. \fBFullName\fP
  131. .IN "FullName" "" "@DEF"
  132. .IP
  133. The name of a widget instance appended to the full name of its parent.
  134. .LP
  135. \fBInstance\fP
  136. .IN "instance" "" "@DEF@"
  137. .IP
  138. A specific widget object as opposed to a general widget class.
  139. .LP
  140. \fBMethod\fP
  141. .IN "method" "" "@DEF@"
  142. .IP
  143. A function or procedure implemented by a widget class.
  144. .LP
  145. \fBName\fP
  146. .IN "name" "widget" "@DEF@"
  147. .IP
  148. The name that is specific to an instance of a widget for a given client.
  149. This name is specified at creation time and cannot be modified.
  150. .LP
  151. \fBObject\fP
  152. .IN "object" "" "@DEF@"
  153. .IP
  154. A data abstraction consisting of private data and private and public
  155. functions that operate on the private data.
  156. Users of the abstraction can interact with the object only through calls
  157. to the object's public functions.
  158. In the \*(tk,
  159. some of the object's public functions are called directly by the application,
  160. while others are called indirectly when the application calls the common
  161. \*(xI functions.
  162. In general, if a function is common to all widgets,
  163. an application uses a single \*(xI function to invoke the function for all
  164. types of widgets.
  165. If a function is unique to a single widget type,
  166. the widget exports the function.
  167. .LP
  168. \fBParent\fP
  169. .IN "parent" "" "@DEF@"
  170. .IP
  171. A widget that contains at least one other ("child") widget.
  172. A parent widget is also known as a composite widget.
  173. .LP
  174. \fBResource\fP
  175. .IN "resource" "" "@DEF@"
  176. .IP
  177. A named piece of data in a widget that can be set by a client,
  178. by an application, or by user defaults.
  179. .LP
  180. \fBSuperclass\fP
  181. .IN "superclass" "" "@DEF@"
  182. .IP
  183. A larger class of which a specific class is a member.
  184. All members of a class are also members of the superclass.
  185. .LP
  186. \fBUser\fP
  187. .IN "user" "" "@DEF@"
  188. .IP
  189. A person interacting with a workstation.
  190. .LP
  191. \fBWidget\fP
  192. .IN "widget" "" "@DEF@"
  193. .IP
  194. An object providing a user-interface abstraction (for example, a Scrollbar
  195. widget).
  196. .LP
  197. \fBWidget class\fP
  198. .IN "widget class" "" "@DEF@"
  199. .IP
  200. The general group to which a specific widget belongs,
  201. otherwise known as the type of the widget.
  202. .LP
  203. \fBWidget programmer\fP
  204. .IN "widget programmer" "" "@DEF@"
  205. .IP
  206. A programmer who adds new widgets to the \*(tk.
  207. .NH 2
  208. Underlying Model
  209. .LP
  210. .XS
  211.     Underlying Model
  212. .XE
  213. .IN "underlying model" "" "@DEF@"
  214. The underlying architectural model is based on the following premises:
  215. .KS
  216. .IP "Widgets are X windows"
  217. .IP
  218. Every user-interface widget is associated with an X window.
  219. The X window ID for a widget is readily available from the widget.
  220. Standard Xlib calls can be used by widgets for many of their input and
  221. output operations.
  222. .KE
  223. .KS
  224. .IP "Information hiding"
  225. .IP
  226. The data for every widget is private to the widget and its subclasses.
  227. That is, the data is neither directly accessible 
  228. nor visible outside of the module implementing the widget.
  229. All program interaction with the widget is performed by a set of operations
  230. (methods) that are defined for the widget.
  231. .KE
  232. .KS
  233. .IP "Widget semantics and widget layout geometry"
  234. .IP
  235. Widget semantics are clearly separated from widget layout geometry.
  236. Widgets are concerned with implementing specific user-interface
  237. semantics.  They have little control over issues such as their size or
  238. placement relative to other widget peers.  Mechanisms are provided for
  239. associating geometric managers with widgets and for widgets to make
  240. suggestions about their own geometry.
  241. .KE
  242. .NH 2
  243. Conventions Used in this Manual
  244. .IP \(bu 5
  245. .IN "conventions" "used in manual" "@DEF@"
  246. All resources available to the widgets are listed with each widget.  Many
  247. of these are available to more than one widget class due to the object
  248. oriented nature of the \*(xI.  The new resources for each widget are
  249. listed in bold text, and the inherited resources are listed in plain text.
  250. .IP \(bu 5
  251. Global symbols are printed in \fBbold\fP and can be function names,
  252. symbols defined in include files, or structure names.  Arguments are
  253. printed in \fIitalics\fP.
  254. .IP \(bu 5
  255. Each function is introduced by a general discussion that distinguishes
  256. it from other functions.  The function declaration itself follows, and
  257. each argument is specifically explained.  General discussion of the
  258. function, if any is required, follows the arguments.  Where
  259. applicable, the last paragraph of the explanation lists the return values
  260. of the function.
  261. .IP \(bu 5
  262. To eliminate any ambiguity between those arguments that you pass and
  263. those that a function returns to you, the explanations for all
  264. arguments that you pass start with the word \fIspecifies\fP or, in the
  265. case of multiple arguments, the word \fIspecify\fP. The explanations
  266. for all arguments that are returned to you start with the word
  267. \fIreturns\fP or, in the case of multiple arguments, the word
  268. \fIreturn\fP.  The explanations for all arguments that you can pass
  269. and are returned start with the words \fIspecifies and returns\fP.
  270. .IP \(bu 5
  271. Any pointer to a structure that is used to return a value is
  272. designated as such by the \fI_return\fP suffix as part of its name.
  273. All other pointers passed to these functions are used for reading
  274. only.  A few arguments use pointers to structures that are used for
  275. both input and output and are indicated by using the \fI_in_out\fP
  276. suffix.
  277. .IN "_return" "" "@DEF@"
  278. .IN "_in_out" "" "@DEF@"
  279. .NH 2
  280. Format of the Widget Reference Chapters
  281. .LP
  282. .IN "conventions" "chapter format" "@DEF@"
  283. .IN "chapter format" "" "@DEF@"
  284. The majority of this document is a reference guide for the Athena
  285. widget set.  Chapters three through six give the programmer all
  286. information necessary to use the widgets.  The layout of the chapters
  287. follows a specific pattern to allow the programmer to easily find the
  288. desired information.
  289. .LP
  290. The first few pages of every chapter give an overview of the widgets
  291. is that section.  Widgets are grouped into chapters by functionality.
  292. .IP "Chapter 3" .75i
  293. Simple Widgets
  294. .IP "Chapter 4" .75i
  295. Menus
  296. .IP "Chapter 5" .75i
  297. Text Widgets
  298. .IP "Chapter 6" .75i
  299. Composite and Constraint Widget
  300. .LP
  301. Following the introduction will be a description of each widget is that
  302. chapter.  When no functional grouping is obvious the widgets are listed
  303. in alphabetical order, such as in chapters three and six.
  304. .LP
  305. The first section of each widget's description is a table that
  306. contains general information about this widget class.  Here is the
  307. table for the Box widget, and an explanation of all the entries.
  308. .Ds 0
  309. .TA 2.0i
  310. .ta 2.0i
  311. .sp
  312. Application Header file    <X11/Xaw/Box.h>
  313. Class Header file    <X11/Xaw/BoxP.h>
  314. Class        boxWidgetClass
  315. Class Name    Box
  316. Superclass    Composite
  317. .sp
  318. .De
  319. .IP "\fBApplication Header File\fP" 2.0i
  320. .IN "application header file" "" "@DEF@"
  321. This file must be included when an application uses this widget.
  322. It usually contains the class definition, and some resource macros.
  323. This is often called the ``public'' header file.
  324. .IN "class header file" "" "@DEF@"
  325. .IP "\fBClass Header File\fP" 2.0i
  326. This file will only be used by widget programmers.  It will need to be
  327. included by any widget that subclasses this widget.  This is often
  328. called the ``private'' header file.
  329. .IN "class" "" "@DEF@"
  330. .IP \fBClass\fP 2.0i
  331. This is the widget class of this widget.  This global symbol is passed to
  332. \fBXtCreateWidget\fP so that the \*(xI will know which type of widget
  333. to create.
  334. .IN "class name" "" "@DEF@"
  335. .IP "\fBClass Name\fP" 2.0i
  336. This is the resource name of this class.  This name can be used in
  337. a resource file to match any widget of this class. 
  338. .IN "superclass" ""
  339. .IP \fBSuperclass\fP 2.0i
  340. This is the superclass that this widget class is descended from.  If
  341. you understand how the superclass works it will allow you to more quickly
  342. understand what this widget does, since much of its functionality may be
  343. inherited from its superclass.
  344. .sp
  345. .LP
  346. After this table follows a general description of the default behavior of
  347. this widget, as seen by the user.  In many cases this functionality
  348. may be overridden by the application programmer, or by the user.
  349. .LP
  350. The next section is a table showing the
  351. name, class, type and default value of each resource that is available
  352. to this widget.  There is also a column containing notes describing
  353. special restrictions placed upon individual resources. 
  354. .IN "notes" "" "@DEF@"
  355. .IN "A, note" "" "@DEF@"
  356. .IN "D, note" "" "@DEF@"
  357. .IN "C, note" "" "@DEF@"
  358. .IN "R, note" "" "@DEF@"
  359. .IP A .5i
  360. This resource may be automatically adjusted when another
  361. resource is changed.
  362. .IP C .5i
  363. This resource is only settable at widget creation time, and may not
  364. be modified with \fBXtSetValues\fP.
  365. .IP D .5i
  366. Do not modify this resource.  While setting this resource will
  367. work, it can cause unexpected behavior.  When this symbol appears
  368. there is another, preferred, interface provided by the \*(tk.
  369. .IP R .5i
  370. This resource is READ-ONLY, and may not be modified. 
  371. .LP
  372. After the resource table is a detailed description of every resource
  373. available to that widget.  Many of these are redundant, but printing
  374. them with each widget saves page flipping.  The names of the resources
  375. that are inherited are printed in plain text, while the names of the
  376. resources that are new to this class are printed in \fBbold\fP.
  377. If you have already read the description of the superclass you need
  378. only pay attention to the resources printed in bold.
  379. .LP
  380. For each composite widget there is a section on layout semantics that
  381. follows the resource description.  This section will describe the
  382. effect of constraint resources on the layout of the children, as well
  383. as a general description of where it prefers to place its children.
  384. .LP
  385. Descriptions of default translations and action routines come next, for
  386. widgets to which they apply.  The last item in each widget's
  387. documentation is the description of all convenience routines provided by
  388. the widget.
  389. .NH 2
  390. Input Focus
  391. .XS
  392.     Input Focus
  393. .XE
  394. .IN "input focus" "" "@DEF@"
  395. .IN "input" "" "@DEF@"
  396. .IN "XtNinput" "" "@DEF@"
  397. .LP
  398. The \*(xI define a resource on all Shell widgets that interact with
  399. the window manager called \fBinput\fP.  This resource requests the
  400. assistance of window manager in acquiring the input focus.  The
  401. resource defaults to \fBFalse\fP in the \*(xI, but is redefined to
  402. default to \fBTrue\fP when an application is using the Athena widget
  403. set.  An application programmer may override this default and set the
  404. resource back to \fBFalse\fP if the application does not need the window
  405. manager to give it the input focus.  See the \fI\*(xT\fP for details
  406. on the \fIinput\fP resource.
  407.