VkGetResource(3x)VkGetResource(3x)NAMEVkGetResource - Convenience functions for retrieving resources
HEADER FILE
#include <Vk/VkResource.h>
FUNCTIONS
char * VkGetResource(const char *name,
const char *className);
XtPointer VkGetResource(Widget w,
const char *names,
const char *classNames,
const char *desiredType,
const char *defaultValue);
DESCRIPTION
These functions provide simple ways to retrieve resources. The
first form retrieves a resource by name and class name from the
application's resource database relative to the entire application.
The second form allows applications to retrieve a a resource
relative to a specific widget. The resource can be specified as a
dot-separated list of names and classes, allowing "virtual" sub-
resources to be retrieved. The second form also allows a target
type to be specified. VkGetResource will convert the retrieved
value, (or the default value if no value is retrieved), to the
specified type.
EXAMPLES
Suppose an application wishes to draw an image and wishes to allow
the user to select various aspects of the style in which the image
is drawn. For example, each style might include a color and fill
pattern (a pixmap) with which it is drawn. Each aspect of each
style could be specified as a resource which could be retrieved as
follows.
Widget shell = XtAppInitialize(/* args */ );
Widget canvas = XmCreateDrawingArea(shell, "canvas",
NULL, 0);
Pixel fgOne = (Pixel) VkGetResource(canvas,
"styleOne.foreground",
"Style.Foreground",
XmRString, "Black");
Pixel fgTwo = (Pixel) VkGetResource(canvas,
"styleTwo.foreground",
"Style.Foreground",
XmRString, "Black");
Page 1
VkGetResource(3x)VkGetResource(3x)
Pixel fgThree = (Pixel) VkGetResource(canvas,
"styleThree.foreground",
"Style.Foreground",
XmRString, "Black");
Pixel bgOne = (Pixel) VkGetResource(canvas,
"styleOne.background",
"Style.Background",
XmRString, "White");
Pixel bgTwo = (Pixel) VkGetResource(canvas,
"styleTwo.background",
"Style.Background",
XmRString, "White");
Pixel bgThree = (Pixel) VkGetResource(canvas,
"styleThree.background",
"Style.Background",
XmRString, "White");
Pixmap pixOne = (Pixmap) VkGetResource(canvas,
"styleOne.pixmap",
"Style.Pixmap",
XmRString, "background");
Pixmap pixTwo = (Pixmap) VkGetResource(canvas,
"styleTwo.pixmap",
"Style.Pixmap",
XmRString, "background");
Pixmap pixThree = (Pixmap) VkGetResource(canvas,
"styleThree.pixmap",
"Style.Pixmap",
XmRString, "background");
These calls attempt to load a resource by the complete resource
specification:
shell.canvas.styleOne.foreground
and so on. All of the usual wild card uses apply. Data returned by
VkGetResource() should not be freed.
SEE ALSO
ViewKit Programmer's Guide
The X Window System, DEC Press, Bob Sheifler and Jim Gettys
The X Window System Toolkit, DEC Press, Paul Asente and Ralph Swick
The OSF/Motif Programmers Reference, Prentice Hall, OSF
Page 2