Yage3D.net
 

yage.gui.style

Authors:
Eric Poggel

License:
LGPL v3

struct CSSValue ;
Represents a CSS value. It can store pixels or precent.

static CSSValue AUTO ;
Has a value of float.nan. This means inherit from parent style.

enum Unit ;
CSSValues used to set units for measurements, such as width, padding, etc.

PX
PERCENT


CSSValue opAssign (float v);
CSSValue opAssign (char[] v);
Allow assignments from ints, floats and strings.

Example:
 CSSValue height;
 height = 3; // width is 3 pixels
 height = "3%"; // width is 3% of parent's height


static CSSValue opCall (float v, bool isPercent = false);
static CSSValue opCall (char[] v);
Constructor for initializing the values

Params:
float v the value to set
bool isPercent If precent, v will be based on the Surface parent's value from 0 to 100%

float toPx (lazy float target, bool allow_nan = true);
float toPercent (lazy float target, bool allow_nan = true);
Get the value in terms of pixels or percent, if it's not already a percent value.

Params:
float target If the value is a pixel value, it will be converted to a percentage in terms of this width/height. allow_nan If false , nan's will be converted to 0.

char[] toString ();
Returns:
The value as it would be printed in a CSS string.

struct Style ;
This struct is used to specify the style of a Surface. Inspired by the CSS specification. Much of htis functionality is still unfinished.

TODO:
Additional CSS3 border-image properties? Background image positioning inline a href cursor and cursor size. letter spacing opacity default skin toString() scale inherit? TextAlign.JUSTIFY

enum BorderImageStyle ;
CSSValues that can be assigned to the borderImagestyle property.

STRETCH
ROUND
REPEAT
Allowed values.

enum FontStyle ;
CSSValues that can be assigned to the fontStyle property.

AUTO
NORMAL
ITALIC
Allowed values.

enum FontWeight ;
CSSValues that can be assigned to the fontWeight property.

AUTO
NORMAL
BOLD
Allowed values.

enum Overflow ;


VISIBLE
HIDDEN
Allowed values.

enum TextAlign ;
CSSValues that can be assigned to the textAlign property.

AUTO
LEFT
CENTER
RIGHT
JUSTIFY
Allowed values.

enum TextDecoration ;
CSSValues that can be assigned to the textDecoration property.

NONE
UNDERLINE
OVERLINE
LINETHROUGH
Allowed values.

CSSValue top ;
CSSValue right ;
CSSValue bottom ;
CSSValue left ;
Distance of an edge from its parent, use float.nan to leave unset.

CSSValue width ;
CSSValue height ;
Width and height of the Surface. Use float.nan to leave unset.

CSSValue borderTopWidth ;
CSSValue borderRightWidth ;
CSSValue borderBottomWidth ;
CSSValue borderLeftWidth ;
Border widths

CSSValue[4u] borderWidth ;
Set all four border widths in one array.

Color borderColorTop ;
Color borderColorRight ;
Color borderColorBottom ;
Color borderColorLeft ;
Border colors

Color[4u] borderColor ;
Set all four border colors in one array.

Texture borderTopImage ;
Texture borderRightImage ;
Texture borderBottomImage ;
Texture borderLeftImage ;
Border Images (TODO: support border-style and border-image-widths?)

Texture[4u] borderImage ;
Set the four top/right/bottom/left border images in one array.

Texture borderCenterImage ;
Border center image (not a part of CSS3, this image is stretched to fit within the borders).

Texture borderTopLeftImage ;
Texture borderTopRightImage ;
Texture borderBottomLeftImage ;
Texture borderBottomRightImage ;
Border corner images

Texture[4u] borderCornerImage ;
Set the four border corner images images in one array.

CSSValue paddingTop ;
CSSValue paddingRight ;
CSSValue paddingBottom ;
CSSValue paddingLeft ;
Padding (the space inside the border surrounding any text or children)

CSSValue[4u] padding ;
Set all four padding sizes in one array.

Texture backgroundImage ;
Color backgroundColor ;
Background image and color. backgroundColor is drawn first, with backgroundImage second, then borderImage on top.

Material cursor ;
TODO:
Unimplemented

float cursorSize ;
in pixels, float.nan to default to size of image.

Font fontFamily ;
CSSValue fontSize ;
FontStyle fontStyle ;
FontWeight fontWeight ;
Font properties

Nullable!(Color) color ;
TextAlign textAlign ;
TextDecoration textDecoration ;
CSSValue lineHeight ;
Text properties

CSSValue letterSpacing ;
TODO:
Unimplemented

Matrix transform ;
CSS 3D transform property, defaults to identity matrix. See: http://w3.org/TR/css3-3d-transforms

float opacity ;


Overflow overflowX ;
Overflow overflowY ;
Control whether an element is clipped when placed outside its parent.

Overflow[2u] overflow ;
Set both overflow properties in one array.

bool visible ;
Set whether the element is rendered, If false the Surface will still receive events.

bool display ;
Set whether the element exists, If false , the Surface will not be rendered or receive events and will be treated like it doesn't exist.

int zIndex ;
Sets the stack order of the surface relative to its siblings.

bool backfaceVisibility ;
Draw the back side of surfaces if they're rotated in 3d.

static Style opCall (char[] style = "");
Constructor, returns a new Style with all properties set to their defaults.

void set (char[] style);
Set properties from a string of text, css style.

TODO:
Fix this function so it cleans up its garbage.

Example:
style. set ("border: 2px solid black; font-family: arial.ttf; color: white");

char[] toString ();
Get string of css text storing the values of this style. Only the properties that differ from the defaults will be returned.

TODO:
Finish this function.

static char[] enumToString (BorderImageStyle style);
static char[] enumToString (FontStyle style);
static char[] enumToString (FontWeight style);
static char[] enumToString (Overflow style);
static char[] enumToString (TextAlign style);
static char[] enumToString (TextDecoration style);
Convert the various Style enumerations to their css string format.

Yage source files are copywritten by their specified authors and available under the terms of the GNU LGPL.
Documentation generated with CandyDoc on Wed Aug 11 11:14:27 2010