1XmGetSecondaryResourceData(library callX)mGetSecondaryResourceData(library call)
2
3
4
6 XmGetSecondaryResourceData — A function that provides access to sec‐
7 ondary widget resource data
8
10 #include <Xm/Xm.h>
11 Cardinal XmGetSecondaryResourceData(
12 WidgetClass widget_class,
13 XmSecondaryResourceData **secondary_data_return);
14
16 Some Motif widget classes (such as Gadget, Text, and VendorShell) have
17 resources that are not accessible through the functions XtGetRe‐
18 sourceList and XtGetConstraintResourceList. In order to retrieve the
19 descriptions of these resources, an application must use XmGetSec‐
20 ondaryResourceData.
21
22 When a widget class has such resources, this function provides descrip‐
23 tions of the resources in one or more data structures. XmGetSec‐
24 ondaryResourceData takes a widget class argument and returns the number
25 of these data structures associated with the widget class. If the
26 return value is greater than 0 (zero), the function allocates and fills
27 an array of pointers to the corresponding data structures. It returns
28 this array at the address that is the value of the sec‐
29 ondary_data_return argument.
30
31 The type XmSecondaryResourceData is a pointer to a structure with two
32 members that are useful to an application: resources, of type XtRe‐
33 sourceList, and num_resources, of type Cardinal. The resources member
34 is a list of the widget resources that are not accessible using Xt
35 functions. The num_resources member is the length of the resources
36 list.
37
38 If the return value is greater than 0 (zero), XmGetSecondaryResource‐
39 Data allocates memory that the application must free. Use XtFree to
40 free the resource list in each structure (the value of the resources
41 member), the structures themselves, and the array of pointers to the
42 structures (the array whose address is secondary_data_return).
43
44 widget_class
45 Specifies the widget class for which secondary resource data
46 is to be retrieved.
47
48 secondary_data_return
49 Specifies a pointer to an array of XmSecondaryResourceData
50 pointers to be returned by this function. If the widget
51 class has no secondary resource data, for example, if the
52 value returned by the function is 0 (zero), the function
53 returns no meaningful value for this argument.
54
56 Returns the number of secondary resource data structures associated
57 with this widget class.
58
60 The following example uses XmGetSecondaryResourceData to print the
61 names of the secondary resources of the Motif Text widget and then
62 frees the data allocated by the function:
63
64 XmSecondaryResourceData * block_array;
65 Cardinal num_blocks, i, j;
66 if (num_blocks = XmGetSecondaryResourceData (xmTextWidgetClass,
67 &block_array)) {
68 for (i = 0; i < num_blocks; i++) {
69 for (j = 0; j < block_array[i]->num_resources; j++) {
70 printf("%s\n", block_array[i]->resources[j].resource_name);
71 }
72 XtFree((char*)block_array[i]->resources);
73 XtFree((char*)block_array[i]);
74 }
75 XtFree((char*)block_array);
76 }
77
78 XmGetSecondaryResourceData(library call)