Each property subtype has its own requirements on the editor. These requirements are stored in a data structure in the file gui/properties.c. The editor for a subtype is described by the following structure:
struct pst_data { uns widget_type; char * description; union { struct { gdouble lower, upper, step, page; } spin; struct { uns max; string * strings; } combo; struct { uns dummy; } nothing; struct { void (*create_edit_func)( struct prop_item * pi ); void (*update_edit_func)( struct prop_item * pi, struct prop * prop ); } func; } data; };
The widget type can be one of these:
PWT_BUG
– zero. This is an erroneous value. Its purpose is to prevent
uninitialized subtype structures after kernel changes.
PWT_SPIN_UNS
– a spin button for unsigned integers. The spin
structure then specifies the spin button settings.
PWT_SPIN_REAL
– the same as PWT_SPIN_UNS
but for reals.
PWT_COMBO
– a combo box. The combo
structure specifies the
maximum value and the string names of the possible values from zero up to maximum minus one.
PWT_CHECKBOX
– a checkbox for boolean values. No additional settings
are needed.
PWT_ENTRY
– a text entry for string properties.
PWT_FUNC
– a special property widget with its own creating and updating
functions. This is used for example for color buttons, filename and large text editors.
The description
is used when creating a new property and specifying its
subtype. Then only some property subtypes are shown (we believe that, for
example, the PTU_CAP_STYLE
subtype for line caps is not very useful for
user-defined properties) and those are subtypes with non-NULL
description.
The description is shown in the subtype list.