home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 August - Disc 2 / chip_20018102_hu.iso / linux / X-4.1.0 / doc / xmu.txt < prev    next >
Text File  |  2001-06-27  |  61KB  |  2,707 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.             Xmu Library
  8.          X Version 11, Release 6.4
  9.  
  10.                ``Don't ask.''
  11.  
  12.  
  13.  
  14. Copyright (C) 1989 X Consortium
  15.  
  16. Permission is hereby granted, free of charge, to any person
  17. obtaining a copy of this software and associated documenta-
  18. tion files (the ``Software''), to deal in the Software with-
  19. out restriction, including without limitation the rights to
  20. use, copy, modify, merge, publish, distribute, sublicense,
  21. and/or sell copies of the Software, and to permit persons to
  22. whom the Software is furnished to do so, subject to the fol-
  23. lowing conditions:
  24.  
  25. The above copyright notice and this permission notice shall
  26. be included in all copies or substantial portions of the
  27. Software.
  28.  
  29. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY
  30. KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  31. WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PUR-
  32. POSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE X CONSOR-
  33. TIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  34. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  35. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
  36. OR OTHER DEALINGS IN THE SOFTWARE.
  37.  
  38. Except as contained in this notice, the name of the X Con-
  39. sortium shall not be used in advertising or otherwise to
  40. promote the sale, use or other dealings in this Software
  41. without prior written authorization from the X Consortium.
  42.  
  43.  
  44.  
  45. X Window System is a trademark of X Consortium, Inc.
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                  -2-
  71.  
  72.  
  73. 1.  Introduction
  74.  
  75. The Xmu Library is a collection of miscellaneous (some might
  76. say random) utility functions that have been useful in
  77. building various applications and widgets.  This library is
  78. required by the Athena Widgets.
  79.  
  80.  
  81. 2.  Atom Functions
  82.  
  83. The use the functions and macros defined in this section,
  84. you should include the header file <X11/Xmu/Atoms.h>.
  85.  
  86.  
  87. XA_ATOM_PAIR(d)
  88. XA_CHARACTER_POSITION(d)
  89. XA_CLASS(d)
  90. XA_CLIENT_WINDOW(d)
  91. XA_CLIPBOARD(d)
  92. XA_COMPOUND_TEXT(d)
  93. XA_DECNET_ADDRESS(d)
  94. XA_DELETE(d)
  95. XA_FILENAME(d)
  96. XA_HOSTNAME(d)
  97. XA_IP_ADDRESS(d)
  98. XA_LENGTH(d)
  99. XA_LIST_LENGTH(d)
  100. XA_NAME(d)
  101. XA_NET_ADDRESS(d)
  102. XA_NULL(d)
  103. XA_OWNER_OS(d)
  104. XA_SPAN(d)
  105. XA_TARGETS(d)
  106. XA_TEXT(d)
  107. XA_TIMESTAMP(d)
  108. XA_USER(d)
  109. XA_UTF8_STRING(d)
  110.  
  111.  
  112. These macros take a display as argument and return an Atom.
  113. The name of the atom is obtained from the macro name by
  114. removing the leading characters ``XA_''.  The Atom value is
  115. cached, such that subsequent requests do not cause another
  116. round-trip to the server.
  117.  
  118.  
  119. AtomPtr XmuMakeAtom(name)
  120.       char* name;
  121.  
  122.  
  123. name      specifies the atom name
  124.  
  125. This function creates and initializes an opaque object, an
  126. AtomPtr, for an Atom with the given name.  XmuInternAtom can
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                  -3-
  137.  
  138.  
  139. be used to cache the Atom value for one or more displays.
  140.  
  141.  
  142. char *XmuNameOfAtom(atom_ptr)
  143.       AtomPtr atom_ptr;
  144.  
  145.  
  146. atom_ptr  specifies the AtomPtr
  147.  
  148. The function returns the name of an AtomPtr.
  149.  
  150.  
  151. Atom XmuInternAtom(d, atom_ptr)
  152.       Display *d;
  153.       AtomPtr atom_ptr;
  154.  
  155.  
  156. d      specifies the connection to the X server
  157.  
  158. atom_ptr  specifies the AtomPtr
  159.  
  160. This function returns the Atom for an AtomPtr.    The Atom is
  161. cached, such that subsequent requests do not cause another
  162. round-trip to the server.
  163.  
  164.  
  165. char *XmuGetAtomName(d, atom)
  166.       Display *d;
  167.       Atom atom;
  168.  
  169.  
  170. d      specifies the connection to the X server
  171.  
  172. atom      specifies the atom whose name is desired
  173.  
  174. This function returns the name of an Atom.  The result is
  175. cached, such that subsequent requests do not cause another
  176. round-trip to the server.
  177.  
  178.  
  179. void XmuInternStrings(d, names, count, atoms)
  180.       Display *d;
  181.       String *names;
  182.       Cardinal count;
  183.       Atom *atoms;
  184.  
  185.  
  186. d      specifies the connection to the X server
  187.  
  188. names      specifies the strings to intern
  189.  
  190. count      specifies the number of strings
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                  -4-
  203.  
  204.  
  205. atoms      returns the list of Atom values
  206.  
  207. This function converts a list of atom names into Atom val-
  208. ues.  The results are cached, such that subsequent requests
  209. do not cause further round-trips to the server.  The caller
  210. is responsible for preallocating the array pointed at by
  211. atoms.
  212.  
  213.  
  214. 3.  Error Handler Functions
  215.  
  216. To use the functions defined in this section, you should
  217. include the header file <X11/Xmu/Error.h>.
  218.  
  219.  
  220. int XmuPrintDefaultErrorMessage(dpy, event, fp)
  221.       Display *dpy;
  222.       XErrorEvent *event;
  223.       FILE *fp;
  224.  
  225.  
  226. dpy      specifies the connection to the X server
  227.  
  228. event      specifies the error
  229.  
  230. fp      specifies where to print the error message
  231.  
  232. This function prints an error message, equivalent to Xlib's
  233. default error message for protocol errors.  It returns a
  234. non-zero value if the caller should consider exiting, other-
  235. wise it returns 0.  This function can be used when you need
  236. to write your own error handler, but need to print out an
  237. error from within that handler.
  238.  
  239.  
  240. int XmuSimpleErrorHandler(dpy, errorp)
  241.       Display *dpy;
  242.       XErrorEvent *errorp;
  243.  
  244.  
  245. dpy      specifies the connection to the X server
  246.  
  247. errorp      specifies the error
  248.  
  249. This function ignores errors for BadWindow errors for
  250. XQueryTree and XGetWindowAttributes, and ignores BadDrawable
  251. errors for XGetGeometry; it returns 0 in those cases.  Oth-
  252. erwise, it prints the default error message, and returns a
  253. non-zero value if the caller should consider exiting, and 0
  254. if the caller should not exit.
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                  -5-
  269.  
  270.  
  271. 4.  System Utility Functions
  272.  
  273. To use the functions defined in this section, you should
  274. include the header file <X11/Xmu/SysUtil.h>.
  275.  
  276.  
  277. int XmuGetHostname(buf, maxlen)
  278.       char *buf;
  279.       int maxlen;
  280.  
  281.  
  282. buf      returns the host name
  283.  
  284. maxlen      specifies the length of buf
  285.  
  286. This function stores the null terminated name of the local
  287. host in buf, and returns length of the name.  This function
  288. hides operating system differences, such as whether to call
  289. gethostname or uname.
  290.  
  291.  
  292. 5.  Window Utility Functions
  293.  
  294. To use the functions defined in this section, you should
  295. include the header file <X11/Xmu/WinUtil.h>.
  296.  
  297.  
  298. Screen *XmuScreenOfWindow(dpy, w)
  299.       Display *dpy;
  300.       Window w;
  301.  
  302.  
  303. dpy      specifies the connection to the X server
  304.  
  305. w      specifies the window
  306.  
  307. This function returns the Screen on which the specified win-
  308. dow was created.
  309.  
  310.  
  311. Window XmuClientWindow(dpy, win)
  312.       Display *dpy;
  313.       Window win;
  314.  
  315.  
  316. dpy      specifies the connection to the X server
  317.  
  318. win      specifies the window
  319.  
  320. This function finds a window, at or below the specified win-
  321. dow, which has a WM_STATE property.  If such a window is
  322. found, it is returned, otherwise the argument window is
  323. returned.
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                  -6-
  335.  
  336.  
  337. Bool XmuUpdateMapHints(dpy, w, hints)
  338.       Display *dpy;
  339.       Window w;
  340.       XSizeHints *hints;
  341.  
  342.  
  343. dpy      specifies the connection to the X server
  344.  
  345. win      specifies the window
  346.  
  347. hints      specifies the new hints, or NULL
  348.  
  349. This function clears the PPosition and PSize flags and sets
  350. the USPosition and USSize flags in the hints structure, and
  351. then stores the hints for the window using XSetWMNormalHints
  352. and returns True.  If NULL is passed for the hints struc-
  353. ture, then the current hints are read back from the window
  354. using XGetWMNormalHints and are used instead, and True is
  355. returned; otherwise False is returned.
  356.  
  357.  
  358. 6.  Cursor Utility Functions
  359.  
  360. To use the functions defined in this section, you should
  361. include the header file <X11/Xmu/CurUtil.h>.
  362.  
  363.  
  364. int XmuCursorNameToIndex(name)
  365.       char *name;
  366.  
  367.  
  368. name      specifies the name of the cursor
  369.  
  370. This function takes the name of a standard cursor and
  371. returns its index in the standard cursor font.    The cursor
  372. names are formed by removing the ``XC_'' prefix from the
  373. cursor defines listed in Appendix B of the Xlib manual.
  374.  
  375.  
  376. 7.  Graphics Functions
  377.  
  378. To use the functions defined in this section, you should
  379. include the header file <X11/Xmu/Drawing.h>.
  380.  
  381.  
  382. void XmuDrawRoundedRectangle(dpy, draw, gc, x, y, w, h, ew, eh)
  383.       Display *dpy;
  384.       Drawable draw;
  385.       GC gc;
  386.       int x, y, w, h, ew, eh;
  387.  
  388.  
  389. dpy      specifies the connection to the X server
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                  -7-
  401.  
  402.  
  403. draw      specifies the drawable
  404.  
  405. gc      specifies the GC
  406.  
  407. x      specifies the upper left x coordinate
  408.  
  409. y      specifies the upper left y coordinate
  410.  
  411. w      specifies the rectangle width
  412.  
  413. h      specifies the rectangle height
  414.  
  415. ew      specifies the corner width
  416.  
  417. eh      specifies the corner height
  418.  
  419. This function draws a rounded rectangle, where x, y, w, h
  420. are the dimensions of the overall rectangle, and ew and eh
  421. are the sizes of a bounding box that the corners are drawn
  422. inside of; ew should be no more than half of w, and eh
  423. should be no more than half of h.  The current GC line
  424. attributes control all attributes of the line.
  425.  
  426.  
  427. void XmuFillRoundedRectangle(dpy, draw, gc, x, y, w, h, ew, eh)
  428.       Display *dpy;
  429.       Drawable draw;
  430.       GC gc;
  431.       int x, y, w, h, ew, eh;
  432.  
  433.  
  434. dpy      specifies the connection to the X server
  435.  
  436. draw      specifies the drawable
  437.  
  438. gc      specifies the GC
  439.  
  440. x      specifies the upper left x coordinate
  441.  
  442. y      specifies the upper left y coordinate
  443.  
  444. w      specifies the rectangle width
  445.  
  446. h      specifies the rectangle height
  447.  
  448. ew      specifies the corner width
  449.  
  450. eh      specifies the corner height
  451.  
  452. This function draws a filled rounded rectangle, where x, y,
  453. w, h are the dimensions of the overall rectangle, and ew and
  454. eh are the sizes of a bounding box that the corners are
  455. drawn inside of; ew should be no more than half of w, and eh
  456. should be no more than half of h.  The current GC fill
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                  -8-
  467.  
  468.  
  469. settings control all attributes of the fill contents.
  470.  
  471.  
  472. XmuDrawLogo(dpy, drawable, gcFore, gcBack, x, y, width, height)
  473.       Display *dpy;
  474.       Drawable drawable;
  475.       GC gcFore, gcBack;
  476.       int x, y;
  477.       unsigned int width, height;
  478.  
  479.  
  480. dpy      specifies the connection to the X server
  481.  
  482. drawable  specifies the drawable
  483.  
  484. gcFore      specifies the foreground GC
  485.  
  486. gcBack      specifies the background GC
  487.  
  488. x      specifies the upper left x coordinate
  489.  
  490. y      specifies the upper left y coordinate
  491.  
  492. width      specifies the logo width
  493.  
  494. height      specifies the logo height
  495.  
  496. This function draws the ``official'' X Window System logo.
  497. The bounding box of the logo in the drawable is given by x,
  498. y, width, and height.  The logo itself is filled using
  499. gcFore, and the rest of the rectangle is filled using
  500. gcBack.
  501.  
  502.  
  503. Pixmap XmuCreateStippledPixmap(screen, fore, back, depth)
  504.       Screen *screen;
  505.       Pixel fore, back;
  506.       unsigned int depth;
  507.  
  508.  
  509. screen      specifies the screen the pixmap is created on
  510.  
  511. fore      specifies the foreground pixel value
  512.  
  513. back      specifies the background pixel value
  514.  
  515. depth      specifies the depth of the pixmap
  516.  
  517. This function creates a two pixel by one pixel stippled
  518. pixmap of specified depth on the specified screen.  The
  519. pixmap is cached so that multiple requests share the same
  520. pixmap.  The pixmap should be freed with XmuReleaseStippled-
  521. Pixmap to maintain correct reference counts.
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                  -9-
  533.  
  534.  
  535. void XmuReleaseStippledPixmap(screen, pixmap)
  536.       Screen *screen;
  537.       Pixmap pixmap;
  538.  
  539.  
  540. screen      specifies the screen the pixmap was created on
  541.  
  542. pixmap      specifies the pixmap to free
  543.  
  544. This function frees a pixmap created with
  545. XmuCreateStippledPixmap.
  546.  
  547.  
  548. int XmuReadBitmapData(fstream, width, height, datap, x_hot, y_hot)
  549.     FILE *fstream;
  550.     unsigned int *width, *height;
  551.     unsigned char **datap;
  552.     int *x_hot, *y_hot;
  553.  
  554.  
  555. stream      specifies the stream to read from
  556.  
  557. width      returns the width of the bitmap
  558.  
  559. height      returns the height of the bitmap
  560.  
  561. datap      returns the parsed bitmap data
  562.  
  563. x_hot      returns the x coordinate of the hotspot
  564.  
  565. y_hot      returns the y coordinate of the hotspot
  566.  
  567. This function reads a standard bitmap file description from
  568. the specified stream, and returns the parsed data in a for-
  569. mat suitable for passing to XCreateBitmapFromData.  The
  570. return value of the function has the same interpretation as
  571. the return value for XReadBitmapFile.
  572.  
  573.  
  574. int XmuReadBitmapDataFromFile(filename, width, height, datap, x_hot, y_hot)
  575.     char *filename;
  576.     unsigned int *width, *height;
  577.     unsigned char **datap;
  578.     int *x_hot, *y_hot;
  579.  
  580.  
  581. filename  specifies the file to read from
  582.  
  583. width      returns the width of the bitmap
  584.  
  585. height      returns the height of the bitmap
  586.  
  587. datap      returns the parsed bitmap data
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                 -10-
  599.  
  600.  
  601. x_hot      returns the x coordinate of the hotspot
  602.  
  603. y_hot      returns the y coordinate of the hotspot
  604.  
  605. This function reads a standard bitmap file description from
  606. the specified file, and returns the parsed data in a format
  607. suitable for passing to XCreateBitmapFromData.    The return
  608. value of the function has the same interpretation as the
  609. return value for XReadBitmapFile.
  610.  
  611.  
  612. Pixmap XmuLocateBitmapFile(screen, name, srcname, srcnamelen, widthp, heightp, xhotp, yhotp)
  613.     Screen *screen;
  614.     char *name;
  615.     char *srcname;
  616.     int srcnamelen;
  617.     int *widthp, *heightp, *xhotp, *yhotp;
  618.  
  619.  
  620. screen      specifies the screen the pixmap is created on
  621.  
  622. name      specifies the file to read from
  623.  
  624. srcname   returns the full filename of the bitmap
  625.  
  626. srcnamelen
  627.       specifies the length of the srcname buffer
  628.  
  629. width      returns the width of the bitmap
  630.  
  631. height      returns the height of the bitmap
  632.  
  633. xhotp      returns the x coordinate of the hotspot
  634.  
  635. yhotp      returns the y coordinate of the hotspot
  636.  
  637. This function reads a file in standard bitmap file format,
  638. using XReadBitmapFile, and returns the created bitmap.    The
  639. filename may be absolute, or relative to the global resource
  640. named bitmapFilePath with class BitmapFilePath.  If the
  641. resource is not defined, the default value is the build sym-
  642. bol BITMAPDIR, which is typically
  643. "/usr/include/X11/bitmaps".  If srcnamelen is greater than
  644. zero and srcname is not NULL, the null terminated filename
  645. will be copied into srcname.  The size and hotspot of the
  646. bitmap are also returned.
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.                 -11-
  665.  
  666.  
  667. Pixmap XmuCreatePixmapFromBitmap(dpy, d, bitmap, width, height, depth, fore, back)
  668.     Display *dpy;
  669.     Drawable d;
  670.     Pixmap bitmap;
  671.     unsigned int width, height;
  672.     unsigned int depth;
  673.     unsigned long fore, back;
  674.  
  675.  
  676. dpy      specifies the connection to the X server
  677.  
  678. d      specifies the screen the pixmap is created on
  679.  
  680. bitmap      specifies the bitmap source
  681.  
  682. width      specifies the width of the pixmap
  683.  
  684. height      specifies the height of the pixmap
  685.  
  686. depth      specifies the depth of the pixmap
  687.  
  688. fore      specifies the foreground pixel value
  689.  
  690. back      specifies the background pixel value
  691.  
  692. This function creates a pixmap of the specified width,
  693. height, and depth, on the same screen as the specified draw-
  694. able, and then performs an XCopyPlane from the specified
  695. bitmap to the pixmap, using the specified foreground and
  696. background pixel values.  The created pixmap is returned.
  697.  
  698.  
  699. 8.  Selection Functions
  700.  
  701. To use the functions defined in this section, you should
  702. include the header file <X11/Xmu/StdSel.h>.
  703.  
  704.  
  705. Boolean XmuConvertStandardSelection(w, time, selection, target, type, value, length, format)
  706.       Widget w;
  707.       Time time;
  708.       Atom *selection, *target, *type;
  709.       caddr_t *value;
  710.       unsigned long *length;
  711.       int *format;
  712.  
  713.  
  714. w      specifies the widget which currently owns the
  715.       selection
  716.  
  717. time      specifies the time at which the selection was
  718.       established
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.                 -12-
  731.  
  732.  
  733. selection this argument is ignored
  734.  
  735. target      specifies the target type of the selection
  736.  
  737. type      returns the property type of the converted value
  738.  
  739. value      returns the converted value
  740.  
  741. length      returns the number of elements in the converted
  742.       value
  743.  
  744. format      returns the size in bits of the elements
  745.  
  746. This function converts the following standard selections:
  747. CLASS, CLIENT_WINDOW, DECNET_ADDRESS, HOSTNAME, IP_ADDRESS,
  748. NAME, OWNER_OS, TARGETS, TIMESTAMP, and USER.  It returns
  749. True if the conversion was successful, else it returns
  750. False.
  751.  
  752.  
  753. 9.  Type Converter Functions
  754.  
  755. To use the functions defined in this section, you should
  756. include the header file <X11/Xmu/Converters.h>.
  757.  
  758.  
  759. void XmuCvtFunctionToCallback(args, num_args, fromVal, toVal)
  760.       XrmValue *args;
  761.       Cardinal *num_args;
  762.       XrmValuePtr fromVal;
  763.       XrmValuePtr toVal;
  764.  
  765.  
  766. args      this argument is ignored
  767.  
  768. num_args  this argument is ignored
  769.  
  770. fromVal   the function to convert
  771.  
  772. toVal      the place to store the converted value
  773.  
  774. This function converts a callback procedure to a callback
  775. list containing that procedure, with NULL closure data.  To
  776. use this converter, include the following in your widget's
  777. ClassInitialize procedure:
  778.  
  779. XtAddConverter(XtRCallProc, XtRCallback, XmuCvtFunctionTo-
  780. Callback, NULL, 0);
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.                 -13-
  797.  
  798.  
  799. void XmuCvtStringToBackingStore(args, num_args, fromVal, toVal)
  800.       XrmValue *args;
  801.       Cardinal *num_args;
  802.       XrmValuePtr fromVal;
  803.       XrmValuePtr toVal;
  804.  
  805.  
  806. args      this argument is ignored
  807.  
  808. num_args  this argument must be a pointer to a Cardinal con-
  809.       taining the value 0
  810.  
  811. fromVal   specifies the string to convert
  812.  
  813. toVal      returns the converted value
  814.  
  815. This function converts a string to a backing-store integer
  816. as defined in <X11/X.h>.  The string "notUseful" converts to
  817. NotUseful, "whenMapped" converts to WhenMapped, and "always"
  818. converts to Always.  The string "default" converts to the
  819. value Always+ WhenMapped+ NotUseful.  The case of the string
  820. does not matter.  To use this converter, include the follow-
  821. ing in your widget's ClassInitialize procedure:
  822.  
  823. XtAddConverter(XtRString, XtRBackingStore, XmuCvtStringTo-
  824. BackingStore, NULL, 0);
  825.  
  826.  
  827. void XmuCvtStringToBitmap(args, num_args, fromVal, toVal)
  828.       XrmValuePtr args;
  829.       Cardinal *num_args;
  830.       XrmValuePtr fromVal;
  831.       XrmValuePtr toVal;
  832.  
  833.  
  834. args      the sole argument specifies the Screen on which to
  835.       create the bitmap
  836.  
  837. num_args  must be the value 1
  838.  
  839. fromVal   specifies the string to convert
  840.  
  841. toVal      returns the converted value
  842.  
  843. This function creates a bitmap (a Pixmap of depth one) suit-
  844. able for window manager icons.    The string argument is the
  845. name of a file in standard bitmap file format.    For the pos-
  846. sible filename specifications, see XmuLocateBitmapFile.  To
  847. use this converter, include the following in your widget's
  848. ClassInitialize procedure:
  849.  
  850. static XtConvertArgRec screenConvertArg[] = {
  851.   {XtBaseOffset, (XtPointer)XtOffset(Widget, core.screen),
  852. sizeof(Screen *)}
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.                 -14-
  863.  
  864.  
  865. };
  866.  
  867. XtAddConverter(XtRString, XtRBitmap, XmuCvtStringToBitmap,
  868.        screenConvertArg, XtNumber(screenConvertArg));
  869.  
  870.  
  871. Boolean XmuCvtStringToColorCursor(dpy, args, num_args, fromVal, toVal, data)
  872.       Display * dpy;
  873.       XrmValuePtr args;
  874.       Cardinal *num_args;
  875.       XrmValuePtr fromVal;
  876.       XrmValuePtr toVal;
  877.       XtPointer * data;
  878.  
  879.  
  880. dpy      specifies the display to use for conversion warn-
  881.       ings
  882.  
  883. args      specifies the required conversion arguments
  884.  
  885. num_args  specifies the number of required conversion argu-
  886.       ments, which is 4
  887.  
  888. fromVal   specifies the string to convert
  889.  
  890. toVal      returns the converted value
  891.  
  892. data      this argument is ignored
  893.  
  894. This function converts a string to a Cursor with the fore-
  895. ground and background pixels specified by the conversion
  896. arguments.  The string can either be a standard cursor name
  897. formed by removing the ``XC_'' prefix from any of the cursor
  898. defines listed in Appendix B of the Xlib Manual, a font name
  899. and glyph index in decimal of the form "FONT fontname index
  900. [[font] index]", or a bitmap filename acceptable to
  901. XmuLocateBitmapFile.  To use this converter, include the
  902. following in the widget ClassInitialize procedure:
  903.  
  904. static XtConvertArgRec colorCursorConvertArgs[] = {
  905.   {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec,
  906. core.screen),
  907.    sizeof(Screen *)},
  908.   {XtResourceString, (XtPointer) XtNpointerColor,
  909. sizeof(Pixel)},
  910.   {XtResourceString, (XtPointer) XtNpointerColorBackground,
  911. sizeof(Pixel)},
  912.   {XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec,
  913. core.colormap),
  914.    sizeof(Colormap)}
  915. };
  916.  
  917. XtSetTypeConverter(XtRString, XtRColorCursor, XmuCvtString-
  918. ToColorCursor,
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.                 -15-
  929.  
  930.  
  931.        colorCursorConvertArgs, XtNumber(colorCursorCon-
  932. vertArgs),
  933.          XtCacheByDisplay, NULL); The widget must
  934. recognize XtNpointerColor and XtNpointerColorBackground as
  935. resources, or specify other appropriate foreground and back-
  936. ground resources.  The widget's Realize and SetValues meth-
  937. ods must cause the converter to be invoked with the appro-
  938. priate arguments when one of the foreground, background, or
  939. cursor resources has changed, or when the window is created,
  940. and must assign the cursor to the window of the widget.
  941.  
  942.  
  943. void XmuCvtStringToCursor(args, num_args, fromVal, toVal)
  944.       XrmValuePtr args;
  945.       Cardinal *num_args;
  946.       XrmValuePtr fromVal;
  947.       XrmValuePtr toVal;
  948.  
  949.  
  950. args      specifies the required conversion argument, the
  951.       screen
  952.  
  953. num_args  specifies the number of required conversion argu-
  954.       ments, which is 1
  955.  
  956. fromVal   specifies the string to convert
  957.  
  958. toVal      returns the converted value
  959.  
  960. This function converts a string to a Cursor.  The string can
  961. either be a standard cursor name formed by removing the
  962. ``XC_'' prefix from any of the cursor defines listed in
  963. Appendix B of the Xlib Manual, a font name and glyph index
  964. in decimal of the form "FONT fontname index [[font] index]",
  965. or a bitmap filename acceptable to XmuLocateBitmapFile.  To
  966. use this converter, include the following in your widget's
  967. ClassInitialize procedure:
  968.  
  969. static XtConvertArgRec screenConvertArg[] = {
  970.   {XtBaseOffset, (XtPointer)XtOffsetOf(WidgetRec,
  971. core.screen), sizeof(Screen *)}
  972. };
  973.  
  974. XtAddConverter(XtRString, XtRCursor, XmuCvtStringToCursor,
  975.        screenConvertArg, XtNumber(screenConvertArg));
  976.  
  977.  
  978. void XmuCvtStringToGravity(args, num_args, fromVal, toVal)
  979.      XrmValuePtr *args;
  980.       Cardinal *num_args;
  981.       XrmValuePtr fromVal;
  982.       XrmValuePtr toVal;
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.                 -16-
  995.  
  996.  
  997. args      this argument is ignored
  998.  
  999. num_args  this argument must be a pointer to a Cardinal con-
  1000.       taining the value 0
  1001.  
  1002. fromVal   specifies the string to convert
  1003.  
  1004. toVal      returns the converted value
  1005.  
  1006. This function converts a string to an XtGravity enumeration
  1007. value.    The string "forget" and a NULL value convert to
  1008. ForgetGravity, "NorthWestGravity" converts to
  1009. NorthWestGravity, the strings "NorthGravity" and "top" con-
  1010. vert to NorthGravity, "NorthEastGravity" converts to
  1011. NorthEastGravity, the strings "West" and "left" convert to
  1012. WestGravity, "CenterGravity" converts to CenterGravity,
  1013. "EastGravity" and "right" convert to EastGravity, "South-
  1014. WestGravity" converts to SouthWestGravity, "SouthGravity"
  1015. and "bottom" convert to SouthGravity, "SouthEastGravity"
  1016. converts to SouthEastGravity, "StaticGravity" converts to
  1017. StaticGravity, and "UnmapGravity" converts to UnmapGravity.
  1018. The case of the string does not matter.  To use this con-
  1019. verter, include the following in your widget's class ini-
  1020. tialize procedure:
  1021.  
  1022. XtAddConverter(XtRString, XtRGravity, XmuCvtStringToGravity,
  1023. NULL, 0);
  1024.  
  1025.  
  1026. void XmuCvtStringToJustify(args, num_args, fromVal, toVal)
  1027.       XrmValuePtr *args;
  1028.       Cardinal *num_args;
  1029.       XrmValuePtr fromVal;
  1030.       XrmValuePtr toVal;
  1031.  
  1032.  
  1033. args      this argument is ignored
  1034.  
  1035. num_args  this argument is ignored
  1036.  
  1037. fromVal   specifies the string to convert
  1038.  
  1039. toVal      returns the converted value
  1040.  
  1041. This function converts a string to an XtJustify enumeration
  1042. value.    The string "left" converts to XtJustifyLeft, "cen-
  1043. ter" converts to XtJustifyCenter, and "right" converts to
  1044. XtJustifyRight.  The case of the string does not matter.  To
  1045. use this converter, include the following in your widget's
  1046. ClassInitialize procedure:
  1047.  
  1048. XtAddConverter(XtRString, XtRJustify, XmuCvtStringToJustify,
  1049. NULL, 0);
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.                 -17-
  1061.  
  1062.  
  1063. void XmuCvtStringToLong(args, num_args, fromVal, toVal)
  1064.       XrmValuePtr args;
  1065.       Cardinal      *num_args;
  1066.       XrmValuePtr fromVal;
  1067.       XrmValuePtr toVal;
  1068.  
  1069.  
  1070. args      this argument is ignored
  1071.  
  1072. num_args  this argument must be a pointer to a Cardinal con-
  1073.       taining 0
  1074.  
  1075. fromVal   specifies the string to convert
  1076.  
  1077. toVal      returns the converted value
  1078.  
  1079. This function converts a string to an integer of type long.
  1080. It parses the string using sscanf with a format of "%ld".
  1081. To use this converter, include the following in your wid-
  1082. get's ClassInitialize procedure:
  1083.  
  1084. XtAddConverter(XtRString, XtRLong, XmuCvtStringToLong, NULL,
  1085. 0);
  1086.  
  1087.  
  1088. void XmuCvtStringToOrientation(args, num_args, fromVal, toVal)
  1089.       XrmValuePtr *args;
  1090.       Cardinal *num_args;
  1091.       XrmValuePtr fromVal;
  1092.       XrmValuePtr toVal;
  1093.  
  1094.  
  1095. args      this argument is ignored
  1096.  
  1097. num_args  this argument is ignored
  1098.  
  1099. fromVal   specifies the string to convert
  1100.  
  1101. toVal      returns the converted value
  1102.  
  1103. This function converts a string to an XtOrientation enumera-
  1104. tion value.  The string "horizontal" converts to XtorientHo-
  1105. rizontal and "vertical" converts to XtorientVertical.  The
  1106. case of the string does not matter.  To use this converter,
  1107. include the following in your widget's ClassInitialize pro-
  1108. cedure:
  1109.  
  1110. XtAddConverter(XtRString, XtROrientation, XmuCvtStringToOri-
  1111. entation, NULL, 0);
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.                 -18-
  1127.  
  1128.  
  1129. Boolean XmuCvtStringToShapeStyle(dpy, args, num_args, from, toVal, data)
  1130.       Display *dpy;
  1131.       XrmValue *args;
  1132.       Cardinal *num_args;
  1133.       XrmValue *from;
  1134.       XrmValue *toVal;
  1135.       XtPointer *data;
  1136.  
  1137.  
  1138. dpy      the display to use for conversion warnings
  1139.  
  1140. args      this argument is ignored
  1141.  
  1142. num_args  this argument is ignored
  1143.  
  1144. fromVal   the value to convert from
  1145.  
  1146. toVal      the place to store the converted value
  1147.  
  1148. data      this argument is ignored
  1149.  
  1150. This function converts a string to an integer shape style.
  1151. The string "rectangle" converts to XmuShapeRectangle, "oval"
  1152. converts to XmuShapeOval, "ellipse" converts to
  1153. XmuShapeEllipse, and "roundedRectangle" converts to
  1154. XmuShapeRoundedRectangle.  The case of the string does not
  1155. matter.  To use this converter, include the following in
  1156. your widget's ClassInitialize procedure:
  1157.  
  1158. XtSetTypeConverter(XtRString, XtRShapeStyle, XmuCvtString-
  1159. ToShapeStyle,
  1160.            NULL, 0, XtCacheNone, NULL);
  1161.  
  1162.  
  1163. Boolean XmuReshapeWidget(w, shape_style, corner_width, corner_height)
  1164.       Widget w;
  1165.       int shape_style;
  1166.       int corner_width, corner_height;
  1167.  
  1168.  
  1169. w      specifies the widget to reshape
  1170.  
  1171. shape_style
  1172.       specifies the new shape
  1173.  
  1174. corner_width
  1175.       specifies the width of the rounded rectangle cor-
  1176.       ner
  1177.  
  1178. corner_height
  1179.       specified the height of the rounded rectangle cor-
  1180.       ner
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.                 -19-
  1193.  
  1194.  
  1195. This function reshapes the specified widget, using the Shape
  1196. extension, to a rectangle, oval, ellipse, or rounded rectan-
  1197. gle, as specified by shape_style ( XmuShapeRectangle,
  1198. XmuShapeOval, XmuShapeEllipse, and XmuShapeRoundedRectangle,
  1199. respectively).    The shape is bounded by the outside edges of
  1200. the rectangular extents of the widget.    If the shape is a
  1201. rounded rectangle, corner_width and corner_height specify
  1202. the size of the bounding box that the corners are drawn
  1203. inside of (see XmuFillRoundedRectangle); otherwise, cor-
  1204. ner_width and corner_height are ignored.  The origin of the
  1205. widget within its parent remains unchanged.
  1206.  
  1207.  
  1208. void XmuCvtStringToWidget(args, num_args, fromVal, toVal)
  1209.       XrmValuePtr args;
  1210.       Cardinal *num_args;
  1211.       XrmValuePtr fromVal;
  1212.       XrmValuePtr toVal;
  1213.  
  1214.  
  1215. args      this sole argument is the parent Widget
  1216.  
  1217. num_args  this argument must be 1
  1218.  
  1219. fromVal   specifies the string to convert
  1220.  
  1221. toVal      returns the converted value
  1222.  
  1223. This function converts a string to an immediate child widget
  1224. of the parent widget passed as an argument.  Note that this
  1225. converter only works for child widgets that have already
  1226. been created; there is no lazy evaluation.  The string is
  1227. first compared against the names of the normal and popup
  1228. children, and if a match is found the corresponding child is
  1229. returned.  If no match is found, the string is compared
  1230. against the classes of the normal and popup children, and if
  1231. a match is found the corresponding child is returned.  The
  1232. case of the string is significant.  To use this converter,
  1233. include the following in your widget's ClassInitialize pro-
  1234. cedure:
  1235.  
  1236. static XtConvertArgRec parentCvtArg[] = {
  1237.   {XtBaseOffset, (XtPointer)XtOffset(Widget, core.parent),
  1238. sizeof(Widget)},
  1239. };
  1240.  
  1241. XtAddConverter(XtRString, XtRWidget, XmuCvtStringToWidget,
  1242.        parentCvtArg, XtNumber(parentCvtArg));
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.                 -20-
  1259.  
  1260.  
  1261. Boolean XmuNewCvtStringToWidget(dpy, args, num_args, fromVal, toVal, data)
  1262.       Display *dpy;
  1263.       XrmValue * args;
  1264.       Cardinal *num_args;
  1265.       XrmValue * fromVal;
  1266.       XrmValue * toVal;
  1267.       XtPointer *data;
  1268.  
  1269.  
  1270. dpy      the display to use for conversion warnings
  1271.  
  1272. args      this sole argument is the parent Widget
  1273.  
  1274. num_args  this argument must be a pointer to a Cardinal con-
  1275.       taining the value 1
  1276.  
  1277. fromVal   specifies the string to convert
  1278.  
  1279. toVal      returns the converted value
  1280.  
  1281. data      this argument is ignored
  1282.  
  1283. This converter is identical in functionality to XmuCvt-
  1284. StringToWidget, except that it is a new-style converter,
  1285. allowing the specification of a cache type at the time of
  1286. registration.  Most widgets will not cache the conversion
  1287. results, as the application may dynamically create and
  1288. destroy widgets, which would cause cached values to become
  1289. illegal.  To use this converter, include the following in
  1290. the widget's class initialize procedure:
  1291.  
  1292. static XtConvertArgRec parentCvtArg[] = {
  1293.   {XtWidgetBaseOffset, (XtPointer)XtOffsetOf(WidgetRec,
  1294. core.parent),
  1295.    sizeof(Widget)}
  1296. };
  1297.  
  1298. XtSetTypeConverter(XtRString, XtRWidget, XmuNewCvtString-
  1299. ToWidget,
  1300.          parentCvtArg, XtNumber(parentCvtArg),
  1301. XtCacheNone, NULL);
  1302.  
  1303.  
  1304. 10.  Character Set Functions
  1305.  
  1306. To use the functions defined in this section, you should
  1307. include the header file <X11/Xmu/CharSet.h>.
  1308.  
  1309. The functions in this section are deprecated because they
  1310. don't work in most locales now supported by X11; the func-
  1311. tion XmbLookupString provides a better alternative.
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.                 -21-
  1325.  
  1326.  
  1327. void XmuCopyISOLatin1Lowered(dst, src)
  1328.       char *dst, *src;
  1329.  
  1330.  
  1331. dst      returns the string copy
  1332.  
  1333. src      specifies the string to copy
  1334.  
  1335. This function copies a null terminated string from src to
  1336. dst (including the null), changing all Latin-1 uppercase
  1337. letters to lowercase.  The string is assumed to be encoded
  1338. using ISO 8859-1.
  1339.  
  1340.  
  1341. void XmuCopyISOLatin1Uppered(dst, src)
  1342.       char *dst, *src;
  1343.  
  1344.  
  1345. dst      returns the string copy
  1346.  
  1347. src      specifies the string to copy
  1348.  
  1349. This function copies a null terminated string from src to
  1350. dst (including the null), changing all Latin-1 lowercase
  1351. letters to uppercase.  The string is assumed to be encoded
  1352. using ISO 8859-1.
  1353.  
  1354.  
  1355. int XmuCompareISOLatin1(first, second)
  1356.       char *first, *second;
  1357.  
  1358.  
  1359. dst      specifies a string to compare
  1360.  
  1361. src      specifies a string to compare
  1362.  
  1363. This function compares two null terminated Latin-1 strings,
  1364. ignoring case differences, and returns an integer greater
  1365. than, equal to, or less than 0, according to whether first
  1366. is lexicographically greater than, equal to, or less than
  1367. second.  The two strings are assumed to be encoded using ISO
  1368. 8859-1.
  1369.  
  1370.  
  1371. int XmuLookupLatin1(event, buffer, nbytes, keysym, status)
  1372.       XKeyEvent *event;
  1373.       char *buffer;
  1374.       int nbytes;
  1375.       KeySym *keysym;
  1376.       XComposeStatus *status;
  1377.  
  1378.  
  1379. event      specifies the key event
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.                 -22-
  1391.  
  1392.  
  1393. buffer      returns the translated characters
  1394.  
  1395. nbytes      specifies the length of the buffer
  1396.  
  1397. keysym      returns the computed KeySym, or None
  1398.  
  1399. status      specifies or returns the compose state
  1400.  
  1401. This function is identical to XLookupString, and exists only
  1402. for naming symmetry with other functions.
  1403.  
  1404.  
  1405. int XmuLookupLatin2(event, buffer, nbytes, keysym, status)
  1406.       XKeyEvent *event;
  1407.       char *buffer;
  1408.       int nbytes;
  1409.       KeySym *keysym;
  1410.       XComposeStatus *status;
  1411.  
  1412.  
  1413. event      specifies the key event
  1414.  
  1415. buffer      returns the translated characters
  1416.  
  1417. nbytes      specifies the length of the buffer
  1418.  
  1419. keysym      returns the computed KeySym, or None
  1420.  
  1421. status      specifies or returns the compose state
  1422.  
  1423. This function is similar to XLookupString, except that it
  1424. maps a key event to an Latin-2 (ISO 8859-2) string, or to an
  1425. ASCII control string.
  1426.  
  1427.  
  1428. int XmuLookupLatin3(event, buffer, nbytes, keysym, status)
  1429.       XKeyEvent *event;
  1430.       char *buffer;
  1431.       int nbytes;
  1432.       KeySym *keysym;
  1433.       XComposeStatus *status;
  1434.  
  1435.  
  1436. event      specifies the key event
  1437.  
  1438. buffer      returns the translated characters
  1439.  
  1440. nbytes      specifies the length of the buffer
  1441.  
  1442. keysym      returns the computed KeySym, or None
  1443.  
  1444. status      specifies or returns the compose state
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.                 -23-
  1457.  
  1458.  
  1459. This function is similar to XLookupString, except that it
  1460. maps a key event to an Latin-3 (ISO 8859-3) string, or to an
  1461. ASCII control string.
  1462.  
  1463.  
  1464. int XmuLookupLatin4(event, buffer, nbytes, keysym, status)
  1465.       XKeyEvent *event;
  1466.       char *buffer;
  1467.       int nbytes;
  1468.       KeySym *keysym;
  1469.       XComposeStatus *status;
  1470.  
  1471.  
  1472. event      specifies the key event
  1473.  
  1474. buffer      returns the translated characters
  1475.  
  1476. nbytes      specifies the length of the buffer
  1477.  
  1478. keysym      returns the computed KeySym, or None
  1479.  
  1480. status      specifies or returns the compose state
  1481.  
  1482. This function is similar to XLookupString, except that it
  1483. maps a key event to an Latin-4 (ISO 8859-4) string, or to an
  1484. ASCII control string.
  1485.  
  1486.  
  1487. int XmuLookupKana(event, buffer, nbytes, keysym, status)
  1488.       XKeyEvent *event;
  1489.       char *buffer;
  1490.       int nbytes;
  1491.       KeySym *keysym;
  1492.       XComposeStatus *status;
  1493.  
  1494.  
  1495. event      specifies the key event
  1496.  
  1497. buffer      returns the translated characters
  1498.  
  1499. nbytes      specifies the length of the buffer
  1500.  
  1501. keysym      returns the computed KeySym, or None
  1502.  
  1503. status      specifies or returns the compose state
  1504.  
  1505. This function is similar to XLookupString, except that it
  1506. maps a key event to a string in an encoding consisting of
  1507. Latin-1 (ISO 8859-1) and ASCII control in the Graphics Left
  1508. half (values 0 to 127), and Katakana in the Graphics Right
  1509. half (values 128 to 255), using the values from JIS
  1510. X201-1976.
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.                 -24-
  1523.  
  1524.  
  1525. int XmuLookupJISX0201(event, buffer, nbytes, keysym, status)
  1526.       XKeyEvent *event;
  1527.       char *buffer;
  1528.       int nbytes;
  1529.       KeySym *keysym;
  1530.       XComposeStatus *status;
  1531.  
  1532.  
  1533. event      specifies the key event
  1534.  
  1535. buffer      returns the translated characters
  1536.  
  1537. nbytes      specifies the length of the buffer
  1538.  
  1539. keysym      returns the computed KeySym, or None
  1540.  
  1541. status      specifies or returns the compose state
  1542.  
  1543. This function is similar to XLookupString, except that it
  1544. maps a key event to a string in the JIS X0201-1976 encoding,
  1545. including ASCII control.
  1546.  
  1547.  
  1548. int XmuLookupArabic(event, buffer, nbytes, keysym, status)
  1549.       XKeyEvent *event;
  1550.       char *buffer;
  1551.       int nbytes;
  1552.       KeySym *keysym;
  1553.       XComposeStatus *status;
  1554.  
  1555.  
  1556. event      specifies the key event
  1557.  
  1558. buffer      returns the translated characters
  1559.  
  1560. nbytes      specifies the length of the buffer
  1561.  
  1562. keysym      returns the computed KeySym, or None
  1563.  
  1564. status      specifies or returns the compose state
  1565.  
  1566. This function is similar to XLookupString, except that it
  1567. maps a key event to a Latin/Arabic (ISO 8859-6) string, or
  1568. to an ASCII control string.
  1569.  
  1570.  
  1571. int XmuLookupCyrillic(event, buffer, nbytes, keysym, status)
  1572.       XKeyEvent *event;
  1573.       char *buffer;
  1574.       int nbytes;
  1575.       KeySym *keysym;
  1576.       XComposeStatus *status;
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.                 -25-
  1589.  
  1590.  
  1591. event      specifies the key event
  1592.  
  1593. buffer      returns the translated characters
  1594.  
  1595. nbytes      specifies the length of the buffer
  1596.  
  1597. keysym      returns the computed KeySym, or None
  1598.  
  1599. status      specifies or returns the compose state
  1600.  
  1601. This function is similar to XLookupString, except that it
  1602. maps a key event to a Latin/Cyrillic (ISO 8859-5) string, or
  1603. to an ASCII control string.
  1604.  
  1605.  
  1606. int XmuLookupGreek(event, buffer, nbytes, keysym, status)
  1607.       XKeyEvent *event;
  1608.       char *buffer;
  1609.       int nbytes;
  1610.       KeySym *keysym;
  1611.       XComposeStatus *status;
  1612.  
  1613.  
  1614. event      specifies the key event
  1615.  
  1616. buffer      returns the translated characters
  1617.  
  1618. nbytes      specifies the length of the buffer
  1619.  
  1620. keysym      returns the computed KeySym, or None
  1621.  
  1622. status      specifies or returns the compose state
  1623.  
  1624. This function is similar to XLookupString, except that it
  1625. maps a key event to a Latin/Greek (ISO 8859-7) string, or to
  1626. an ASCII control string.
  1627.  
  1628.  
  1629. int XmuLookupHebrew(event, buffer, nbytes, keysym, status)
  1630.       XKeyEvent *event;
  1631.       char *buffer;
  1632.       int nbytes;
  1633.       KeySym *keysym;
  1634.       XComposeStatus *status;
  1635.  
  1636.  
  1637. event      specifies the key event
  1638.  
  1639. buffer      returns the translated characters
  1640.  
  1641. nbytes      specifies the length of the buffer
  1642.  
  1643. keysym      returns the computed KeySym, or None
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.                 -26-
  1655.  
  1656.  
  1657. status      specifies or returns the compose state
  1658.  
  1659. This function is similar to XLookupString, except that it
  1660. maps a key event to a Latin/Hebrew (ISO 8859-8) string, or
  1661. to an ASCII control string.
  1662.  
  1663.  
  1664. int XmuLookupAPL(event, buffer, nbytes, keysym, status)
  1665.       XKeyEvent *event;
  1666.       char *buffer;
  1667.       int nbytes;
  1668.       KeySym *keysym;
  1669.       XComposeStatus *status;
  1670.  
  1671.  
  1672. event      specifies the key event
  1673.  
  1674. buffer      returns the translated characters
  1675.  
  1676. nbytes      specifies the length of the buffer
  1677.  
  1678. keysym      returns the computed KeySym, or None
  1679.  
  1680. status      specifies or returns the compose state
  1681.  
  1682. This function is similar to XLookupString, except that it
  1683. maps a key event to an APL string.
  1684.  
  1685.  
  1686. 11.  Compound Text Functions
  1687.  
  1688. The functions defined in this section are for parsing Com-
  1689. pound Text strings, decomposing them into individual seg-
  1690. ments. Definitions needed to use these routines are in the
  1691. include file <X11/Xmu/Xct.h>.
  1692.  
  1693. The functions in this section are deprecated because they
  1694. shift the burden for recently introduced locale encodings to
  1695. the application. The use of the UTF8_STRING text encoding
  1696. provides a better alternative.
  1697.  
  1698. A Compound Text string is represented as the following type:
  1699.  
  1700.      typedef unsigned char *XctString;
  1701.  
  1702.  
  1703. XctData XctCreate(string, length, flags)
  1704.       XctString string;
  1705.       int length;
  1706.       XctFlags flags;
  1707.  
  1708.  
  1709. string      the Compound Text string
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.                 -27-
  1721.  
  1722.  
  1723. length      the number of bytes in string
  1724.  
  1725. flags      parsing control flags
  1726.  
  1727. This function creates an XctData structure for parsing a
  1728. Compound Text string.  The string need not be null termi-
  1729. nated.    The following flags are defined to control parsing
  1730. of the string:
  1731.  
  1732. XctSingleSetSegments -- This means that returned segments
  1733. should contain characters from only one set (C0, C1, GL,
  1734. GR).  When this is requested, XctSegment is never returned
  1735. by XctNextItem, instead XctC0Segment, XctC1Segment,
  1736. XctGlSegment, and XctGRSegment are returned.  C0 and C1 seg-
  1737. ments are always returned as singleton characters.
  1738.  
  1739. XctProvideExtensions -- This means that if the Compound Text
  1740. string is from a higher version than this code is imple-
  1741. mented to, then syntactically correct but unknown control
  1742. sequences should be returned as XctExtension items by
  1743. XctNextItem.  If this flag is not set, and the Compound Text
  1744. string version indicates that extensions cannot be ignored,
  1745. then each unknown control sequence will be reported as an
  1746. XctError.
  1747.  
  1748. XctAcceptC0Extensions -- This means that if the Compound
  1749. Text string is from a higher version than this code is
  1750. implemented to, then unknown C0 characters should be treated
  1751. as if they were legal, and returned as C0 characters
  1752. (regardless of how XctProvideExtensions is set) by
  1753. XctNextItem.  If this flag is not set, then all unknown C0
  1754. characters are treated according to XctProvideExtensions.
  1755.  
  1756. XctAcceptC1Extensions -- This means that if the Compound
  1757. Text string is from a higher version than this code is
  1758. implemented to, then unknown C1 characters should be treated
  1759. as if they were legal, and returned as C1 characters
  1760. (regardless of how XctProvideExtensions is set) by
  1761. XctNextItem.  If this flag is not set, then all unknown C1
  1762. characters are treated according to XctProvideExtensions.
  1763.  
  1764. XctHideDirection -- This means that horizontal direction
  1765. changes should be reported as XctHorizontal items by
  1766. XctNextItem.  then direction changes are not returned as
  1767. items, but the current direction is still maintained and
  1768. reported for other items.  The current direction is given as
  1769. an enumeration, with the values XctUnspecified,
  1770. XctLeftToRight, and XctRightToLeft.
  1771.  
  1772. XctFreeString -- This means that XctFree should free the
  1773. Compound Text string that is passed to XctCreate.  If this
  1774. flag is not set, the string is not freed.
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.                 -28-
  1787.  
  1788.  
  1789. XctShiftMultiGRToGL -- This means that XctNextItem should
  1790. translate GR segments on-the-fly into GL segments for the GR
  1791. sets: GB2312.1980-1, JISX0208.1983-1, and KSC5601.1987-1.
  1792.  
  1793.  
  1794. void XctReset(data)
  1795.       XctData data;
  1796.  
  1797.  
  1798. data      specifies the Compound Text structure
  1799.  
  1800. This function resets the XctData structure to reparse the
  1801. Compound Text string from the beginning.
  1802.  
  1803.  
  1804. XctResult XctNextItem(data)
  1805.       XctData data;
  1806.  
  1807.  
  1808. data      specifies the Compound Text structure
  1809.  
  1810. This function parses the next ``item'' from the Compound
  1811. Text string.  The return value indicates what kind of item
  1812. is returned.  The item itself, it's length, and the current
  1813. contextual state, are reported as components of the XctData
  1814. structure.  XctResult is an enumeration, with the following
  1815. values:
  1816.  
  1817. XctSegment -- the item contains some mixture of C0, GL, GR,
  1818. and C1 characters.
  1819.  
  1820. XctC0Segment -- the item contains only C0 characters.
  1821.  
  1822. XctGLSegment -- the item contains only GL characters.
  1823.  
  1824. XctC1Segment -- the item contains only C1 characters.
  1825.  
  1826. XctGRSegment -- the item contains only GR characters.
  1827.  
  1828. XctExtendedSegment -- the item contains an extended segment.
  1829.  
  1830. XctExtension -- the item is an unknown extension control
  1831. sequence.
  1832.  
  1833. XctHorizontal -- the item indicates a change in horizontal
  1834. direction or depth.  The new direction and depth are
  1835. recorded in the XctData structure.
  1836.  
  1837. XctEndOfText -- The end of the Compound Text string has been
  1838. reached.
  1839.  
  1840. XctError -- the string contains a syntactic or semantic
  1841. error; no further parsing should be performed.
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.                 -29-
  1853.  
  1854.  
  1855. The following state values are stored in the XctData struc-
  1856. ture:
  1857.  
  1858.      XctString item;          /* the action item */
  1859.      int item_length;          /* the length of item in bytes */
  1860.      int char_size;          /* the number of bytes per character in
  1861.                    * item, with zero meaning variable */
  1862.      char *encoding;          /* the XLFD encoding name for item */
  1863.      XctHDirection horizontal;/* the direction of item */
  1864.      int horz_depth;          /* the current direction nesting depth */
  1865.      char *GL;              /* the "{I} F" string for the current GL */
  1866.      char *GL_encoding;       /* the XLFD encoding name for the current GL */
  1867.      int GL_set_size;          /* 94 or 96 */
  1868.      int GL_char_size;          /* the number of bytes per GL character */
  1869.      char *GR;              /* the "{I} F" string for the current GR */
  1870.      char *GR_encoding;       /* the XLFD encoding name the for current GR */
  1871.      int GR_set_size;          /* 94 or 96 */
  1872.      int GR_char_size;          /* the number of bytes per GR character */
  1873.      char *GLGR_encoding;     /* the XLFD encoding name for the current
  1874.                    * GL+GR, if known */
  1875.  
  1876.  
  1877.  
  1878. void XctFree(data)
  1879.       XctData data;
  1880.  
  1881.  
  1882. data      specifies the Compound Text structure
  1883.  
  1884. This function frees all data associated with the XctData
  1885. structure.
  1886.  
  1887.  
  1888. 12.  CloseDisplay Hook Functions
  1889.  
  1890. To use the functions defined in this section, you should
  1891. include the header file <X11/Xmu/CloseHook.h>.
  1892.  
  1893.  
  1894. CloseHook XmuAddCloseDisplayHook(dpy, func, arg)
  1895.       Display *dpy;
  1896.       int (*func)();
  1897.       caddr_t arg;
  1898.  
  1899.  
  1900. dpy      specifies the connection to the X server
  1901.  
  1902. func      specifies the function to call at display close
  1903.  
  1904. arg      specifies arbitrary data to pass to func
  1905.  
  1906. This function adds a callback for the given display.  When
  1907. the display is closed, the given function will be called
  1908. with the given display and argument as:
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.                 -30-
  1919.  
  1920.  
  1921.      (*func)(dpy, arg)
  1922.  
  1923. The function is declared to return an int even though the
  1924. value is ignored, because some compilers have problems with
  1925. functions returning void.
  1926.  
  1927. This routine returns NULL if it was unable to add the call-
  1928. back, otherwise it returns an opaque handle that can be used
  1929. to remove or lookup the callback.
  1930.  
  1931.  
  1932. Bool XmuRemoveCloseDisplayHook(dpy, handle, func, arg)
  1933.       Display *dpy;
  1934.       CloseHook handle;
  1935.       int (*func)();
  1936.       caddr_t arg;
  1937.  
  1938.  
  1939. dpy      specifies the connection to the X server
  1940.  
  1941. handle      specifies the callback by id, or NULL
  1942.  
  1943. func      specifies the callback by function
  1944.  
  1945. arg      specifies the function data to match
  1946.  
  1947. This function deletes a callback that has been added with
  1948. XmuAddCloseDisplayHook.  If handle is not NULL, it specifies
  1949. the callback to remove, and the func and arg parameters are
  1950. ignored.  If handle is NULL, the first callback found to
  1951. match the specified func and arg will be removed.  Returns
  1952. True if a callback was removed, else returns False.
  1953.  
  1954.  
  1955. Bool XmuLookupCloseDisplayHook(dpy, handle, func, arg)
  1956.       Display *dpy;
  1957.       CloseHook handle;
  1958.       int (*func)();
  1959.       caddr_t arg;
  1960.  
  1961.  
  1962. dpy      specifies the connection to the X server
  1963.  
  1964. handle      specifies the callback by id, or NULL
  1965.  
  1966. func      specifies the callback by function
  1967.  
  1968. arg      specifies the function data to match
  1969.  
  1970. This function determines if a callback is installed.  If
  1971. handle is not NULL, it specifies the callback to look for,
  1972. and the func and arg parameters are ignored.  If handle is
  1973. NULL, the function will look for any callback for the speci-
  1974. fied func and arg.  Returns True if a matching callback
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.                 -31-
  1985.  
  1986.  
  1987. exists, else returns False.
  1988.  
  1989.  
  1990. 13.  Display Queue Functions
  1991.  
  1992. To use the functions and types defined in this section, you
  1993. should include the header file <X11/Xmu/DisplayQue.h>.    It
  1994. defines the following types:
  1995.  
  1996.  
  1997. typedef struct _XmuDisplayQueueEntry {
  1998.      struct _XmuDisplayQueueEntry *prev, *next;
  1999.      Display *display;
  2000.      CloseHook closehook;
  2001.      caddr_t data;
  2002. } XmuDisplayQueueEntry;
  2003.  
  2004. typedef struct _XmuDisplayQueue {
  2005.      int nentries;
  2006.      XmuDisplayQueueEntry *head, *tail;
  2007.      int (*closefunc)();
  2008.      int (*freefunc)();
  2009.      caddr_t data;
  2010. } XmuDisplayQueue;
  2011.  
  2012.  
  2013.  
  2014. XmuDisplayQueue *XmuDQCreate(closefunc, freefunc, data)
  2015.       int (*closefunc)();
  2016.       int (*freefunc)();
  2017.       caddr_t data;
  2018.  
  2019.  
  2020. closefunc specifies the close function
  2021.  
  2022. freefunc  specifies the free function
  2023.  
  2024. data      specifies private data for the functions
  2025.  
  2026. This function creates and returns an empty XmuDisplayQueue
  2027. (which is really just a set of displays, but is called a
  2028. queue for historical reasons).    The queue is initially
  2029. empty, but displays can be added using XmuAddDisplay.  The
  2030. data value is simply stored in the queue for use by the
  2031. closefunc and freefunc callbacks.  Whenever a display in the
  2032. queue is closed using XCloseDisplay, the closefunc (if non-
  2033. NULL) is called with the queue and the display's XmuDis-
  2034. playQueueEntry as follows:
  2035.  
  2036.      (*closefunc)(queue, entry)
  2037.  
  2038. The freeproc (if non-NULL) is called whenever the last dis-
  2039. play in the queue is closed, as follows:
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.                 -32-
  2051.  
  2052.  
  2053.      (*freefunc)(queue)
  2054.  
  2055. The application is responsible for actually freeing the
  2056. queue, by calling XmuDQDestroy.
  2057.  
  2058.  
  2059. XmuDisplayQueueEntry *XmuDQAddDisplay(q, dpy, data)
  2060.       XmuDisplayQueue *q;
  2061.       Display *dpy;
  2062.       caddr_t data;
  2063.  
  2064.  
  2065. q      specifies the queue
  2066.  
  2067. dpy      specifies the display to add
  2068.  
  2069. data      specifies private data for the free function
  2070.  
  2071. This function adds the specified display to the queue.    If
  2072. successful, the queue entry is returned, otherwise NULL is
  2073. returned.  The data value is simply stored in the queue
  2074. entry for use by the queue's freefunc callback.  This func-
  2075. tion does not attempt to prevent duplicate entries in the
  2076. queue; the caller should use XmuDQLookupDisplay to determine
  2077. if a display has already been added to a queue.
  2078.  
  2079.  
  2080. XmuDisplayQueueEntry *XmuDQLookupDisplay(q, dpy)
  2081.       XmuDisplayQueue *q;
  2082.       Display *dpy;
  2083.  
  2084.  
  2085. q      specifies the queue
  2086.  
  2087. dpy      specifies the display to lookup
  2088.  
  2089. This function returns the queue entry for the specified dis-
  2090. play, or NULL if the display is not in the queue.
  2091.  
  2092.  
  2093. XmuDQNDisplays(q)
  2094.  
  2095.  
  2096. This macro returns the number of displays in the specified
  2097. queue.
  2098.  
  2099.  
  2100. Bool XmuDQRemoveDisplay(q, dpy)
  2101.       XmuDisplayQueue *q;
  2102.       Display *dpy;
  2103.  
  2104.  
  2105. q      specifies the queue
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.                 -33-
  2117.  
  2118.  
  2119. dpy      specifies the display to remove
  2120.  
  2121. This function removes the specified display from the speci-
  2122. fied queue.  No callbacks are performed.  If the display is
  2123. not found in the queue, False is returned, otherwise True is
  2124. returned.
  2125.  
  2126.  
  2127. Bool XmuDQDestroy(q, docallbacks)
  2128.       XmuDisplayQueue *q;
  2129.       Bool docallbacks;
  2130.  
  2131.  
  2132. q      specifies the queue to destroy
  2133.  
  2134. docallbacks
  2135.       specifies whether close functions should be called
  2136.  
  2137. This function releases all memory associated with the speci-
  2138. fied queue.  If docallbacks is True, then the queue's close-
  2139. func callback (if non-NULL) is first called for each display
  2140. in the queue, even though XCloseDisplay is not called on the
  2141. display.
  2142.  
  2143.  
  2144. 14.  Toolkit Convenience Functions
  2145.  
  2146. To use the functions defined in this section, you should
  2147. include the header file <X11/Xmu/Initer.h>.
  2148.  
  2149.  
  2150. void XmuAddInitializer(func, data)
  2151.       void (*func)();
  2152.       caddr_t data;
  2153.  
  2154.  
  2155. func      specifies the procedure to register
  2156.  
  2157. data      specifies private data for the procedure
  2158.  
  2159. This function registers a procedure, to be invoked the first
  2160. time XmuCallInitializers is called on a given application
  2161. context.  The procedure is called with the application con-
  2162. text and the specified data:
  2163.  
  2164.      (*func)(app_con, data)
  2165.  
  2166.  
  2167. void XmuCallInitializers(app_con)
  2168.       XtAppContext app_con;
  2169.  
  2170.  
  2171. app_con   specifies the application context to initialize
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.                 -34-
  2183.  
  2184.  
  2185. This function calls each of the procedures that have been
  2186. registered with XmuAddInitializer, if this is the first time
  2187. the application context has been passed to
  2188. XmuCallInitializers.  Otherwise, this function does nothing.
  2189.  
  2190.  
  2191. 15.  Standard Colormap Functions
  2192.  
  2193. To use the functions defined in this section, you should
  2194. include the header file <X11/Xmu/StdCmap.h>.
  2195.  
  2196.  
  2197. Status XmuAllStandardColormaps(dpy)
  2198.       Display *dpy;
  2199.  
  2200.  
  2201. dpy      specifies the connection to the X server
  2202.  
  2203. To create all of the appropriate standard colormaps for
  2204. every visual of every screen on a given display, use
  2205. XmuAllStandardColormaps.
  2206.  
  2207. This function defines and retains as permanent resources all
  2208. standard colormaps which are meaningful for the visuals of
  2209. each screen of the display.  It returns 0 on failure, non-
  2210. zero on success.  If the property of any standard colormap
  2211. is already defined, this function will redefine it.
  2212.  
  2213. This function is intended to be used by window managers or a
  2214. special client at the start of a session.
  2215.  
  2216. The standard colormaps of a screen are defined by properties
  2217. associated with the screen's root window.  The property
  2218. names of standard colormaps are predefined, and each prop-
  2219. erty name except RGB_DEFAULT_MAP may describe at most one
  2220. colormap.
  2221.  
  2222. The standard colormaps are: RGB_BEST_MAP, RGB_RED_MAP,
  2223. RGB_GREEN_MAP, RGB_BLUE_MAP, RGB_DEFAULT_MAP, and
  2224. RGB_GRAY_MAP.  Therefore a screen may have at most 6 stan-
  2225. dard colormap properties defined.
  2226.  
  2227. A standard colormap is associated with a particular visual
  2228. of the screen.    A screen may have multiple visuals defined,
  2229. including visuals of the same class at different depths.
  2230. Note that a visual id might be repeated for more than one
  2231. depth, so the visual id and the depth of a visual identify
  2232. the visual.  The characteristics of the visual will deter-
  2233. mine which standard colormaps are meaningful under that
  2234. visual, and will determine how the standard colormap is
  2235. defined.  Because a standard colormap is associated with a
  2236. specific visual, there must be a method of determining which
  2237. visuals take precedence in defining standard colormaps.
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.                 -35-
  2249.  
  2250.  
  2251. The method used here is: for the visual of greatest depth,
  2252. define all standard colormaps meaningful to that visual
  2253. class, according to this order of (descending) precedence:
  2254. DirectColor; PseudoColor; TrueColor and GrayScale; and
  2255. finally StaticColor and StaticGray.
  2256.  
  2257. This function allows success, on a per screen basis.  For
  2258. example, if a map on screen 1 fails, the maps on screen 0,
  2259. created earlier, will remain.  However, none on screen 1
  2260. will remain.  If a map on screen 0 fails, none will remain.
  2261.  
  2262. See XmuVisualStandardColormaps for which standard colormaps
  2263. are meaningful under these classes of visuals.
  2264.  
  2265.  
  2266. Status XmuVisualStandardColormaps(dpy, screen, visualid, depth, replace, retain)
  2267.       Display *dpy;
  2268.       int screen;
  2269.       VisualID visualid;
  2270.       unsigned int depth;
  2271.       Bool replace;
  2272.       Bool retain;
  2273.  
  2274.  
  2275. dpy      specifies the connection to the X server
  2276.  
  2277. screen      specifies the screen of the display
  2278.  
  2279. visualid  specifies the visual type
  2280.  
  2281. depth      specifies the visual depth
  2282.  
  2283. replace   specifies whether or not to replace
  2284.  
  2285. retain      specifies whether or not to retain
  2286.  
  2287. To create all of the appropriate standard colormaps for a
  2288. given visual on a given screen, use
  2289. XmuVisualStandardColormaps.
  2290.  
  2291. This function defines all appropriate standard colormap
  2292. properties for the given visual.  If replace is True, any
  2293. previous definition will be removed.  If retain is True, new
  2294. properties will be retained for the duration of the server
  2295. session.  This function returns 0 on failure, non-zero on
  2296. success.  On failure, no new properties will be defined, but
  2297. old ones may have been removed if replace was True.
  2298.  
  2299. Not all standard colormaps are meaningful to all visual
  2300. classes.  This routine will check and define the following
  2301. properties for the following classes, provided that the size
  2302. of the colormap is not too small.  For DirectColor and
  2303. PseudoColor: RGB_DEFAULT_MAP, RGB_BEST_MAP, RGB_RED_MAP,
  2304. RGB_GREEN_MAP, RGB_BLUE_MAP, and RGB_GRAY_MAP.    For
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.                 -36-
  2315.  
  2316.  
  2317. TrueColor and StaticColor: RGB_BEST_MAP.  For GrayScale and
  2318. StaticGray: RGB_GRAY_MAP.
  2319.  
  2320.  
  2321. Status XmuLookupStandardColormap(dpy, screen, visualid, depth, property, replace, retain)
  2322.       Display *dpy;
  2323.       int screen;
  2324.       VisualID visualid;
  2325.       unsigned int depth;
  2326.       Atom property;
  2327.       Bool replace;
  2328.       Bool retain;
  2329.  
  2330.  
  2331. dpy      specifies the connection to the X server
  2332.  
  2333. screen      specifies the screen of the display
  2334.  
  2335. visualid  specifies the visual type
  2336.  
  2337. depth      specifies the visual depth
  2338.  
  2339. property  specifies the standard colormap property
  2340.  
  2341. replace   specifies whether or not to replace
  2342.  
  2343. retain      specifies whether or not to retain
  2344.  
  2345. To create a standard colormap if one does not currently
  2346. exist, or replace the currently existing standard colormap,
  2347. use XmuLookupStandardColormap.
  2348.  
  2349. Given a screen, a visual, and a property, this function will
  2350. determine the best allocation for the property under the
  2351. specified visual, and determine the whether to create a new
  2352. colormap or to use the default colormap of the screen.
  2353.  
  2354. If replace is True, any previous definition of the property
  2355. will be replaced.  If retain is True, the property and the
  2356. colormap will be made permanent for the duration of the
  2357. server session.  However, pre-existing property definitions
  2358. which are not replaced cannot be made permanent by a call to
  2359. this function; a request to retain resources pertains to
  2360. newly created resources.
  2361.  
  2362. This function returns 0 on failure, non-zero on success.  A
  2363. request to create a standard colormap upon a visual which
  2364. cannot support such a map is considered a failure.  An exam-
  2365. ple of this would be requesting any standard colormap prop-
  2366. erty on a monochrome visual, or, requesting an RGB_BEST_MAP
  2367. on a display whose colormap size is 16.
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.                 -37-
  2381.  
  2382.  
  2383. Status XmuGetColormapAllocation(vinfo, property, red_max, green_max, blue_max)
  2384.       XVisualInfo *vinfo;
  2385.       Atom property;
  2386.       unsigned long *red_max, *green_max, *blue_max;
  2387.  
  2388.  
  2389. vinfo      specifies visual information for a chosen visual
  2390.  
  2391. property  specifies one of the standard colormap property
  2392.       names
  2393.  
  2394. red_max   returns maximum red value
  2395.  
  2396. green_max returns maximum green value
  2397.  
  2398. blue_max  returns maximum blue value
  2399.  
  2400. To determine the best allocation of reds, greens, and blues
  2401. in a standard colormap, use XmuGetColormapAllocation.
  2402.  
  2403. XmuGetColormapAllocation returns 0 on failure, non-zero on
  2404. success.  It is assumed that the visual is appropriate for
  2405. the colormap property.
  2406.  
  2407.  
  2408. XStandardColormap *XmuStandardColormap(dpy, screen, visualid, depth, property,
  2409.                        cmap, red_max, green_max, blue_max)
  2410.       Display dpy;
  2411.       int screen;
  2412.       VisualID visualid;
  2413.       unsigned int depth;
  2414.       Atom property;
  2415.       Colormap cmap;
  2416.       unsigned long red_max, green_max, blue_max;
  2417.  
  2418.  
  2419. dpy      specifies the connection to the X server
  2420.  
  2421. screen      specifies the screen of the display
  2422.  
  2423. visualid  specifies the visual type
  2424.  
  2425. depth      specifies the visual depth
  2426.  
  2427. property  specifies the standard colormap property
  2428.  
  2429. cmap      specifies the colormap ID, or None
  2430.  
  2431. red_max   specifies the red allocation
  2432.  
  2433. green_max specifies the green allocation
  2434.  
  2435. blue_max  specifies the blue allocation
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.                 -38-
  2447.  
  2448.  
  2449. To create any one standard colormap, use
  2450. XmuStandardColormap.
  2451.  
  2452. This function creates a standard colormap for the given
  2453. screen, visualid, and visual depth, with the given red,
  2454. green, and blue maximum values, with the given standard
  2455. property name.    Upon success, it returns a pointer to an
  2456. XStandardColormap structure which describes the newly cre-
  2457. ated colormap.    Upon failure, it returns NULL.    If cmap is
  2458. the default colormap of the screen, the standard colormap
  2459. will be defined on the default colormap; otherwise a new
  2460. colormap is created.
  2461.  
  2462. Resources created by this function are not made permanent;
  2463. that is the caller's responsibility.
  2464.  
  2465.  
  2466. Status XmuCreateColormap(dpy, colormap)
  2467.       Display *dpy;
  2468.       XStandardColormap *colormap;
  2469.  
  2470.  
  2471. dpy      specifies the connection under which the map is
  2472.       created
  2473.  
  2474. colormap  specifies the map to be created
  2475.  
  2476. To create any one colormap which is described by an XStan-
  2477. dardColormap structure, use XmuCreateColormap.
  2478.  
  2479. This function returns 0 on failure, and non-zero on success.
  2480. The base_pixel of the colormap is set on success.  Resources
  2481. created by this function are not made permanent.  No argu-
  2482. ment error checking is provided; use at your own risk.
  2483.  
  2484. All colormaps are created with read-only allocations, with
  2485. the exception of read-only allocations of colors which fail
  2486. to return the expected pixel value, and these are individu-
  2487. ally defined as read/write allocations.  This is done so
  2488. that all the cells defined in the colormap are contiguous,
  2489. for use in image processing.  This typically happens with
  2490. White and Black in the default map.
  2491.  
  2492. Colormaps of static visuals are considered to be success-
  2493. fully created if the map of the static visual matches the
  2494. definition given in the standard colormap structure.
  2495.  
  2496.  
  2497. void XmuDeleteStandardColormap(dpy, screen, property)
  2498.       Display *dpy;
  2499.       int screen;
  2500.       Atom property;
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.                 -39-
  2513.  
  2514.  
  2515. dpy      specifies the connection to the X server
  2516.  
  2517. screen      specifies the screen of the display
  2518.  
  2519. property  specifies the standard colormap property
  2520.  
  2521. To remove any standard colormap property, use
  2522. XmuDeleteStandardColormap.  This function will remove the
  2523. specified property from the specified screen, releasing any
  2524. resources used by the colormap(s) of the property, if possi-
  2525. ble.
  2526.  
  2527.  
  2528. 16.  Widget Description Functions
  2529.  
  2530. The functions defined in this section are for building a
  2531. description of the structure of and resources associated
  2532. with a hierarchy of widget classes.  This package is typi-
  2533. cally used by applications that wish to manipulate the wid-
  2534. get set itself.
  2535.  
  2536. The definitions needed to use these interfaces are in the
  2537. header file <X11/Xmu/WidgetNode.h>.  The following function
  2538. must be called before any of the others described below:
  2539.  
  2540.  
  2541. void XmuWnInitializeNodes(node_array, num_nodes)
  2542.       XmuWidgetNode *node_array;
  2543.       int num_nodes;
  2544.  
  2545.  
  2546. node_array
  2547.       specifies a list of widget classes, in alphabeti-
  2548.       cal order
  2549.  
  2550. num_nodes specfies the number of widget classes in the node
  2551.       array
  2552.  
  2553. To determine the resources provided by a widget class or
  2554. classes, use
  2555.  
  2556.  
  2557. void XmuWnFetchResources(node, toplevel, top_node)
  2558.       XmuWidgetNode *node;
  2559.       Widget toplevel;
  2560.       XmuWidgetNode *top_node;
  2561.  
  2562.  
  2563. node      specifies the widget class for which resources
  2564.       should be obtained.
  2565.  
  2566. toplevel  specifies the widget that should be used for cre-
  2567.       ating an instance of node from which resources are
  2568.       extracted.  This is typically the value returned
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.                 -40-
  2579.  
  2580.  
  2581.       by XtAppInitialize.
  2582.  
  2583. top_node  specifies the ancestor of node that should be
  2584.       treated as the root of the widget inheritance tree
  2585.       (used in determining which ancestor contributed
  2586.       which resources).
  2587.  
  2588. Each widget class inherits the resources of its parent.  To
  2589. count the number of resources contributed by a particular
  2590. widget class, use:
  2591.  
  2592.  
  2593. int XmuWnCountOwnedResources(node, owner_node, constraints)
  2594.       XmuWidgetNode *node;
  2595.       XmuWidgetNode *owner_node;
  2596.       Bool constraints;
  2597.  
  2598.  
  2599. node      specifies the widget class whose resources are
  2600.       being examined.
  2601.  
  2602. owner_node
  2603.       specifies the widget class of the ancestor of node
  2604.       whose contributions are being counted.
  2605.  
  2606. constraints
  2607.       specifies whether or not to count constraint
  2608.       resources or normal resources.
  2609.  
  2610. This routine returns the number of resources contributed (or
  2611. ``owned'') by the specified widget class.
  2612.  
  2613.  
  2614. XmuWidgetNode *XmuWnNameToNode(node_list, num_nodes, name)
  2615.       XmuWidgetNode *node_list;
  2616.       int num_nodes;
  2617.       char *name;
  2618.  
  2619.  
  2620. node_list specifies a list of widget nodes
  2621.  
  2622. num_nodes specifies the number of nodes in the list
  2623.  
  2624. name      specifies the name of the widget class in the node
  2625.       list to search for
  2626.  
  2627. This function returns the WidgetNode in the list that
  2628. matches the given widget name or widget class name.  If no
  2629. match is found, it returns NULL.
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.                 -41-
  2645.  
  2646.  
  2647. 17.  Participation in the Editres Protocol
  2648.  
  2649. To participate in the editres protocol, applications which
  2650. are not based on the Athena widget set should include the
  2651. header file <X11/Xmu/Editres.h>.
  2652.  
  2653. To participate in the editres protocol, Xt applications
  2654. which do not rely on the Athena widget set should register
  2655. the editres protocol handler on each shell widget in the
  2656. application, specifying an event mask of 0, nonmaskable
  2657. events, and client data as NULL:
  2658.  
  2659. XtAddEventHandler(shell, (EventMask) 0, True, _XEd-
  2660. itResCheckMessages, NULL);
  2661.  
  2662.  
  2663.  
  2664.  
  2665.  
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.