home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / x / volume10 / wcl / part01 next >
Internet Message Format  |  1990-12-17  |  58KB

  1. Path: uunet!cs.utexas.edu!sun-barr!newstop!exodus!jpl-devvax.jpl.nasa.gov
  2. From: david@jpl-devvax.jpl.nasa.gov (David E. Smyth)
  3. Newsgroups: comp.sources.x
  4. Subject: v10i049: wcl -- widget creation library, Part01/11
  5. Message-ID: <4676@exodus.Eng.Sun.COM>
  6. Date: 18 Dec 90 02:02:07 GMT
  7. Sender: news@exodus.Eng.Sun.COM
  8. Lines: 1443
  9. Approved: argv@sun.com
  10.  
  11. Submitted-by: david@jpl-devvax.jpl.nasa.gov (David E. Smyth)
  12. Posting-number: Volume 10, Issue 49
  13. Archive-name: wcl/part01
  14.  
  15. the README is below...
  16.  
  17. # to unbundle, "sh" this file -- DO NOT use csh
  18. #  SHAR archive format.  Archive created Fri Oct 19 09:31:54 PDT 1990
  19. echo x - 0thREADME
  20. sed 's/^X//' > 0thREADME <<'+FUNKY+STUFF+'
  21. XNext Projected Release Date: 1 Dec 1990.  Send in
  22. Xyour comments, bug reports, and enhancement requests!
  23. X
  24. X
  25. XWidget Creation Library Release 1.04 (Patch Level 4)
  26. X====================================================
  27. X
  28. XThis release still has NOT been extensively tested with Motif 1.1.1
  29. XI did not want to wait any longer...  There are a few bugs:  If you
  30. Xrun the Periodic example, and resize the window using your window
  31. Xmanager, you will see one bug.  If you run the multi-display demo
  32. Xusing Motif widgets, you'll see another (SEGV deep in Xt after
  33. Xa display connection has been closed and another is being opened).
  34. X
  35. XSince these bugs are seemingly completely unrelated to the Widget
  36. XCreation Library itself, I figured this release could go out.  There
  37. Xare many things which are fixed and made alot better.
  38. X
  39. XEnhancements:
  40. X-------------
  41. X
  42. Xo  Imakefile and makefile seem to be alot better now. There will be 
  43. X   some edits required to support Motif 1.1, these are indicated in 
  44. X   comments.  It is quite easy now.
  45. X
  46. Xo  Added WcMapACT, WcMapCB, WcUnmapACT, and WcUnmapCB.
  47. X
  48. Xo  CvtStringToCallback() now uses the default client data which can
  49. X   be registered with WcRegisterCallback().  In previous versions, this
  50. X   data was registered, but thereafter always ignored.  
  51. X
  52. X   In this version, the client data is returned when no argument is 
  53. X   specified and client data is not NULL.  If client data is NULL (by 
  54. X   far the most common case) then a NULL string ("") is returned when 
  55. X   no arguments are given in the resource file.  
  56. X
  57. X   NOTE that this means the client data is exactly the same as earlier 
  58. X   versions if the callback was registered with NULL client data.  The 
  59. X   behavior is different (correct) when default client data has been 
  60. X   registered with the callback - now the callback gets the client data 
  61. X   if the resource database DOES NOT specify any client data.  If the
  62. X   resource database DOES specify client data, then that client data
  63. X   gets passed to the callback as a null terminated string.
  64. X
  65. Xo  Richard Hesketh (rlh2@ukc.ac.uk) found something missing in 
  66. X   WcFullNameToWidget:  The function will now resolve the following
  67. X   as expected:  w = WcFullNameToWidget(ref_w, ".aChild");
  68. X
  69. Xo  Andrew Peebles (peebles@mips.com) also found something missing
  70. X   in WcFullNameToWidget:  The function will now resolve widget
  71. X   names when the name starts in a completely different widget tree.
  72. X   While providing this capability, the function was also optimized
  73. X   for speed at the expense of a few additional lines of code.
  74. X
  75. Xo  Also, Peeb noticed that WcPopupCB did not do what was intended,
  76. X   (non-modal popups) so the grab kind has been changed from
  77. X   XtGrabNonexclusive to XtGrabNone.
  78. X
  79. Xo  A minor optimization was made in the recursive creation loop:
  80. X   The parent's name is now only determined when a warning
  81. X   message is to be generated, rather than every time.  A typical
  82. X   space-time tradeoff, changed to improve performance at a minor
  83. X   increase in line count.
  84. X
  85. Xo  The conditional compilation flags for old versions of Xt
  86. X   used by Motif 1.0 has been changed from `#ifdef MOTIF' to 
  87. X   a more precise scheme where both major and minor version of
  88. X   Motif is used. 
  89. X
  90. Xo  The conditional compilation flag MOTIF is still used in
  91. X   special cases: 
  92. X   - the example program MD.c uses it to determine which widget 
  93. X     set gets registered, 
  94. X   - WcConvert.c provides a Motif specific converter 
  95. X     `CvtStringToMenuWidget'
  96. X   - and WcCreateP.h uses it in concert with the DEBUG compilation
  97. X     flag to include all Motif include files so that a debugger can 
  98. X     print the members of the Motif widgets.  Not necessary, just a 
  99. X     programmer convenience.
  100. X
  101. XFixes:
  102. X------
  103. X
  104. Xo  Carl Witty (cwitty@cs.stanford.edu) discovered an obscure
  105. X   bug in the XtIsShell macro definition which was causing grief.
  106. X
  107. Xo  Some memory leaks were found and corrected: XtTblParseLayout(),
  108. X   WcSetValuesCB() which was also made faster.
  109. X
  110. Xo  A non-initialized return value in MatchWildChildren was fixed
  111. X   (this fixes a bug which was in code borrowed from Xt).
  112. X
  113. Xo  An implementation of strstr is provided for systems which do not
  114. X   have ANSI C libraries.
  115. X
  116. Xo  Gadgets are now detected using standard Xt functions rather
  117. X   than Motif specific functions.
  118. X
  119. X
  120. XWidget Creation Library Release 1.03 (Patch Level 3)
  121. X====================================================
  122. X
  123. XFixes:
  124. X------
  125. X
  126. Xo  Some memory leaks were found and corrected.
  127. X
  128. Xo  Some unnessesary variables were removed.
  129. X
  130. Xo  Root widgets are now deleted properly.
  131. X
  132. Xo  Documented WcSystemCB() in the *README files.
  133. X
  134. Xo  Trailing whitespace is now stripped in WcSetValueCB.
  135. X
  136. Xo  WcSetValueCB now correctly checks to see the required type
  137. X   of the resource being set, and performs conversions accordingly.
  138. X   In previous versions, any time the value was `this' it would
  139. X   be converted to the widget getting the callback.
  140. X
  141. Xo  CvtStringToCallback was fixed so it handles multiple callback
  142. X   functions correctly.  Callback specifications which ended with two
  143. X   consecutive closed parenthesis were mishandled.
  144. X
  145. Xo  CvtStringToMenuWidget could cause core dumps in previous versions.
  146. X   It now gives warning messages in such situations, and provides
  147. X   a message for other misuses.
  148. X
  149. Xo  WcCreateDatabaseChild now does a more accurate job of tracing names.
  150. X
  151. X@  Now, children created by Motif Constructors are handled MUCH better.
  152. X   You will no longer get those stupid warnings from Xt saying:
  153. X    "Not all widgets in XtManageChildren have the same parent"
  154. X
  155. Xo  The message "No children defined in Xrm database" now provides
  156. X   a useful suggestion as to what is probably wrong.
  157. X
  158. Xo  Both constraint and widget resources can now be set via
  159. X   WcSetValueFromString.
  160. X
  161. Xo  An obscure bug in Table was fixed which caused divide-by-zero
  162. X   errors with incorrect resource specifications.
  163. X
  164. XEnhancements:
  165. X-------------
  166. X
  167. Xo  More and better examples.
  168. X
  169. Xo  An additional Wc resource which allows the description of a widget and
  170. X   its children to be in another resource file.  My resource files were
  171. X   getting too darn big.  This allows separate resource files to describe
  172. X   parts of the widget heirarchy.  Of course, since everything is loaded
  173. X   into the same Xrm database, you can reference widgets in other resource
  174. X   files.  In a sense, all widgets are "global."
  175. X
  176. Xo  WcLoadResourceFileCB no longer messes with its incoming arguments,
  177. X   and it keeps track of the resource files which have been loaded
  178. X   so they are not loaded multiple times.
  179. X
  180. Xo  Widget names passed to callback functions now support relative naming.
  181. X   The special name `this' meaning the widget getting the callback is
  182. X   still supported.  Additional special characters `^' which means
  183. X   the parent, and `~' which means the shell ancestor are now also
  184. X   provided.
  185. X
  186. Xo  A new registration routine has been added: WcRegisterAction.  This 
  187. X   is basically a wrapper around XtAppAddActions(), which should still 
  188. X   be used if you are registering several actions.
  189. X
  190. Xo  WcRegisterWcActions now uses the XtAppContext argument which is 
  191. X   passed to all the WcRegister* routines.  In all others, the 
  192. X   XtAppContext argument continues to be ignored.
  193. X
  194. Xo  All Xt widgets are now registered: Object, RectObject, Core, Composite,
  195. X   Constraint, ApplicationShell, OverrideShell, Shell, TopLevelShell,
  196. X   TransientShell, VendorShell, and WmShell.
  197. X
  198. Xo  In order to facilitate using the Widget Creation Library within an
  199. X   interactive and possibly interpretive user interface builder, it is now
  200. X   possible to override the registrations of class pointers, class names,
  201. X   constructors, and (probably most importantly) callbacks.  By default,
  202. X   the registration routines WcRegisterClassPtr, WcRegisterCallback, etc.,
  203. X   ignore attempts at re-registration.  If WcAllowDuplicateRegistration
  204. X   is called, then all the routines will allow re-registration.
  205. X
  206. X   Re-registration over-writes existing registrations of the same name.
  207. X   For completeness, the following new routines are provided:
  208. X   WcAllowDuplicateRegistration(), WcAllowDuplicateClassPtrReg(),
  209. X   WcAllowDuplicateClassNameReg(), WcAllowDuplicateConstructorReg(),
  210. X   WcAllowDuplicateCallbackReg(), so the client may choose which
  211. X   registration routines honor duplicate registration requests.
  212. X
  213. XWhat was NOT Done
  214. X-----------------
  215. X
  216. Xo  The version of Table provided with this distribution is NOT
  217. X   the same as that provided by Nazgul@alphalpha.com (Kee Hinckley).
  218. X   Why?  His is fully Motif-ized, including changing it so it is
  219. X   a subclass of a Motif manager widget, has specific behaviors
  220. X   to make up for obscure Motif widget mis-behaviors, and it uses
  221. X   Motif specific functions.
  222. X   
  223. X   Kee has done good work: if you want a more Motif-ized version of 
  224. X   Table, send him mail, he will send it to you.  The version of 
  225. X   Table provided herein refuses to work with Gadgets, and does not 
  226. X   work properly with XmText widgets due to an apparent bug in 
  227. X   XmText geometry handshaking.
  228. X
  229. Xo  The libraries built do NOT include the MriRegAll.o nor AriRegAll.o
  230. X   object files.  I am considering including them next time.  SEND
  231. X   ME YOUR VOTES on if you think this is a good idea.  
  232. X
  233. X   The problem is that including them into the library would mean the 
  234. X   library could not be built _consistently_ unless BOTH widget sets are
  235. X   available.  This sometimes is not the case.  I would rather keep
  236. X   Wc strictly Xt Intrinsics dependent, and not widget set dependent.
  237. X
  238. X   Also, I think that over time more and more widgets will be available
  239. X   over the net, and so a given user, team, or site may want to register
  240. X   more or different widgets.
  241. X
  242. Xo  The resource file loading due to wcResFile resources and due to
  243. X   invocations of the WcLoadResourceFileCB standard callback still
  244. X   do not perform file name searches which conform to the X11R4 Xt
  245. X   manual.  This will be fixed in a release of Wc which follows the
  246. X   wide availability of Motif 1.1, probably in about October 1990.
  247. X
  248. X
  249. XWidget Creation Library Release 1.02 (Patch Level 2)
  250. X====================================================
  251. X
  252. XFixes:
  253. X------
  254. X
  255. Xo  A missing argument in a missing argument error message 8-}
  256. X
  257. Xo  Extra tokens after #endif's are removed.
  258. X
  259. Xo  File names shortened, and fixed in comments to match perfectly the file
  260. X   names.
  261. X
  262. XEnhancements:
  263. X-------------
  264. X
  265. XWidget Creation Library Release 1.01 (Patch Level 1)
  266. X====================================================
  267. X
  268. XFixes:
  269. X------
  270. X
  271. Xo  This version is reported to work with Motif 1.1
  272. X
  273. Xo  The Table widget has been fixed so it does not grow when column spacing
  274. X   is non-zero and the table or the table's children are resized.
  275. X
  276. Xo  A couple of bugs were discovered and fixed.
  277. X
  278. XEnhancements:
  279. X-------------
  280. X
  281. Xo  There is an Imakefile.  The makefile builds a Makefile using this
  282. X   Imakefile.
  283. X
  284. Xo  There are action functions provided for all the Wc standard callbacks.
  285. X   Actions are more powerful than callbacks in the ways they can be
  286. X   attached to widgets.  
  287. X
  288. Xo  There is another example program with resource file which demonstrates
  289. X   the use of actions.
  290. X
  291. Xo  The example resource files were changed so all have mechanisms to quit,
  292. X   usually a quit button.
  293. X
  294. Xo  There is a test program which executes all the programs within the
  295. X   standard distribution, using all of the resource files.
  296. +FUNKY+STUFF+
  297. echo '-rw-r--r--  1 david       11240 Oct 18 17:15 0thREADME    (as sent)'
  298. chmod u=rw,g=r,o=r 0thREADME
  299. ls -l 0thREADME
  300. echo x - 1stREADME
  301. sed 's/^X//' > 1stREADME <<'+FUNKY+STUFF+'
  302. X                        Widget Creation Library,
  303. X                       Motif Resource Interpreter,
  304. X                      Athena Resource Interpreter:
  305. X
  306. X                An Easier Way to Develop Applications
  307. X                    using Motif and Athena Widgets.
  308. X
  309. XWindow-based applications are notoriously difficult to program.  When
  310. Xthe Macintosh was introduced in early 1984, Bill Gates projected that
  311. X50% of Microsoft revenues would come from Mac application by October
  312. X1984.  In reality, the first Mac applications were only beginning to be
  313. Xshipped by that date.  
  314. X
  315. XWhen Steve Jobs left Apple and developed the NeXT computer, the window
  316. Xenvironment was specifically designed to support a WYSIWYG interface
  317. Xbuilder.  NextStep and the NeXT IB were the results of this effort.
  318. X
  319. XThe X developers at MIT and DEC also needed an easy way to develop
  320. Xwindowed applications.  Instead of developing a WYSIWYG tool like NeXT,
  321. Xthey developed a toolkit where interfaces were specified using C code,
  322. Xand could be significantly modified via `resource files' using a
  323. Xminimum number of attribute specifications. They provided an instance
  324. Xattribute inheritance mechanism to propogate attributes throughout an
  325. Xinterface.  This allows such simple specification as the following to
  326. Xalter every font in an interface:
  327. X
  328. X        *font: 9x15
  329. X
  330. XThe toolkit is called the Xt Intrinsics.  The windows, buttons, menus,
  331. Xscrollbars, etc., are called Widgets.  The Athena Widgets are one set
  332. Xof user interface objects built upon the Xt Intrinsics.  Motif is
  333. Xanother set of widgets.
  334. X
  335. XAs time went on, developers of widget-based applications found the
  336. Xresource files to be more and more useful.  For the fourth release of
  337. Xthe X11 window system, many of the example programs evolved to the
  338. Xpoint that only the raw behavior of the applications were specified in
  339. XC, with most of the look and feel being specified using resource files.
  340. X
  341. XAt the fourth annual X Technical Conference, several people pointed
  342. Xout that resource files could be used to specify everything about
  343. Xa widget based user interface, except the actual "tree" of widgets,
  344. Xtheir types, and bindings of behaviors to the user interface widgets.
  345. XCould the resource mechanism be enhanced to allow these to be specified
  346. Xas well?
  347. X
  348. XMartin Brunecky at Auto-Trol in Denver Colorado took up the challenge,
  349. Xand posted a simple set of routines which he called WsXc, for "Window
  350. XSystem: Xrm Creation."
  351. X
  352. XXrm stands for X Resource Manager, which is a heirarchical database for
  353. Xkeeping arbitrary named data related to X window interfaces.  The Xt
  354. XIntrinsics use Xrm for widget resources.  The basic idea of WsXc is
  355. Xto search the Xrm database, starting at the root, and pull out resources
  356. Xwhich describe the widget heirarchy and bindings to callback functions.
  357. X
  358. XOver the next several months, WsXc was repackaged as Mri (Motif
  359. XResource Interpreter), and then Ari (Athena Resource Interpreter), and
  360. Xfinally generalized into the Widget Creation Library.  The result provides
  361. Xseveral significant benefits to the developer and the user:
  362. X
  363. X        o Rapid Prototyping: Arbitrarily complex widget interfaces
  364. X                may be specified, and many common behaviors (pop-up,
  365. X                change attributes, exit) can be specified for the
  366. X                interface.
  367. X
  368. X        o Prototyping Environment is the Development Environment is
  369. X                the Delivery Environment: There is no specific breaking
  370. X                point between prototyping, developing, and tuning a
  371. X                delivered program.
  372. X
  373. X        o Minimum Specifications: The Xrm and Xt Intrinsics instance
  374. X                attribute inheritance mechanism is fully utilized, so
  375. X                a minimum number of specifications can describe a
  376. X                complete user interface.
  377. X
  378. X        o Extensible:  Adding new widget types and callback routines
  379. X                is trivial.
  380. X
  381. X        o Widget Set Independent: The C code which provides the
  382. X                behavior of the application can frequently be
  383. X                written in a widget set independent manner.  This
  384. X                allows an application to be written which supports
  385. X                multiple look-and-feel definitions: Motif, OpenLook,
  386. X                and Athena interfaces can all be front-ends to the
  387. X                same underlying application.
  388. X
  389. X        o The user can make any change to the interface: Deeply nested
  390. X                menus can be substituted for dialog boxes, or vice versa.
  391. X                Any label or image can be altered, which supports inter-
  392. X                nationalization.
  393. X
  394. X
  395. XThe Widget Creation Library Distribution
  396. X----------------------------------------
  397. X
  398. XThe Widget Creation Library is a cleanup and enhancement of Martin
  399. XBrunecky's second posting of WsXc.
  400. X
  401. XThe emphasis of the cleanup was to provide a separation of functionality
  402. Xand declarations between source and include files, to make the naming
  403. Xconcise and unique, and to reduce the complexity of the interface between
  404. Xthe library and the application (it was pretty darn good already).
  405. X
  406. XThe emphasis of the enhancements were to add clear(er) warning and
  407. Xerror messages, add more utility callbacks, and to provide a few simple
  408. Xfunctions which make writing callbacks and converters a little easier.
  409. X
  410. XOne of the guiding principles was and is KISS.  This is intended to
  411. Xbe a very small library which provides very big gains in productivity
  412. Xfor programmers developing applications using the various widget
  413. Xsets based on the Xt Intrinsics.  A large number of the total lines
  414. Xof code provide error messages.  The rest is quite straight forward.
  415. X
  416. XThis directory contains files which make up libWc, the Widget Creation
  417. XLibrary, Ari, the Athena Resource Interpreter, and Mri, the Motif
  418. XResource Interpreter.
  419. X
  420. XAuthors
  421. X-------
  422. X
  423. XMartin Brunecky at Auto-trol Technology, Denver (marbru@auto-trol.UUCP)
  424. Xwrote the initial code and posted it to comp.windows.x with the title
  425. XPOOR MAN's UIL - WsXc.
  426. X
  427. XDavid Harrison of the UC Berkeley Electronics Research Lab
  428. X(davidh@ic.Berkeley.EDU or ...!ucbvax!ucbcad!davidh) wrote a very
  429. Xuseful Table widget.  It is so good I've included it with this
  430. Xdistribution.  It is separately available from archive sites.  See
  431. XTableHEARYE and TableFIRST for information on this widget.  I made very
  432. Xminor edits to make it work with Motif, and I fixed exactly one minor
  433. Xbug.
  434. X
  435. XRod Whitby of Austek Microsystems Pty. Ltd. in Adelaide, Australia
  436. X(rwhitby@adl.austek.oz.au) wrote the WcRegXt.c file, and caught 
  437. Xseveral bugs.
  438. X
  439. XThe rest was done by me, and here is my standard .sig:
  440. X
  441. X-------------------------------------------------------------------------
  442. XDavid Smyth                david@jpl-devvax.jpl.nasa.gov
  443. XSenior Software Engineer,        seismo!cit-vax!jpl-devvax!david
  444. XX and Object Guru.            (818)393-0983
  445. XJet Propulsion Lab, M/S 230-103, 4800 Oak Grove Drive, Pasadena, CA 91109
  446. X-------------------------------------------------------------------------
  447. X
  448. XMany people helped alot by providing bug fixes, enhancements, suggestions,
  449. Xand just plain feedback.  There are many who helped, including Andrew Peebles 
  450. Xat MIPS, Randy Brown, Art Poley, Mike Yee of OSF, Richard Hesketh, and
  451. Xour own Kaleb Keithley.
  452. X
  453. X
  454. XREADME Files and Documentation
  455. X------------------------------
  456. X
  457. XThe *README files provide minimal documentation.  I think you will
  458. Xfind the comments in the source files useful.  Also, several
  459. Xexample resource files are provided with extensive comments.
  460. X
  461. XA paper which I presented at the European X User's Group meeting
  462. Xin Guildford, Surrey, UK in September 1990 is available in Postscript
  463. Xform.  The paper can be considered a reference or programmer's manual.
  464. XSlides from that talk are likewise available, also in Postscript.  The
  465. Xslides provide several examples.
  466. X
  467. XMakefiles
  468. X---------
  469. X
  470. XAn Imakefile and a makefile are provided.  As provided, they build on
  471. Xour Sun and VAX machines which are still using Motif 1.0.  Commented
  472. Xout lines are provided which work on Suns using Motif 1.1.1.  There are
  473. Xcomments at the beginning of the Imakefile and makefile which point out
  474. Xthe lines which you may have to change.  In order to avoid phase
  475. Xerrors, I'll add no details here.  See the Imakefile and makefile!
  476. X
  477. XBuilding The Distribution using Imake
  478. X-------------------------------------
  479. X
  480. XIf you have Imake, you can build the distribution very simply.
  481. X
  482. X    % make Makefile
  483. X
  484. XYou may then build the delivery using this Makefile:
  485. X
  486. X    % make
  487. X
  488. XOtherwise...
  489. X------------
  490. X
  491. XOtherwise, you may have to edit the makefile to reflect your site's
  492. Xconfiguration.  You may notice that the makefile and the Imakefile
  493. Xare very similar, and the same types of edits will probably need to
  494. Xbe made to both.
  495. X
  496. XThe easiest thing to do is simply this:
  497. X
  498. X    % make
  499. X
  500. Xwhich causes all the libraries and executables to be built.
  501. X
  502. XTesting The Distribution
  503. X------------------------
  504. X
  505. XI have included a simple test csh script which executes all of the
  506. Xexample programs.  After you build, the test program will execute
  507. Xwhich ever or the executable targets it finds.  Just do the following:
  508. X
  509. X    % test
  510. X
  511. XWidget Creation Library
  512. X-----------------------
  513. X
  514. XThe makefiles build two versions of the library: one which works
  515. Xwith the Athena widgets, and one which works with the Motif widgets.
  516. XThere really should be no difference between the two libraries,
  517. Xespecially after Motif 1.1 is widely used.  
  518. X
  519. XMri and Ari Widget Resource Interpreters
  520. X----------------------------------------
  521. X
  522. XThere are also two "interpreters" which allow widget based user
  523. Xinterfaces to be developed and to have a few useful behaviors.  These
  524. Xinterpreters are intended to be useful for prototyping.  
  525. X
  526. XAri is the Athena Resource Interpreter, and it knows about all the
  527. XAthena widgets.  Mri is the Motif Resource Interpreter, and is knows
  528. Xabout all the Motif widgets.  Both interpreters also know about the
  529. Xvery useful Table widget, which is described in the files Table*.
  530. X
  531. XEach interpreter consists of a main() procedure, and a function which
  532. Xregisters all the known widget types.  Mri consists of Mri.c and
  533. XMriRegAll.c while Ari consists of Ari.c and AriRegAll.c.  The
  534. Xregistration files are intended to be independent.
  535. X
  536. XIt should be a simple task to build a single interpreter which knows
  537. Xabout every widget on earth, but if you don't have shared libs, the
  538. Xresulting executable is HUGE.
  539. X
  540. XSeveral resource files are provided for each of the interpreters.  They
  541. Xare named A<nn>.<description> and M<nn>.<description>.  To try 
  542. Xout the interpreters (after you build them), do the following:
  543. X
  544. X    % alias se setenv XENVIRONMENT
  545. X    % se A08.ClkLogo
  546. X    % Ari
  547. X    % se M7.Periodic
  548. X    % Mri
  549. X
  550. XThe resource files are intended to be tutorials, so they are heavily
  551. Xcommented and they explore various topics you may find interesting.
  552. X
  553. XOnce an interface is prototyped using Mri or Ari, one can take the
  554. XMri or Ari source files and makefiles and evolve them into applications.
  555. X
  556. XSample Applications
  557. X-------------------
  558. X
  559. XThe program App is exactly one such example application.  The 
  560. Xfiles Ari.c and mk_Ari were gradually modified as additional
  561. Xbehaviors were defined, registered with the Wc library, and bound
  562. Xto the appropriate widgets within the App01.All resource file.
  563. X
  564. XIf you look at App.c, you will notice that main() is very minimal.
  565. XThe application is really defined by its resource file (the look
  566. Xand feel) and the callbacks (the behavior).  Notice that the
  567. Xcallbacks use several routines provided by the Wc library.  They
  568. Xwill be introduced in another README file.
  569. X
  570. XAfter you build App, you can try it out as follows:
  571. X
  572. X    % se App01.All
  573. X    % App
  574. X
  575. XAnother sample application included with the distribution is MD, which
  576. Xis built as two versions: MDathena and MDmotif.  The Motif version
  577. Xcurrently does not work very well due buggy interactions between Motif
  578. Xand the Intrinsics.  This application demonstrates how a single
  579. Xapplication can support multiple display connections with multiple
  580. Xwidget heirarchies.  These may be executed like this:
  581. X
  582. X    % se MD
  583. X    % MDathena
  584. X    % MDmotif
  585. X
  586. +FUNKY+STUFF+
  587. echo '-rw-r--r--  1 david       11948 Oct 18 17:25 1stREADME    (as sent)'
  588. chmod u=rw,g=r,o=r 1stREADME
  589. ls -l 1stREADME
  590. echo x - 2ndREADME
  591. sed 's/^X//' > 2ndREADME <<'+FUNKY+STUFF+'
  592. XWhat Every Application Needs
  593. X----------------------------
  594. X
  595. XAll applications should include the public header file, should
  596. Xcreate the application shell, and should call WcCreateWidgets().
  597. XThey should also include an external decl for either MriRegisterMotif
  598. Xor AriRegisterAthena(), depending on the widget set desired.
  599. X
  600. XHere is an absolute minimal Motif based application:
  601. X
  602. X/*************************** Cut Here ***************************/
  603. X#include <Xm/Xm.h>
  604. X#include <WcCreate.h>
  605. X
  606. Xextern void MriRegisterMotif();
  607. X
  608. Xmain( argc, argv )
  609. X    int   argc;
  610. X    char* argv[];
  611. X{
  612. X    XtAppContext app;
  613. X    Widget appShell;
  614. X
  615. X    appShell = XtInitialize( "app", "App", NULL, 0, &argc, argv);
  616. X
  617. X    app = XtWidgetToApplicationContext(appShell);
  618. X
  619. X    MriRegisterMotif ( app );
  620. X
  621. X    WcWidgetCreation ( appShell );
  622. X
  623. X    XtRealizeWidget ( appShell );
  624. X    XtMainLoop ( );
  625. X}
  626. X
  627. X/********************** That's all, folks! **********************/
  628. X
  629. XA minimal Athena application differs slightly due to the different
  630. Xinclude files and the different widget registration routine:
  631. X
  632. X/*************************** Cut Here ***************************/
  633. X#include <X11/Intrinsic.h>
  634. X#include <WcCreate.h>
  635. X
  636. Xextern void AriRegisterAthena();
  637. X
  638. Xmain( argc, argv )
  639. X    int   argc;
  640. X    char* argv[];
  641. X{
  642. X    XtAppContext app;
  643. X    Widget appShell;
  644. X
  645. X    appShell = XtInitialize( "app", "App", NULL, 0, &argc, argv);
  646. X
  647. X    app = XtWidgetToApplicationContext(appShell);
  648. X
  649. X    AriRegisterAthena ( app );
  650. X
  651. X    WcWidgetCreation ( appShell );
  652. X
  653. X    XtRealizeWidget ( appShell );
  654. X    XtMainLoop ( );
  655. X}
  656. X/********************** That's all, folks! **********************/
  657. X
  658. X
  659. XAs you can see, every application needs as a minimum to invoke either
  660. XMriRegisterMotif() or AriRegisterAthena(), and WcWidgetCreation().
  661. +FUNKY+STUFF+
  662. echo '-rw-r--r--  1 david        1751 Aug  6 09:36 2ndREADME    (as sent)'
  663. chmod u=rw,g=r,o=r 2ndREADME
  664. ls -l 2ndREADME
  665. echo x - 3rdREADME
  666. sed 's/^X//' > 3rdREADME <<'+FUNKY+STUFF+'
  667. XWidget Creation Resources
  668. X-------------------------
  669. X
  670. XThe Widget Creation Library allows user interfaces to be completely
  671. Xdefined within a resource file: the widget heirarchy, widget types, and
  672. Xbindings of widget callback lists and translations to application
  673. Xfunctions are specified in the resource file using Wc* resources.
  674. X
  675. XThe following is the complete set of resources which are
  676. Xinterpreted by the Widget Creation Library:
  677. X
  678. X     ...widget.wcResFile:      resourceFileName
  679. X     ...widget.wcClass:        classPointerName
  680. X     ...widget.wcClassName:    className
  681. X     ...widget.wcConstructor:  constructorFunctionName
  682. X     ...widget.wcTrace:        true/false (default = false)
  683. X     ...widget.wcCallback:     callback1(args), callback2(args), ...
  684. X     ...widget.wcChildren:     childName1, childName2, ...
  685. X     ...widget.wcManaged:      true/false (default = true)
  686. X     ...widget.wcDeferred:     true/false (default = false)
  687. X
  688. XIn all cases, the Widget Creation resource names can be specified as
  689. XWc<name> or wc<name>, with the capitalized form having looser binding
  690. X(representing the resource class).
  691. X
  692. XWcResFile Resource
  693. X------------------
  694. X
  695. XThis resource allows you to put additional resource specifications
  696. Xrelated to a widget or its children in a separate file.  Like all
  697. Xwidget creation resources, the WcResFile resource value is retrieved
  698. Xfrom the Xrm database at widget creation time.
  699. X
  700. XBefore the widget is created, the specified resource file is loaded
  701. Xinto the Xrm database, and then another query of the Xrm database is
  702. Xmade to obtain the other Wc resources.  Therefore, all wc resources
  703. X(except of course the WcResFile resource) and other widget resources
  704. Xmay be specified in the new resource file.  
  705. X
  706. XNOTE:
  707. XThe file search list rule used by WcResFile is a gross simplification
  708. Xof the R3 resource file search mechanism, without the $LANG provision.
  709. XSoon the R4 search algorithm will be used.  The current version only
  710. Xlooks into two directories, which may be defined as environmental
  711. Xvariables:
  712. X
  713. X         XAPPLRESDIR  - defaults to "/usr/lib/X11/app-defaults/"
  714. X         XUSERRESDIR  - defaults to HOME directory
  715. X
  716. XWcClass, WcClassName, and WcConstructor Resources
  717. X-------------------------------------------------
  718. X
  719. XThese resources allow you to specify the type of the widget.  Only one
  720. Xof these resources should be specified for each widget.  If multiple
  721. Xspecifications are made, a warning will be given via XtWarning (the
  722. Xmessage prints on stderr).  A WcClass specification overrides a
  723. XWcClassName specification which overrides a WcConstructor
  724. Xspecification.
  725. X
  726. XWcTrace Resource
  727. X----------------
  728. X
  729. XThis resource is useful for debugging your user interface.  When `True'
  730. Xthe full name and class name of the widget is printed to stderr right
  731. Xafter the widget is created.
  732. X
  733. XWcCallback Resource
  734. X-------------------
  735. X
  736. XThis resource allows you to specify a list of callback functions
  737. Xwhich are invoked after the widget is created, and before it is
  738. Xmanaged.  The callback functions receive the newly created widget as
  739. Xtheir widget argument, and whatever is within the parenthesis following
  740. Xthe callback function name as a string argument as client data.  For
  741. Xexample:
  742. X
  743. X    *foo.wcCallback:    FooSpecialCB( Hi there )
  744. X
  745. XThis specification will cause the function `FooSpecialCB' to be
  746. Xcalled.  The widget argument will be the newly created widget foo, and
  747. Xthe client_data argument will be the null terminated character array "
  748. XHi there ".  The call_data is whatever was specified when the
  749. XFooSpecialCB callback function was registered with
  750. XWcRegisterCallback().
  751. X
  752. XThis is generally how the interface can create related objects within
  753. Xthe application.  For example, if your application has a storage
  754. Xobject, each widget which provides storage related behaviors or
  755. Xattribute displays might register themselves with your application's
  756. Xstorage object.
  757. X
  758. XWcChildren Resource
  759. X-------------------
  760. X
  761. XAfter a widget is created, but before it is managed, all of its
  762. Xchildren are created (and by default, managed).  The names of children
  763. Xwidgets are specified by the WcChildren resource.  The order of the
  764. Xnames in the resource value indicate the left-to-right order of
  765. Xwidget creation.  The names of the widgets in the example below
  766. Ximply the order of creation:
  767. X
  768. X    *foo.wcChildren:    ONE, TWO, THREE
  769. X
  770. XSince each widget creation is recursive, the widgets are created depth
  771. Xfirst.  I.e., the widget `ONE' and all of ONE's children will be
  772. Xcreated before widget `TWO' will be created.
  773. X
  774. XWcManaged Resource
  775. X------------------
  776. X
  777. XThis resource allows you to specify that a widget should not be managed
  778. Xfollowing its creation.  By default, widgets are managed together with
  779. Xtheir siblings after all siblings are created.  Wc uses a single call
  780. Xto XtManageChildren when possible.
  781. X
  782. XObsolete Widget Creation Resources
  783. X----------------------------------
  784. X
  785. XThe wcDeferred resource is maintained only for compatibility.  It
  786. Xis never needed, and can simply be deleted from your existing resource
  787. Xfiles, along with the appearance of the widget's name from any
  788. XwcChildren list.  I.e., if you have the following:
  789. X
  790. X    *foobar.wcChildren: one, two, three, four
  791. X        ...
  792. X    *two.wcDeferred:    true
  793. X
  794. XSimply drop `two' from the list of children of `foobar' and remove
  795. Xthe `*two.wcDeferred: true' line from your resource file.  Widgets
  796. Xwhich are created dynamically have their parentage specified at
  797. Xcreation time, generally via WcCreateCB as follows:
  798. X
  799. X    WcCreateChildrenCB( foobar, two )
  800. X
  801. XSupport for wcDeferred resources will be removed in the near future,
  802. Xso try to purge their use.
  803. X
  804. X
  805. XHow the Application Interacts with the Widget Creation Library 
  806. X--------------------------------------------------------------
  807. X
  808. XThe typical Wc client application (including Ari and Mri) will create
  809. Xan application shell and load the Xrm database by calling
  810. XXtInitialize().  It will then register widgets, callbacks, and actions
  811. Xwith the Wc library, and then pass the application shell to the
  812. XWcWidgetCreation() function.  This function returns when the entire
  813. Xconnected widget heirarchy specified in the Xrm database is created.
  814. XThe widget tree is realized, and then the XtMainLoop is entered.
  815. XBriefly:
  816. X
  817. X    appShell = XtInitialize( ... );
  818. X
  819. X    /* Register widgets, callbacks, and actions */
  820. X
  821. X    WcWidgetCreation( appShell );
  822. X    XtRealizeWidget( appShell );
  823. X    XtMainLoop();
  824. X
  825. XWhen Resources are Loaded Into the Xrm Database
  826. X-----------------------------------------------
  827. X
  828. XXtInitialize loads an initial set of resource files into the resource
  829. Xdatabase before any widgets are created.  This initial database may
  830. Xcontain references to other resource files by way of WcResFile resource
  831. Xspecifications.  If a widget `Foo' has a resource specification like
  832. Xthis:
  833. X
  834. X    *Foo.wcResFile:    FooResources
  835. X
  836. Xthen the resource file named FooResources will be merged into the
  837. Xresource database before the widget Foo is created.  In fact, several
  838. Xfiles named FooResources may be loaded, as the standard Xt resource
  839. Xfile search and load is performed.  See section 2.2 and 11.11 of the
  840. XX11R4 Xt Intrinsics - C Language Interface manual for more
  841. Xinformation.
  842. X
  843. XNOTE:
  844. XThe file search list rule used by this version of Wc is a gross
  845. Xsimplification of the R3 resource file search mechanism, without the
  846. X$LANG provision.  Soon the R4 search algorithm will be used.  The
  847. Xcurrent version only looks into two directories, which may be defined
  848. Xas environmental variables:
  849. X
  850. X         XAPPLRESDIR  - defaults to "/usr/lib/X11/app-defaults/"
  851. X         XUSERRESDIR  - defaults to HOME directory
  852. X
  853. X
  854. XWhen Resources are Retrieved from the Xrm Database
  855. X--------------------------------------------------
  856. X
  857. XResources are retrieved from the Xrm resource database when widgets are
  858. Xcreated.  If the resource database changes after widget `Foo' is
  859. Xcreated, subsequent changes to the database will have absolutely no
  860. Xeffect upon widget `Foo.'
  861. X
  862. XHow Widgets Are Created from the Xrm Database
  863. X---------------------------------------------
  864. X
  865. XThe Widget Creation Library starts creating widgets when the
  866. XWcWidgetCreation() function is called.  Here is the recursive
  867. Xscenario.  The initial widget is usually the application shell:
  868. X
  869. X    1.    Fetch the wcChildren resource from Xrm database for the
  870. X    initial widget.  This will be a list of widget names.
  871. X
  872. X    2.    For each child: 
  873. X
  874. X    3.    Fetch the set of Wc resources.  
  875. X
  876. X    3a.    If wcResFile is specified, load that resource file and 
  877. X    fetch the Wc resources again.
  878. X
  879. X    3b.    Using the wcClass, wcClassName, or wcConstructor resource, 
  880. X    create the new child widget.  Widget creation uses other 
  881. X    resources defined in the Xrm database specific to the type 
  882. X    of the widget, such as labelString for XmLabels.
  883. X
  884. X    3c.    If wcCallback resource is defined (specifying a list of
  885. X    callback functions), invoke each callback in order.  
  886. X
  887. X    3d. If wcTrace is True, then dump the name of the just created
  888. X    widget to stdout.
  889. X
  890. X    3e.    If wcManaged is True (the default), then this widget will be
  891. X    managed along with all of its siblings, after they are all
  892. X    created (a single call to XtManageChildren is invoked by Wc).
  893. X
  894. X    3f. If the newly created widget has wcChildren specified, then
  895. X    recursively invoke step (2.) above.  Note that this
  896. X    implements a depth first creation policy, which is generally
  897. X    optimal for widget trees with manager widget nodes.
  898. X
  899. X
  900. XThe resource files themselves have no explicit flow of control
  901. Xmechanisms.  However, the order of events during widget creation causes
  902. Xthe resources to be evaluated in a deterministic and sometimes
  903. Xrepetitive pattern.
  904. X
  905. XThe most significant control over resource evaluation is the order that
  906. Xwidgets are created.  Widget creation is ordered by the order of widget
  907. Xnames in wcChildren resource lists.  The names of widgets in the
  908. Xexample below reflects the order these widgets will be created.  The
  909. Xorder of the resource specifications themselves are irrelevent to the
  910. Xorder of creation:
  911. X
  912. X    Mri.wcChildren:            one, four
  913. X    Mri.one.wcClassName:        XmRowColumn
  914. X    Mri.one.wcChildren:        two, three
  915. X    Mri.one.two.wcClassName:    XmLabel
  916. X    Mri.one.three.wcClassName:    XmPushButton
  917. X    Mri.four.wcConstructor:        XmCreateWorkingDialog
  918. X
  919. XWidgets can also be created after the initial widget tree.  For example,
  920. Xhelp dialogs may be dynamically created only when necessary, so an
  921. Xexperienced user does not need to suffer the additional start-up time
  922. Xof creating a large number of widgets which are not needed, nor is
  923. Xmemory or swap space consumed by the unnecessary widgets.
  924. X
  925. XHere are resources which demonstrate how a help dialog could be created
  926. Xdue to a button press.  In this case, the newly created widget will
  927. Xbecome a child of the application shell (Mri if the resource file is
  928. Xbeing interpreted by Mri).  The resources for the help dialog are
  929. Xsegregated into another set of resource files which are named
  930. X`HelpDialogResources.'  The standard Xt resource file search path is
  931. Xused, so /usr/lib/X11/app-defaults/HelpDialogResources, ...,
  932. X~/apps-defaults/HelpDialogResources, may be loaded into the Xrm
  933. Xdatabase due to this one WcResFile specification:
  934. X
  935. X    /* in initial resource file: */
  936. X    *helpButton.activateCallback:    WcCreateChildrenCB( Mri, helpDialog )
  937. X    *helpDialog.wcResFile:        HelpDialogResources
  938. X
  939. X    /* in HelpDialogResources: */
  940. X    *helpDialog.wcConstructor:    XmCreateMessageDialog
  941. X    *helpDialog.messageLabel:    Some help message...
  942. X    *helpDialog.okCallback:        WcDestroyCB( this )
  943. X
  944. XFrequently, you probably want such dialogs to remain once they are
  945. Xcreated.  See the M5.Dialogs resource file for one way to do this.
  946. X
  947. XIn the above example, notice that the resources specified in the
  948. XHelpDialogResources file are unknown to the Xrm database until an
  949. Xattempt is made to create the helpDialog widget.
  950. +FUNKY+STUFF+
  951. echo '-rw-r--r--  1 david       11630 Aug 17 16:09 3rdREADME    (as sent)'
  952. chmod u=rw,g=r,o=r 3rdREADME
  953. ls -l 3rdREADME
  954. echo x - 4thREADME
  955. sed 's/^X//' > 4thREADME <<'+FUNKY+STUFF+'
  956. XWidget Creation Library Standard Callbacks
  957. X------------------------------------------
  958. X
  959. XThe standard Wc callbacks are intended to map closely to existing Xt
  960. Xfunctions.  They simply provide XtCallbackProc wrappers to many
  961. Xcommonly used Xt functions.  These wrapper procs perform argument
  962. Xparsing: e.g., converting strings to widgets using WcFullNameToWidget.
  963. X
  964. XBelow is a complete list of callbacks which are registered by Wc
  965. Xwhenever you call WcWidgetCreation.  The "arguments" below are
  966. Xprototypes of what one puts in a resouce file.  The terms mean:
  967. X
  968. X   parent       name of widget, full path or wildcarded.
  969. X   child        name of child starting from the parent widget.
  970. X   widget       see parent
  971. X   resLHS       <widget path name>
  972. X   resRHS       <any legal resource value>
  973. X
  974. X    WcCreateChildrenCB   ( parent, child [, child] ... )
  975. X    WcManageChildrenCB   ( parent, child [, child] ... )
  976. X    WcUnmanageChildrenCB ( parent, child [, child] ... )
  977. X
  978. X    WcManageCB         ( widget [, widget] ... )
  979. X    WcUnmanageCB       ( widget [, widget] ... )
  980. X    WcDestroyCB        ( widget [, widget] ... )
  981. X    WcSetSensitiveCB   ( widget [, widget] ... )
  982. X    WcSetInsensitiveCB ( widget [, widget] ... )
  983. X
  984. X    WcPopupCB     ( widget )
  985. X    WcPopupGrabCB ( widget )
  986. X    WcPopdownCB   ( widget )
  987. X    WcMapCB       ( widget )
  988. X    WcUnmapCB     ( widget )
  989. X
  990. X    WcSetValueCB ( resLHS: resRHS )
  991. X    
  992. X    WcLoadResourceFileCB ( filename )
  993. X    
  994. X    WcSystemCB ( shell command line )
  995. X    WcTraceCB  ( annotation )
  996. X
  997. X    WcExitCB ( exitValue )
  998. X
  999. XSee the file WcCallb.c for the implementations of all of these standard
  1000. Xcallbacks.  These callbacks are registered together in the function
  1001. XWcRegisterWcCallbacks() which is at the bottom of the same source
  1002. Xfile.  Clients of Wc do not have to invoke WcRegisterWcCallbacks()
  1003. Xdirectly, as it is called from WcWidgetCreation() in the WcCreate.c
  1004. Xsource file.
  1005. X
  1006. X
  1007. XWidget Naming in Callback Arguments
  1008. X-----------------------------------
  1009. X
  1010. XIn all of these callbacks, the function WcFullNameToWidget is invoked
  1011. Xto convert a string to a widget.  WcFullNameToWidget allows relative
  1012. Xwidget naming, relative to the widget which invoked the callback.  The
  1013. Xspecial characters are presented in examples below:
  1014. X
  1015. X    this    means: `the widget which invoked this callback'
  1016. X    ^foobar    means: `a sibling widget named foobar'
  1017. X    ~foobar    means: `a child of the shell ancestor named foobar'
  1018. X    ~^foobar    means: `a sibling of the shell ancestor named foobar'
  1019. X
  1020. XThe relative naming characters `^' and `~' are parsed left to right.
  1021. X
  1022. XIn addition, normal wildcarding works as expected - as long as the
  1023. Xfinal name component is a widget instance, and not a widget class
  1024. Xname.  For example:
  1025. X
  1026. X    *foobar
  1027. X    *Table*XmRowColumn*foobar
  1028. X
  1029. X
  1030. XWcCreateChildrenCB( parent, child [, child] ... )
  1031. X-------------------------------------------------
  1032. X
  1033. XThis callback causes new widgets to be created.  The name of the parent
  1034. Xcan include wildcards, or can be a relative pathname from the widget
  1035. Xinvoking the callback.  The names of the children widgets must be
  1036. Xsingle widget names, not pathnames.  For example:
  1037. X
  1038. X    *danger.callback:  WcCreateChildrenCB( *Panel, EmergencyControls)
  1039. X
  1040. XIn this case, pressing a danger button creates a new tree of widgets
  1041. Xproviding emergency controls.  The new tree is rooted at the existing
  1042. XPanel widget.
  1043. X
  1044. X
  1045. XWcManageChildrenCB( parent, child [, child] ... )
  1046. X-------------------------------------------------
  1047. X
  1048. XThis callback manages multiple children of a single parent.  It is a
  1049. Xwrapper around XtManageChildren.  As with WcCreateChildrenCB, the
  1050. Xparent name can include wildcards, or can be a relative pathname from
  1051. Xthe widget invoking the callback.  The names of the children widgets
  1052. Xmust be single widget names, not pathnames.  For example:
  1053. X
  1054. X    *new.activateCallback:  WcManageChildrenCB( *foo, one, two, three )
  1055. X
  1056. X
  1057. XWcUnmanageChildrenCB( parent, child [, child] ... )
  1058. X---------------------------------------------------
  1059. X
  1060. XIdentical to WcManageChildrenCB, except that the child widgets are 
  1061. Xunmanaged rather than managed via a call to XtUnmanageChildren.
  1062. X
  1063. X
  1064. XWcManageCB( widget [, widget] ... )
  1065. X-----------------------------------
  1066. X
  1067. XThis callback takes a list of widget names, each of which
  1068. Xcan be wildcarded and/or relative widget pathname.  After
  1069. Xthe widget ID is resolved via the WcFullNameToWidget function,
  1070. Xthe widgets are managed using XtManageChild().
  1071. X
  1072. X
  1073. XWcUnmanageCB( widget [, widget] ... )
  1074. X-------------------------------------
  1075. X
  1076. XThis callback is identical to WcManageCB, except that the
  1077. Xwidgets are unmanaged using XtUnmanageChild().
  1078. X
  1079. X
  1080. XWcDestroyCB( widget [, widget] ... )
  1081. X------------------------------------
  1082. X
  1083. XThis callback allows widgets to be destroyed using XtDestroyWidget().
  1084. X
  1085. X
  1086. XWcSetSensitiveCB( widget [, widget] ... )
  1087. X-----------------------------------------
  1088. X
  1089. XThis callback invokes XtSetSensitive( TRUE ) on each of the
  1090. Xwidgets named by the argument.
  1091. X
  1092. X
  1093. XWcSetInsensitiveCB( widget [, widget] ... )
  1094. X-------------------------------------------
  1095. X
  1096. XThis callback is identical to WcSetSensitiveCB, but the widgets
  1097. Xare made insensitive.
  1098. X
  1099. X
  1100. XWcPopupCB( widget )
  1101. X-------------------
  1102. X
  1103. XThis callback invokes XtPopup() with the XtGrabKind set to
  1104. XXtGrabNonexclusive.  The widget must be a pop-up shell widget.
  1105. X
  1106. X
  1107. XWcPopupGrabCB( widget )
  1108. X-----------------------
  1109. X
  1110. XThis callback invokes XtPopup() with the XtGrabKind set to
  1111. XXtGrabExclusive.  The widget must be a pop-up shell widget.
  1112. X
  1113. X
  1114. XWcPopdownCB( widget )
  1115. X---------------------
  1116. X
  1117. XThis callback invokes XtPopdown().  The widget must be a pop-up shell
  1118. Xwidget.
  1119. X
  1120. XWcMapCB( widget )
  1121. X---------------------
  1122. X
  1123. XThis callback invokes XtMapWidget().  The widget must be a shell
  1124. Xwidget.
  1125. X
  1126. XWcUnmapCB( widget )
  1127. X---------------------
  1128. X
  1129. XThis callback invokes XtUnmapWidget().  The widget must be a shell
  1130. Xwidget.
  1131. X
  1132. X
  1133. XWcSetValueCB( resLHS: resRHS )
  1134. X------------------------------
  1135. X
  1136. XWcSetValueCB maps very closely to XtSetValues().  An augmented resource
  1137. Xfile syntax is accepted so you can cut and paste the arguments and
  1138. Xnames.  The widget path name can include wildcards, and it can also be
  1139. Xa relative path from the invoking widget.  Real examples:
  1140. X
  1141. X  *push.activateCallback: WcSetValueCB( *push.activateCallback: WcExitCB(1) ), \
  1142. X                          WcSetValueCB( *push.labelString:      Goodbye! )
  1143. X
  1144. X  *fileMenu.wcCallback:   WcSetValueCB(*file.subMenuId: this)
  1145. X
  1146. X  *Pink.armCallback:      WcSetValueCB( ^^drawing.background: Pink )
  1147. X
  1148. X
  1149. XWcLoadResourceFileCB( filename )
  1150. X--------------------------------
  1151. X
  1152. XThis callback loads specified resource file into application resource
  1153. Xdatabase. It allows to load resources on as-needed basis, reducing the
  1154. Xintitial resource file load overhead.  The file to load is specified as
  1155. Xclient data. The directory search for the file (should be) the same as
  1156. Xfor application class resource file.
  1157. X
  1158. XTo prevent repeated loads of the same file, the callback keeps track of
  1159. Xeach filename.  Note that I do not allow a file to be re-loaded even if
  1160. Xit is changed, or if a new file of the same name appears on the search
  1161. Xpath.  This was done for two reasons:  first, it makes the code more
  1162. Xportable, as I don't have to depend upon various system calls.  Second,
  1163. Xresources can't be un-written, so a user might get the wrong impression
  1164. Xthat a resource specification can be deleted, and the resource file
  1165. Xre-loaded, and something will happen.  It just isn't so.
  1166. X
  1167. XNOTE:
  1168. XThe file search list rule used by WcLoadResourceFileCB is a gross
  1169. Xsimplification of the R3 resource file search mechanism, without the
  1170. X$LANG provision.  Soon the R4 search algorithm will be used.  The
  1171. Xcurrent version only looks into two directories, which may be defined
  1172. Xas environmental variables:
  1173. X
  1174. X         XAPPLRESDIR  - defaults to "/usr/lib/X11/app-defaults/"
  1175. X         XUSERRESDIR  - defaults to HOME directory
  1176. X
  1177. X
  1178. XWcSystemCB( shell command line )
  1179. X--------------------------------
  1180. X
  1181. XThis callback passes the entire string argument to you standard shell
  1182. Xusing the system() C library function.
  1183. X
  1184. X
  1185. XWcTraceCB( annotation )
  1186. X-----------------------
  1187. X
  1188. XThis callback can be used to assist in interface debugging. The
  1189. Xcallback prints the invoking wiget pathname and a specified message on
  1190. Xstdout.
  1191. X
  1192. X
  1193. XWcExitCB( exitValue )
  1194. X---------------------
  1195. X
  1196. XThis callback converts the argument string into a base 10 integer, and
  1197. Xpasses the result to exit(), which of course terminates the
  1198. Xapplication.
  1199. +FUNKY+STUFF+
  1200. echo '-rw-rw-r--  1 david        8283 Oct 16 14:41 4thREADME    (as sent)'
  1201. chmod u=rw,g=rw,o=r 4thREADME
  1202. ls -l 4thREADME
  1203. echo x - 5thREADME
  1204. sed 's/^X//' > 5thREADME <<'+FUNKY+STUFF+'
  1205. XWidget Creation Library Standard Action Routines
  1206. X------------------------------------------------
  1207. X
  1208. XAll of the standard callback functions have action routine
  1209. Xcounterparts.  Actions can be invoked via the translation manager,
  1210. Xwhich provides a powerful and flexible mechanism for invoking functions
  1211. Xfrom the user interface.
  1212. X
  1213. XBelow is the complete list of standard action routines, and their
  1214. Xmapping to the standard Wc callback routines.  See the section
  1215. Xon `Widget Creation Library Standard Callbacks' for details on
  1216. Xthe behaviors of the appropriate functions.
  1217. X
  1218. X    WcCreateChildrenACT        WcCreateChildrenCB
  1219. X    WcManageACT            WcManageCB
  1220. X    WcUnmanageACT        WcUnmanageCB
  1221. X    WcManageChildrenACT        WcManageChildrenCB
  1222. X    WcUnmanageChildrenACT    WcUnmanageChildrenCB
  1223. X    WcDestroyACT        WcDestroyCB
  1224. X    WcSetValueACT        WcSetValueCB
  1225. X    WcSetSensitiveACT        WcSetSensitiveCB
  1226. X    WcSetInsensitiveACT        WcSetInsensitiveCB
  1227. X    WcLoadResourceFileACT    WcLoadResourceFileCB
  1228. X    WcTraceACT            WcTraceCB
  1229. X    WcPopupACT            WcPopupCB
  1230. X    WcPopupGrabACT        WcPopupGrabCB
  1231. X    WcPopdownACT        WcPopdownCB
  1232. X    WcMapACT            WcMapCB
  1233. X    WcUnmapACT            WcUnamapCB
  1234. X    WcSystemACT            WcSystemCB
  1235. X    WcExitACT            WcExitCB
  1236. X
  1237. XAll the standard action routines are registered with the translation
  1238. Xmanager by the WcRegisterWcActions function.  This function is called
  1239. Xfrom WcWidgetCreation(), so applications usually never need to call
  1240. XWcRegisterWcActions.
  1241. X
  1242. XThe file WcActions.c contains the implementations of all the action
  1243. Xroutines along with the function WcRegisterWcActions.  If your
  1244. Xapplication wants to register mode actions, you should either use
  1245. XWcRegisterAction(), or better yet, copy WcRegisterWcActions and modify
  1246. Xto register your applications functions.  Register your action
  1247. Xfunctions before calling WcWidgetCreation.
  1248. +FUNKY+STUFF+
  1249. echo '-rw-rw-r--  1 david        1776 Oct 16 14:42 5thREADME    (as sent)'
  1250. chmod u=rw,g=rw,o=r 5thREADME
  1251. ls -l 5thREADME
  1252. echo x - 6thREADME
  1253. sed 's/^X//' > 6thREADME <<'+FUNKY+STUFF+'
  1254. XWidget Creation Functions
  1255. X-------------------------
  1256. X
  1257. XThe widget creation Library provides several types of functions
  1258. Xwhich are called by client applictions:
  1259. X
  1260. X    1.    Registration Functions
  1261. X    2.    Creation Functions
  1262. X    3.    Callback Argument Parsing Utilities
  1263. X
  1264. XTwo include files are provided which declare the functions and
  1265. Xsupporting data types used by the Widget Creation Library.  Many
  1266. Xapplications should only need to include WcCreate.h which
  1267. Xcontains what can be considered "public" function declarations.
  1268. X
  1269. XIf you are writing additional resource converters, or sophisticated
  1270. Xcallbacks, you will probably want to include WcCreateP.h which contains
  1271. Xwhat can be considered "private" function declarations as well as
  1272. Xtypedefs for several datatypes used by the Widget Creation Library.
  1273. X
  1274. XWidget Set Registration Functions
  1275. X---------------------------------
  1276. X
  1277. XTwo non-library functions are also provided in separate files:
  1278. X
  1279. XMriRegAll.c contains the single function MriRegisterMotif().  This
  1280. Xfunction lets the Wc library know about all the Motif widget class
  1281. Xnames (like XmPushButtonGadget), class pointers (like
  1282. XxmPushButtonGadgetClass), and convenience constructors (like
  1283. XXmCreatePushButtonGadget).
  1284. X
  1285. XAriRegAll.c contains the single function AriRegisterAthena().  This
  1286. Xfunction lets the Wc library know about all the Athena widget class
  1287. Xnamed (like Command), and class pointers (like commandWidgetClass).
  1288. X
  1289. XWcWidgetCreation() - see WcCreate.c
  1290. X------------------
  1291. X
  1292. XThis function takes a Widget as its only argument.  A widget tree
  1293. Xrooted at the widget is created from the Xrm database.  This widget
  1294. Xis called the root widget in this discussion, but it can really be any
  1295. Xwidget.
  1296. X
  1297. XThe Xrm database is usually loaded as a matter of course by calling
  1298. XXtInitialize().  It is possible to load the resource database directly,
  1299. Xusing XrmGetFileDatabase() and XrmMergeDatabases().  See the function
  1300. XWcLoadResourceFileCB in the file WcCallb.c for an example.
  1301. X
  1302. XThe algorithm used by WcWidgetCreation is recursive, as follows:
  1303. X
  1304. X    1.  Fetch the wcChildren resource from Xrm database for the
  1305. X        initial widget.  This will be a list of widget names.
  1306. X
  1307. X    2.  For each child:
  1308. X
  1309. X    3.  Fetch the set of Wc resources.
  1310. X
  1311. X    3a. If wcResFile is specified, load that resource file and
  1312. X        fetch the Wc resources again.
  1313. X
  1314. X    3b. Using the wcClass, wcClassName, or wcConstructor resource,
  1315. X        create the new child widget.  Widget creation uses other
  1316. X        resources defined in the Xrm database specific to the type
  1317. X        of the widget, such as labelString for XmLabels.
  1318. X
  1319. X    3c. If wcCallback resource is defined (specifying a list of
  1320. X        callback functions), invoke each callback in order.
  1321. X
  1322. X    3d. If wcTrace is True, then dump the name of the just created
  1323. X        widget to stdout.
  1324. X
  1325. X    3e. If wcManaged is True (the default), then this widget will be
  1326. X        managed along with all of its siblings, after they are all
  1327. X        created (a single call to XtManageChildren is invoked by Wc).
  1328. X
  1329. X    3f. If the newly created widget has wcChildren specified, then
  1330. X        recursively invoke step (2.) above.  Note that this
  1331. X        implements a depth first creation policy, which is generally
  1332. X        optimal for widget trees with manager widget nodes.
  1333. X
  1334. XNote that WcWidgetCreation() does a depth first creation, and that
  1335. Xthe order of creation is controlled by the order of the names in the
  1336. XwcChildren resource.
  1337. X
  1338. XEarlier versions of Wc required bizarre contortions when using
  1339. Xconstructors in order to avoid toolkit warnings such as:
  1340. X
  1341. X    Xt Warning: not all widgets have same parent in XtManageChildren()
  1342. X
  1343. XYou don't need to worry about this anymore - this behavior was
  1344. Xconsidered a `bug' not a `feature' and therefore has been fixed.
  1345. X
  1346. X
  1347. XWcCreateNamedChildren() - see WcCreate.c
  1348. X----------------------
  1349. X
  1350. XThis function creates named children of a reference widget by invoking
  1351. Xthe same algorithm as WcWidgetCreation, except that only the specifically
  1352. Xnamed children are created, rather than all the children.
  1353. X
  1354. XRegistration Functions - see WcReg.c
  1355. X----------------------
  1356. X
  1357. XThe Widget Creation Library converts strings in the database, such as
  1358. X"XmCreateFileSelectionBox", into its needed types, such as constructors,
  1359. Xusing Xt converters.  These converters intrinsicly know nothing: they
  1360. Xmust be told what each string maps into.  The converters learn about
  1361. Xthe appropriate mappings via the registration functions:
  1362. X
  1363. X    WcRegisterCallback()
  1364. X    WcRegisterClassPtr()
  1365. X    WcRegisterClassName()
  1366. X    WcRegisterConstructor()
  1367. X    WcRegisterAction()
  1368. X
  1369. XBy default, these registration routines ignore attempts to re-register
  1370. Xa string-to-whatever mapping.  This is generally useful, in that it
  1371. Xhelps to catch duplicate and therefore unneeded invocations of the
  1372. Xregistration routines.
  1373. X
  1374. XIn some clients, there exists the need to override such registrations.
  1375. XFor example, interface builders built using the Widget Creation Library
  1376. Xand a C interpreter or a dynamic linking environment may allow a given
  1377. Xcallback name to refer to different functions as the application
  1378. Xevolves.  The following functions are provided to support these cases:
  1379. X
  1380. X    WcAllowDuplicateRegistration()
  1381. X    WcAllowDuplicateCallbackReg()
  1382. X    WcAllowDuplicateClassPtrReg()
  1383. X    WcAllowDuplicateClassNameReg()
  1384. X    WcAllowDuplicateConstructorReg()
  1385. X
  1386. XAn interface builder will probably call WcAllowDuplicateRegistration()
  1387. Xbefore any callbacks, classes, et al are registered.  It may also be
  1388. Xappropriate to first register all standard callbacks and widgets, and
  1389. Xthen call WcAllowDuplicateRegistration().
  1390. X
  1391. XWcRegisterCallback() - see WcReg.c
  1392. X--------------------
  1393. X
  1394. XProbably all of your useful applications will require your own
  1395. Xcallbacks.  These callbacks are registered with the Widget Creation
  1396. XLibrary's string-to-callback converter using WcRegisterCallback().
  1397. X
  1398. XIn fact, this function is used by Wc itself to register the standard Wc
  1399. Xsupplied callbacks, such as WcSetValueCB and WcExitCB.  See the
  1400. Xfunction WcRegisterWcCallbacks() at the end of WcCallb.c to see how
  1401. XWc uses this function internally.
  1402. X
  1403. XWcRegisterClassPtr() - see WcReg.c
  1404. X--------------------
  1405. X
  1406. XThis function is used to tell the Widget Creation Library about a
  1407. Xwidget class pointer which can be used within XtCreateWidget().  The
  1408. Xname of the widget class pointer is passed in as a string (for example,
  1409. X"xmPushButtonWidgetClass").  This string value can be provided as the
  1410. XwcClass resource value within a resource file.
  1411. X
  1412. XWcRegisterClassName() - see WcReg.c
  1413. X---------------------
  1414. X
  1415. XThis function is used to tell the Widget Creation Library about a
  1416. Xwidget class name.  The name is mapped to a widget class pointer which
  1417. Xcan be used within XtCreateWidget().  The name of the widget class  is
  1418. Xpassed in as a string (for example, "XmPushButton").  This string value
  1419. Xcan be provided as the wcClassName resource value within a resource
  1420. Xfile.
  1421. X
  1422. XWcRegisterConstructor()  - see WcReg.c
  1423. X-----------------------
  1424. X
  1425. XThis function is used to tell the Widget Creation Library about a
  1426. Xwidget constructor.  The name of the constructor is passed in as a
  1427. Xstring (for example, "XmCreatePushButton").  This string value can be
  1428. Xprovided as the wcConstructor resource value within a resource file.
  1429. X
  1430. XWcRegisterAction()  - see WcReg.c
  1431. X-----------------
  1432. X
  1433. XThis is a simple wrapper around XtAppAddActions().  If you are
  1434. Xregistering many actions, you probably should copy the function
  1435. XWcRegisterWcActions() in WcActions.c and make the obvious
  1436. Xmodifications rather than using this function.  This will help
  1437. Xperformance.
  1438. X
  1439. +FUNKY+STUFF+
  1440. echo '-rw-r--r--  1 david        7462 Aug 18 10:49 6thREADME    (as sent)'
  1441. chmod u=rw,g=r,o=r 6thREADME
  1442. ls -l 6thREADME
  1443. exit 0
  1444.  
  1445. dan
  1446. ----------------------------------------------------
  1447. O'Reilly && Associates   argv@sun.com / argv@ora.com
  1448. Opinions expressed reflect those of the author only.
  1449. --
  1450. dan
  1451. ----------------------------------------------------
  1452. O'Reilly && Associates   argv@sun.com / argv@ora.com
  1453. Opinions expressed reflect those of the author only.
  1454.