EZwgl provides a very limited support for application resources. In particular, there is no automatic type conversion facility as seen in Xt. As a result, in order to set application variables from resources, the application writer must provide ways to convert resource values (strings) to the desired data types.
Nevertheless, EZwgl includes a few functions that may be helpful for those who wants to use application resources.
One special data type is introduced for the purpose of doing simple type conversions.
typedef struct EZ_Value_ int type; /* value type: EZ_INT, EZ_FLOAT, EZ_POINTER, EZ_ULONG */ union int i; float f; void *p; unsigned long l; value; EZ_Value;
The few relevent functions are:
void EZ_InstallSymbol(char *name, EZ_Value value)
, this function
installs the name-value
pair in an internal table for later
lookup.
EZ_Value *EZ_RetrieveSymbol(char *name)
, this function
retrieves the value corresponding to name
from the internal
lookup table.
int EZ_GetApplicationResource(char *rname, char **value_ret)
, this
function gets the resource value for the application resource named
rname
.
int EZ_GetWidgetResource(EZ_Widget *w, char *rname, char **v_ret)
,
this function retrieve the widget resource value for widget w
and resource name rname
.
char *EZ_GetInstanceName()
, char *EZ_GetClassName()
,
these two functions retrieve the instanceName and className of the
application respectively.
There are also four pairs of convenience routines for
EZ_InstallSymbol
, then are
int EZ_InstallSymbolicInt (char *name, int value); int EZ_RetrieveSymbolicInt (char *name, int *value_ret); int EZ_InstallSymbolicFloat (char *name, float value); int EZ_RetrieveSymbolicFloat (char *name, float *value_ret); int EZ_InstallSymbolicPointer (char *name, void *value); int EZ_RetrieveSymbolicPointer (char *name, void **value_ret); int EZ_InstallSymbolicULong (char *name, unsigned long value); int EZ_RetrieveSymbolicULong (char *name, unsigned long *value_ret);