Navigation
|
Synopsis Overview of all visual properties that apply to figures.
Types -
FProperty
-
alias FProperties = list[FProperty];
-
alias computedInt = int();
-
alias computedReal = real();
-
alias computedNum = num();
-
alias computedStr = str();
-
alias computedColor = Color();
Description All figures may have an (optional) list of properties.
A property:
- is represented by the type
FProperty ,
- has a standard value, unless it is explicitly defined for a figure,
- describes a property of the figure in which it is declared, but
- the standard value of each property may be redefined for all figures that are contained in a figure.
Several properties have variants that act on one or two dimensions. We call them 2D properties and use the following naming scheme:
-
P(num xy) sets the value for property P in both dimensions to the same value xy .
-
P(num x, num y) sets the value for property P to distinct values x , respectively, y .
-
hP(num x) sets the horizontal value for property P to x .
-
vP(num y) sets the vertical value for property P to y .
The properties width and height are synonyms for hsize , respectively, vsize .
Most properties have typed arguments but they come in several versions:
- A version with an argument of type
int , real , num , str or Color . The values of these arguments are computed when the property is constructed, i.e., when the Figure is constructed.
- A version with computed argument like
computedInt , computedReal , computedNum , computedStr or computedColor . These are functions that return a value. These functions are called during the rendering of the figure to which this property is attached. In this way, properties
can be changed.
Properties can be classified as follows:
- Sizing: size, hsize, vsize, grow, hgrow, vgrow, shrink, hshrink, vshrink, resizable, hresizable, vresizable, lineWidth, fontSize
- Aligning: align, halign, valign, bottom, top, center, hcenter, vcenter
- Composing: gap, hgap, vgap, startGap, hstartGap, vstartGap, endGap, hendGap, vendGap
- Styling: lineColor, lineStyle, fillColor font, fontColor, shadow, shadowColor, shadowPos, hshadowPos, vshadowPos.
- Interacting: resizable, onMouseDown,onMouseUp, onMouseEnter, onMouseExit,mouseOver, onKeyDown,onKeyUp.
Most properties use dimensions that are relative to their parent or children. The exceptions are
If the figure in which these properties occur is not resizable, then the given absolute values are respected.
Otherwise they act as minimal value and may become larger in the resized figure.
Examples Just a few examples to show the spirit:
-
size(10, 20) sets the size property to 10 (horizontally), respectively 20 (vertically).
-
hsize(10) sets the hsize property to the value 10.
-
hsize(int(){return 10;}) sets the hsize property to the result of executing the argument function int(){return 10;} which is, indeed, not a big deal. This usage becomes more interesting when the argument function returns different values for each call.
-
fillColor("blue") sets the fill color of the current figure.
-
std(fillColor("blue")) sets the standard fill color for the current figure and for all of its children.
See the more detailed description of each property for examples.
The following table specifies which properties have an effect on which figures.
Benefits - Values of properties are defined by an inheritance-like approach: values can be nested and more nested declarations overrule more global ones. Default values can be set locally.
Pitfalls - As described above, each argument of a property may be specified in various manners. To avoid clutter, we only show the simplest version, but be aware that all versions are allowed.
- A figure may inherit an undesired value for a property; the solution is to redeclare that property locally with the desired value.
|