Styles are used to
decorate the area surrounding
Component and
to customize the contents of component.
Each style may have optional focused variant that is
used automatically when
Component flagged as FOCUSABLE
is focused.
It is important to ensure that the total area consumed by margin, border and padding are equal in normal style and focused variant. Within the consumed area the dimensions of margin, border and padding may change as long as the total areas remains equal. Graphical glithes may occur if this constraint is violated.
Diagram below illustrates the marginal, border and padding. Top, right, bottom and left dimensions are individually adjustable. It is not required to have any of them, and by default there is no margin, border and padding for style. Style may also specify background which is used to fill the padding and component area.
Style can also carry up to four fonts, colors, images and arguments. They are used to customize the contents of components.
| margin-top | ||||||||||||||||||||
|
margin- left |
|
margin- right |
||||||||||||||||||
| margin-bottom |
Styles are written with CSS-like notation.
If name of style contains reserved word (e.g. background)
it can be escaped with dot.
menu {
width: 100%;
align: left bottom;
background: solid #163458;
border: 7 5 0 5;
border-type: image "/menu.png";
padding: 0 2 5 2;
}
menu.item {
padding: 2 10 2 10;
font: proportional medium bold;
color: white;
image: "/menu2.png";
label-icon-orientation: right;
// Focused variant inherits all
// the properties
focused {
background: grid9 "/menuitem.png" 3 3 3 3;
}
}
.background
{
background: solid blue;
}
Dimension are used to specify padding, border, margin and some Component specific dimesions. Following formats are available:
23 - absolute pixels
23px - absolute pixels
23sp - scaled pixels, adjusted to 50%, 75% or 100% of value according to available screen size
23% - percents, only available on certain situations
Following color formats are supported:
#4080a0 - HTML hexadecimal color
LightSkyBlue - HTML color names
(See Wikipedia)
rgb(40, 80, #A0) - RGB tuple
Images reference the bitmap resources specified on widget.xml
file.
"hello.png" - Reference to Widget's hello.png
"/menu.png" - Reference to image on WidSets client,
these can be used but they may change without warning.
Alignment may be specified on certain locations.
left, hcenter or right
top, vcenter or bottom
Font is combination of face, size, and style:
monospace, proportional or system
small, medium or large
plain, bold, underlined or italic
Components can take the width and/or height specified on style provided that no code-level preferred width/height has been set. If width/height is specified zero it is considered unlocked and each Component will attempt to determine optiomal size. Relative (percentual) dimensions may be used. Alignment control is Component specific, see documentation of different components too see how it's treated.
width: <dim>;height: <dim>;align: <align>;margin:
<top-dim>
<right-dim>
<bottom-dim>
<left-dim>; margin-left: <dim>; margin-right: <dim>; margin-top: <dim>; margin-bottom: <dim>; border:
<top-dim>
<right-dim>
<bottom-dim>
<left-dim>; border-left: <dim>; border-right: <dim>; border-top: <dim>; border-bottom: <dim>;
border-type: none;- No border is drawn.
border-type: rectangle<color>;- Border is drawn with solid color.
border-type: rectangle<top-color> <right-color> <bottom-color> <left-color>;- Border is drawn like classic beweled button.
border-type: image<image>;- Given image is split into 9 regions according to border dimensions, as suggested by diagram, and the regions are used when filling up the border area.
Regions 1, 3, 7 and 9 are used to fill corners of border area.
1 2 3 4 5 6 7 8 9
Regions 2, 8 are used to horizontally fill the upper and lower border areas, regions are repeated/clipped as needed.
Regions 4, 6 are used to vertically to fill the left and right borders areas, regions are repeated/clipped as needed.
Region 5 is ignored.
padding:
<top-dim>
<right-dim>
<bottom-dim>
<left-dim>; padding-left: <dim>; padding-right: <dim>; padding-top: <dim>; padding-bottom: <dim>;
background: none;- No background is drawn.
background: solid<color>;- Background is drawn with solid color.
background: hgradient<left-color> <right-color>;- Background is drawn as horizontal gradient.
background: vgradient<top-color> <bottom-color>;- Background is drawn as vertical gradient.
background: image<image> (transparent| <color> ) <alignment> (repeat-x,repeat-y|no-repeat);- Background is drawn using given image. Image is aligned to given position on target area and repeated as specified. Remaining area is either left transparent or filled with specified color.
background: grid8<image>transparent<top-dim> <right-dim> <bottom-dim> <left-dim>;- Given image is split into 9 regions by given dimensions and drawn like image border. Padding and component areas area not drawn.
background: grid8<image>automatic<top-dim> <right-dim> <bottom-dim> <left-dim>;- Given image is split into 9 regions by given dimensions and drawn like image border. Padding and component areas are filled with color picked from first (top left) pixel of region 5.
background: grid8<image> <color> <top-dim> <right-dim> <bottom-dim> <left-dim>;
- Given image is split into 9 regions by given dimensions and drawn like image border. Padding and component areas are filled with given color.
background: grid9<image> <top-dim> <right-dim> <bottom-dim> <left-dim>;
- Given image is split into 9 regions by given dimensions and drawn like image border. Padding and component areas are filled using the region 5 of image, repeating and clipping as needed.
Component specific customization. See individual component for description. Note that there is overlap between color slots, style compiler will issue warning if it detects conflict.
color: <color>; color-1: <color>; color-2: <color>; color-3: <color>; color-4: <color>; cursor-color: <color>;
Text
Component specific customization. See individual component for description.
image: <image>; image-1: <image>; image-2: <image>; image-3: <image>; image-4: <image>; Component specific customization. See individual component for description.
font: <font>; font-1: <font>; font-2: <font>; font-3: <font>; font-4: <font>; Component specific customization. See individual component for description. Note that there is overlap between argument slots, style compiler will issue warning if it detects conflict.
argument: <integer>; argument-1: <integer>; argument-2: <integer>; argument-3: <integer>; argument-4: <integer>; hspacing: <dim>;
Flow
vspacing: <dim>;
Flow
line-spacing: <dim>;
Text
line-alignment: left | hcenter | right;
Text
label-spacing: <dim>;
Label
label-icon-orientation: left | right;
Label
indicator-background: <color>;
Progress
indicator-foreground: <color>;
Progress
indicator-height: <dim>;
Progress
ticker-speed: <integer>;
Ticker
ticker-mode: loop | bounce;
Ticker
Empty style contains following properties:
margin: 0 0 0 0;
border: 0 0 0 0;
border-type: none;
padding: 0 0 0 0;
background: none;
font-1: proportional medium plain;
font-2: proportional medium plain;
font-3: proportional medium plain;
font-4: proportional medium plain;
color-1: black;
color-2: black;
color-3: black;
color-4: black;
argument-1: 0;
argument-2: 0;
argument-3: 0;
argument-4: 0;
width: 0;
height: 0;
align: top left;