Next: Going Further, Up: Part V Resources for Forms Library [Contents][Index]
At the moment all built-in XForms resources have a top level class
name XForm
and a resource name xform
. Because of this
incomplete specification most of the current resources are "global",
in the sense that they affect all form windows. Eventually all
resources will be fully resolved, e.g., to specify attribute
foo
of form formName
, the resource name can be
appName.formName.foo
instead of (the current incomplete)
appName.xform.foo
.
The argument app_opt
passed to fl_initialize()
is
a table of structures listing your applications command line options.
The structure is defined as follows
typedef struct { char * option; char * specifier; XrmOptionKind argKind; void * value; } XrmOptionDescList, FL_CMD_OPT;
See XrmGetResource()
for details.
After the initialization routine is called all command line arguments,
both XForms built-in and application specific ones, are removed from
argc
and argv
and parsed into a standard XResources
database. To read your application specific options follow
fl_initialize()
with the following routine
void fl_get_app_resources(FL_RESOURCE *resource, int nresources);
Here resource
is a table containing application specific
resources in the following format:
typedef struct { char * res_name; /* resource name without application name */ char * res_class; /* resource class */ FL_RTYPE type; /* C type of the variable */ void * var /* variable that will hold the value */ char * defval; /* default value in string form */ int nbytes; /* buffer size for string var. */ } FL_RESOURCE;
and the resource type FL_RTYPE
type is one of the following
FL_SHORT
FL_BOOL
FL_INT
FL_LONG
FL_FLOAT
FL_STRING
FL_NONE
for variables not to be used (or not available)
Note that the variable for FL_BOOL
must be of type int. It
differs from FL_INT
only in the way the resources are
converted, not in the way their values are stored. A boolean variable
is considered to be true (1) if any one of True
, true
,
Yes
, yes
, On
, on
, or 1 is specified as its
value. For string variables, the length for the destination buffer
must be specified.
fl_get_app_resources()
simply looks up all entries
specified in the FL_RESOURCE
structure in all databases after
prefixing the resource name with the application name, which can be
the new name introduced by the -name
command line option.
Summarized below are the currently recognized Forms Library built-in resources:
Resource Name | Class | Type | Default values |
---|---|---|---|
rgamma | Gamma | float | 1.0 |
ggamma | Gamma | float | 1.0 |
bgamma | Gamma | float | 1.0 |
visual | Visual | string | best |
depth | Depth | int | best |
doubleBuffer | DoubleBuffer | bool | true |
privateColormap | PrivateColormap | bool | false |
standardColormap | StandardColormap | bool | false |
sharedColormap | SharedColormap | bool | false |
pupFontSize | PupFontSize | int | 12pt |
buttonFontSize | FontSize | int | 10pt |
sliderFontSize | FontSize | int | 10pt |
inputFontSize | FontSize | int | 10pt |
browserFontSize | FontSize | int | 10pt |
menuFontSize | FontSize | int | 10pt |
choiceFontSize | FontSize | int | 10pt |
ulPropWidth | ULPropWidth | bool | true |
ulThickness | ULThickness | int | 1 |
scrollbarType | ScrollbarType | string | thin |
coordUnit | CoordUnit | string | pixel |
borderWidth | BorderWidth | int | 1 |
Again, "best" means that the Forms Library by default selects a visual that has the most depth.
By default, resource files are read and merged in the order as suggested by X11 R5 as follows:
RESOURCE_MANAGER
property as set using xrdb
if
RESOURCE_MANAGER
is empty, ~/.Xdefaults
$XENVIRONMENT
if $XENVIORONMENT
is empty,
~/.Xdefaults-hostname
All options set via resources may not be the final values used because
resource settings are applied at the time an object/form is created,
thus any modifications after that override the resource settings. For
example buttonLabelSize
, if set, is applied at the time the
button is created (fl_add_button()
). Thus altering the
size after the button is created via
fl_set_object_lsize()
overrides whatever is set by the
resource database.
To run your application in PseudoColor
with a depth of 8 and a
thicker underline, specify the following resources
appname*visual: PseudoColor appname*depth: 8 appname*ulThickness: 2
Since resources on a form by form basis are yet to be implemented,
there is no point specifying anything more specific although also
appname.XForm.depth
etc. would work correctly.
• Resources Example: |
Next: Going Further, Up: Part V Resources for Forms Library [Contents][Index]