DragonFly On-Line Manual Pages

Search: Section:  


EZ_RegisterApplicationResources(3)                             EZWGL Functions

NAME

EZ_RegisterApplicationResources - register a list of application resources

SYNOPSIS

#include <EZ.h> void EZ_RegisterApplicationResources( int nresources, EZ_ResourceSpec resources, int (configure)(void*notUsed,intoption,EZ_Value*values)) typedef struct { int option; /* reference index, must > 1024 */ char *iname; /* resource name */ char *cname; /* resource class */ char *vtypes; /* value types, e.g "int,float,string" */ } EZ_ResourceSpec; typedef struct { int type; union { char c; unsigned char uc; short s; unsigned short us; int i; unsigned int ui; float f; void *p; void *function; char *str; unsigned long l; } value; } EZ_Value;

ARGUMENTS

resources Specifies a list of resources. nresources Specifies the number of resources. configure Specifies a procedure that sets the values of application variable from resources.

DESCRIPTION

EZ_RegisterApplicationResources registers a list of application resources. Its purpose is to set application variables from resources. See the example below for its usage. Only global variables can be set via resources. An Example #include "EZ.h"; static int int1 = 0, int2 = 0; /* var set by resources */ static float float2 = 0; static EZ_ResourceSpec exampleResources[] = { { 1234, "aPairOfInt", "APairOfInt", "int,int" }, { 1235, "intFloat", "IntFloat", "int,float" }, }; int configure(EZ_Widget *notused, int option, EZ_Value *values) { switch(option) { case 1: int1 = values[0].value.i; int2 = values[1].value.i; break; case 2: int1 = values[0].value.i; float2 = values[1].value.f; break; default: break; } } main(int ac, char **av) { EZ_Initialize(ac, av, 1); EZ_RegisterApplicationResources(2, exampleResources, configure); printf("int1=%d, int2=%d, float2=%f0, int1, int2, float2); /* more stuff ... */ }

SEE ALSO

EZ_RegisterResourcesWidget(3) EZWGL EZ_RegisterApplicationResources(3)

Search: Section: