Warning:
This tutorial covers only Mobile Widgets versions.
Tiny Mobile Widgets don't support Style node..

Style Javascript library

This class is used to customize appearance of Prototypes by using CSS.
The following methods enables CSS parsing depending on the type of the data to be parsed.
For more information about CSS file selection and inclusion into VRML scene, see Style node.


int getInt (MFString classes, SFString attribute, int length):
Return an integer matching the given selector. The length parameter is used in case of relative value (depending on screen size).

float getFloat (MFString classes, SFString attribute, int length):
Return a float matching the given selector. The length parameter is used in case of relative value (depending on screen size).

String getString (MFString classes, SFString attribute):
Return a string matching the given selector.

bool getBool (MFString classes, SFString attribute):
Return a bool matching the given selector(classes.attributes).

void getFontStyle (MFString classes, SFNode fontStyle):
Set fontStyle found in the classes selector. The fontStyle node is constructed from the following CSS attributes :

void getColor (MFString classes, SFString attribute, SFColor field):
Set field to the corresponding color selected by selectors.

void getCoord (MFString classes, SFString attribute, SFVec2f field, int width, int height):
Set field to the corresponding 2D-coordinates selected by the selector. Width and Height parameters are used in case of relative coordinates.
Returns a (0, 0) SFVec2f if the selector is not found in the CSS.


The classes parameter of each method from Style API is the way to select the CSS node to be used.

Warning:
Style node enables to select the CSS file whereas classes parameter enables to select the CSS node into CSS file. As with the Style node, the most right CSS node declared into classes parameter is the most specialized. If informations are not found into it, it will be search into the CSS node declared one step left etc until the default CSS node placed at first position of classes String table.


Into CSS file:


Into Alert.wrl file (an alert pop up):


Into slider.wrl: