SDK X11 R4.11MU05 XmGetSecondaryResourceData(3X)
NAME
XmGetSecondaryResourceData--A function that provides access to
secondary widget resource data
SYNOPSIS
#include <Xm/Xm.h>
Cardinal XmGetSecondaryResourceData (widgetclass, secondarydatareturn)
WidgetClass widgetclass;
XmSecondaryResourceData**secondarydatareturn;
DESCRIPTION
Some Motif widget classes (such as Gadget, Text, and VendorShell)
have resources that are not accessible via the functions
XtGetResourceList and XtGetConstraintResourceList. In order to
retrieve the descriptions of these resources, an application must use
XmGetSecondaryResourceData.
When a widget class has such resources, this function provides
descriptions of the resources in one or more data structures.
XmGetSecondaryResourceData takes a widget class argument and returns
the number of these data structures associated with the widget class.
If the return value is greater than 0, the function allocates and
fills an array of pointers to the corresponding data structures. It
returns this array at the address that is the value of the
secondarydatareturn argument.
The type XmSecondaryResourceData is a pointer to a structure with two
members that are useful to an application: resources, of type
XtResourceList, and numresources, of type Cardinal. The resources
member is a list of the widget resources that are not accessible
using Xt functions. The numresources member is the length of the
resources list.
If the return value is greater than 0, XmGetSecondaryResourceData
allocates memory that the application must free. Use XtFree to free
the resource list in each structure (the value of the resources
member), the structures themselves, and the array of pointers to the
structures (the array whose address is secondarydatareturn).
widgetclass
Specifies the widget class for which secondary resource data
is to be retrieved.
secondarydatareturn
Specifies a pointer to an array of XmSecondaryResourceData
pointers to be returned by this function. If the widget
class has no secondary resource data (i.e., if the value
returned by the function is 0), the function returns no
meaningful value for this argument.
RETURN VALUE
Returns the number of secondary resource data structures associated
with this widget class.
EXAMPLE
The following example uses XmGetSecondaryResourceData to print the
names of the secondary resources of the Motif Text widget and then
frees the data allocated by the function:
XmSecondaryResourceData * blockarray ;
Cardinal numblocks, i, j ;
if (numblocks = XmGetSecondaryResourceData (xmTextWidgetClass,
&blockarray)) {
for (i = 0; i < numblocks; i++) {
for (j = 0 ; j < blockarray[i]->numresources; j++) {
printf("%s\n", blockarray[i]->resources[j].resourcename);
}
XtFree((char*)blockarray[i]->resources);
XtFree((char*)blockarray[i]);
}
XtFree((char*)blockarray);
}
Licensed material--property of copyright holder(s)