Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ XtGetSubres(3x) — HP-UX 9.10

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

XtGetApplicationResources(1)

XtGetSubvalues(1)

XtSetSubvalues(1)

XtVaGetSubresources(1)

get_values_hook(4)

set_values(4)

 

NAME

XtGetSubresources − get subpart values from the resource database. 

Synopsis

void XtGetSubresources(object, base, subpart_name, subpart_class, resources, num_resources, args, num_args)

    Widget object;
    XtPointer base;
    String subpart_name;
    String subpart_class;
    XtResourceList resources;
    Cardinal num_resources;
    ArgList args;
    Cardinal num_args;

Inputs

objectSpecifies the object used to qualify the subpart resource name and class; may be of class Object or any subclass thereof. 

baseSpecifies the base address of the subpart data structure into which the resource values will be written. 

subpart_name
Specifies the resource name of the subpart.

subpart_class
Specifies the resource class name of the subpart.

resourcesSpecifies the resource list for the subpart. 

num_resources
Specifies the number of resources in the resource list.

argsSpecifies the argument list to override any other resource specifications. 

num_argsSpecifies the number of arguments in the argument list. 

Outputs

baseReturns the resource values from the argument list, the resource database, or the resource list defaults. 

Description

XtGetSubresources() is similar to XtGetApplicationResources().  It retrieves resource values for "subparts" of a widget or object that are not themselves widgets or objects.  For each resource in resources, XtGetSubresources() sets a value in the structure pointed to by base.  This value comes from the argument list args, or if no value for the resource is found in the argument list, from the resource database associated with object, or if no value is found in the database, from the default_addr field of the resource itself.  Once the value is determined, it is copied into the structure at base using the resource_offset and resource_size fields of the resource.  The database is searched for resources that appear beneath the specified object in the name hierarchy−subpart resources should be specified in a database as if as if the subpart were a child object, with name subpart_name and class subpart_class.  XtGetSubresources() may overwrite the specified resource list with an equivalent representation in an internal format that optimizes access time if the list is used repeatedly.  The resource list must be allocated in writable storage and the caller must not modify the list contents after the call if the same list is to be used again.  Any per-display resources fetched by XtGetSubresources() will not be freed from the resource cache until the display is closed.  See XtGetApplicationResources() for an explanation and example of how to create a resource list. 

Usage

Using subparts in a widget or object can be a useful way to modularize that object.  The Release 3 Athena Text widget, for example, had subparts for its data source and data sink.  In Release 4 and later, however, it is often easier to use non-widget objects instead of subparts.  The Athena Text widget now uses this approach.  If you use subpart resources, the user will see the subpart hierarchy and will automatically be able to set subpart resources from a resource file.  To allow the user to set and query subpart resources using the standard C XtSetValues()/XtGetValues() interface, however, your widget’s set_values() (or set_values_hook() prior to Release 4) method must call XtSetSubvalues() and your get_values_hook() method must call XtGetSubvalues().  An alternative is to provide public functions with your widget to set and query subpart values.  Note that XtGetSubresources() differs from XtGetApplicationResources() in that it looks for resources in a named "subpart" of object, rather than resources that appear at the same level in the hierarchy as object’s own resources.  You can use XtVaGetSubresources() to get subpart resource values using a variable length argument list rather than a single ArgList argument. 

Structures

XtResource is defined as follows:

typedef struct _XtResource {
   String    resource_name;  /* Resource name */
   String    resource_class; /* Resource class */
   String    resource_type;  /* Representation type desired */
   Cardinal  resource_size;  /* Size in bytes of representation */
   Cardinal  resource_offset;/* Offset from base to put resource value */
   String    default_type;   /* Representation type of specified default */
   XtPointer default_addr;   /* Address of resource default value */
} XtResource, XtResourceList;

An Arg is defined as follows:

typedef struct {
    String name;
    XtArgVal value;
} Arg, *ArgList;

See Also

XtGetApplicationResources(1), XtGetSubvalues(1), XtSetSubvalues(1), XtVaGetSubresources(1),
get_values_hook(4), set_values(4). 

Copyright O’Reilly & Assoc.  —  X Toolkit Intrinsics Reference Manual © O’Reilly & Associates

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026