Skip to content

Widget Description Functions

The functions defined in this section are for building a description of the structure of and resources associated with a hierarchy of widget classes. This package is typically used by applications that wish to manipulate the widget set itself.

The definitions needed to use these interfaces are in the header file <X11/Xmu/WidgetNode.h> . To call these functions, you need to link against the libXmu library. The following function must be called before any of the others described below:

void XmuWnInitializeNodes(XmuWidgetNode *node_array, int num_nodes);
void XmuWnInitializeNodes(XmuWidgetNode *node_array, int num_nodes);

node_array

specifies a list of widget classes, in alphabetical order

num_nodes

specifies the number of widget classes in the node array

To determine the resources provided by a widget class or classes, use

void XmuWnFetchResources(XmuWidgetNode *node, Widget toplevel, XmuWidgetNode *top_node);
void XmuWnFetchResources(XmuWidgetNode *node, Widget toplevel, XmuWidgetNode *top_node);

node

specifies the widget class for which resources should be obtained.

toplevel

specifies the widget that should be used for creating an instance of node from which resources are extracted. This is typically the value returned by XtAppInitialize.

top_node

specifies the ancestor of node that should be treated as the root of the widget inheritance tree (used in determining which ancestor contributed which resources).

Each widget class inherits the resources of its parent. To count the number of resources contributed by a particular widget class, use:

int XmuWnCountOwnedResources(XmuWidgetNode *node, XmuWidgetNode *owner_node, Bool constraints);
int XmuWnCountOwnedResources(XmuWidgetNode *node, XmuWidgetNode *owner_node, Bool constraints);

node

specifies the widget class whose resources are being examined.

owner_node

specifies the widget class of the ancestor of node whose contributions are being counted.

constraints

specifies whether or not to count constraint resources or normal resources.

This routine returns the number of resources contributed (or “owned”) by the specified widget class.

XmuWidgetNode *XmuWnNameToNode(XmuWidgetNode *node_list, int num_nodes, char *name);
XmuWidgetNode *XmuWnNameToNode(XmuWidgetNode *node_list, int num_nodes, char *name);

node_list

specifies a list of widget nodes

num_nodes

specifies the number of nodes in the list

name

specifies the name of the widget class in the node list to search for

This function returns the WidgetNode in the list that matches the given widget name or widget class name. If no match is found, it returns NULL.