NAME
XmuCvtStringToMisc — convert strings to various types.
SYNOPSIS
#include <X11/Xmu/Converters.h>
XtAddConverter(XtRString, XtRBackingStore, XmuCvtStringToBackingStore, NULL, 0); XtAddConverter(XtRString, XtRGravity, XmuCvtStringToGravity, NULL, 0); XtAddConverter(XtRString, XtRJustify, XmuCvtStringToJustify, NULL, 0); XtAddConverter(XtRString, XtRLong, XmuCvtStringToLong, NULL, 0); XtAddConverter(XtRString, XtROrientation, XmuCvtStringToOrientation, NULL, 0); XtSetTypeConverter(XtRString, XtRShapeStyle,XmuCvtStringToShapeStyle,
NULL, 0, XtCacheNone, NULL);
static XtConvertArgRec screenConvertArg[] = {
{XtBaseOffset, (XtPointer)XtOffset(Widget, core.screen), sizeof(Screen ∗)} };
XtAddConverter(XtRString, XtRBitmap, XmuCvtStringToBitmap,
screenConvertArg, XtNumber(screenConvertArg));
static XtConvertArgRec screenConvertArg[] = {
{XtBaseOffset, (XtPointer)XtOffset(WidgetRec, core.screen), sizeof(Screen ∗)} };
XtAddConverter(XtRString, XtRCursor, XmuCvtStringToCursor,
screenConvertArg, XtNumber(screenConvertArg));
static XtConvertArgRec parentCvtArg[] = {
{XtBaseOffset, (XtPointer)XtOffset(Widget, core.parent), sizeof(Widget)}, };
XtAddConverter(XtRString, XtRWidget, XmuCvtStringToWidget,
parentCvtArg, XtNumber(parentCvtArg));
static XtConvertArgRec colorCursorConvertArgs[] = {
{XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec, core.screen),
sizeof(Screen ∗)},
{XtResourceString, (XtPointer) XtNpointerColor,sizeof(Pixel)},
{XtResourceString, (XtPointer) XtNpointerColorBackground, sizeof(Pixel)},
{XtWidgetBaseOffset, (XtPointer) XtOffsetOf(WidgetRec,core.colormap),
sizeof(Colormap)} };
XtSetTypeConverter(XtRString, XtRColorCursor, XmuCvtStringToColorCursor,
colorCursorConvertArgs, XtNumber(colorCursorConvertArgs),
XtCacheByDisplay, NULL);
AVAILABILITY
XmuCvtStringToColorCursor() and XmuCvtStringToGravity() are new in Release 5.
DESCRIPTION
These functions are type converters that convert from strings to various resource types. Some require additional arguments, but most may be registered without any arguments. Two of these functions are X11R4 "new-style" converters registered with XtSetTypeConverter(); the rest are "old-style" converters registered with XtAddConverter() or XtAppAddConverter().
XmuCvtStringToBackingStore() converts a string to a backing-store integer as defined in <X11/X.h>. The string "notUseful" converts to NotUseful, "whenMapped" converts to WhenMapped, and "always" converts to Always. The string "default" converts to the value Always + WhenMapped + NotUseful. The case of the string does not matter.
XmuCvtStringToGravity() converts a string to an XtGravity enumeration value. The string "forget" or a NULL value convert to ForgetGravity, "NorthWestGravity" converts to NorthWestGravity, the strings "NorthGravity" and "top" convert to NorthGravity, "NorthEastGravity" converts to NorthEastGravity, the strings "West" and "left" convert to WestGravity, "CenterGravity" converts to CenterGravity, "EastGravity" and "right" convert to EastGravity, "SouthWestGravity" converts to SouthWestGravity, "SouthGravity" and "bottom" convert to SouthGravity, "SouthEastGravity" converts to SouthEastGravity, "StaticGravity" converts to StaticGravity, and "UnmapGravity" converts to UnmapGravity. The case of the string does not matter.
XmuCvtStringToJustify() converts a string to an XtJustify enumeration value. The string "left" converts to XtJustifyLeft, "center" converts to XtJustifyCenter, and "right" converts to XtJustifyRight. The case of the string does not matter.
XmuCvtStringToLong() converts a string to an integer of type long. It parses the string using sscanf with a format of "%ld."
XmuCvtStringToOrientation() converts a string to an XtOrientation enumeration value. The string "horizontal" converts to XtorientHorizontal and "vertical" converts to XtorientVertical. The case of the string does not matter.
XmuCvtStringToShapeStyle() converts a string to an integer shape style. The string "rectangle" converts to XmuShapeRectangle, "oval" converts to XmuShapeOval, "ellipse" converts to XmuShapeEllipse, and "roundedRectangle" converts to XmuShapeRoundedRectangle. The case of the string does not matter.
XmuCvtStringToBitmap() creates a bitmap (a Pixmap of depth one) suitable for window manager icons. The string argument is the name of a file in standard bitmap file format. For the possible filename specifications, see the reference page for XmuLocateBitmapFile().
XmuCvtStringToCursor() converts a string to a Cursor. The string can either be a standard cursor name formed by removing the XC_ prefix from any of the cursor defines listed in Appendix I of Volume Two, a font name and glyph index in decimal of the form "FONT fontname index [[font] index]," or a bitmap filename acceptable to XmuLocateBitmapFile().
XmuCvtStringToWidget() converts a string to an immediate child widget of the parent widget passed as an argument. Note that this converter only works for child widgets that have already been created; there is no lazy evaluation. The string is first compared against the names of the normal and popup children, and if a match is found the corresponding child is returned. If no match is found, the string is compared against the classes of the normal and popup children, and if a match is found the corresponding child is returned. The case of the string is significant. The converter XmuNewConvertStringToWidget() performs the same conversion, but allows greater control over the type of caching that will be done on the result of the conversion. Because widget trees are often dynamic in an application, it is usually inappropriate to cache string-to-widget conversion results as is done with XmuCvtStringToWidget().
XmuCvtStringToColorCursor() converts a string to a Cursor with the foreground and background pixels specified by the conversion arguments. The string can either be a standard cursor name formed by removing the XC_ prefix from any of the cursor defines listed in Appendix I of Volume Two, a font name and glyph index (in base 10) of the form "FONT fontname index [[font] index]," or a bitmap filename acceptable to XmuLocateBitmapFile().
SEE ALSO
XtAddConverter(1), XtAppAddConverter(1), XtSetTypeConverter(1),
XmuCvtFunctionToCallback(6), XmuNewCvtStringToWidget(6).