Пример #1
0
 public CssStyle()
 {
     color=	new Color(0, 0, 0);
     background=	new Background();
     border=	new Border();
     clear=	FloatType.none;
     display=	Display.inline;
     _float=	FloatType.none;
     height=	new FlexibleFloat(0f, FlexFloatType.px);
     margin=	new Margin(0f, 0f, 0f, 0f);
     padding=	new Padding(0f, 0f, 0f, 0f);
     width=	new FlexibleFloat(100f, FlexFloatType.percentage);
     letterSpacing=	new FlexibleFloat(FlexibleFloat.letterSpacingNormal, FlexFloatType.px);
     lineHeight=	new FlexibleFloat(FlexibleFloat.lineHeightNormal, FlexFloatType.px);
     textAlign=	TextAlignment.left;
     textIndex=	new FlexibleFloat(0f, FlexFloatType.px);
     textTransform=	TextTransform.none;
     whiteSpace=	WhiteSpace.normal;
     wordSpacing=	new FlexibleFloat(FlexibleFloat.wordSpacingNormal, FlexFloatType.px);
     textDecoration=	TextDecoration.none;
     font=	new Sdx.Font("arial", 14);
     listStyle=	new ListStyle();
 }
Пример #2
0
 // Loads in the css style given the css code
 public void applyCssCode(CssCode code)
 {
     for(int i= 0; i< code.size; i++)
     {
         switch(code.names.items[i].ToLower())
         {
             case "color":	color=	new Color(code.values.items[i]);	break;
             case "background-color":	backgroundColor=	new Color(code.values.items[i]);	break;
             case "width":	width=	new FlexibleFloat(code.values.items[i]);	break;
             case "height":	height=	new FlexibleFloat(code.values.items[i]);	break;
             case "margin":	margin=	new Margin(code.values.items[i]);	break;
             case "margin-top":	marginTop=	new FlexibleFloat(code.values.items[i]);	break;
             case "margin-right":	marginRight=	new FlexibleFloat(code.values.items[i]);	break;
             case "margin-bottom":	marginBottom=	new FlexibleFloat(code.values.items[i]);	break;
             case "margin-left":	marginLeft=	new FlexibleFloat(code.values.items[i]);	break;
             case "padding":	padding=	new Padding(code.values.items[i]);	break;
             case "padding-top":	paddingTop=	new FlexibleFloat(code.values.items[i]);	break;
             case "padding-right":	paddingRight=	new FlexibleFloat(code.values.items[i]);	break;
             case "padding-bottom":	paddingBottom=	new FlexibleFloat(code.values.items[i]);	break;
             case "padding-left":	paddingLeft=	new FlexibleFloat(code.values.items[i]);	break;
             case "display":
                 switch(code.values.items[i].ToLower())
                 {
                     case "none":	display=	Display.none;	break;
                     case "block":	display=	Display.block;	break;
                     case "inline":	display=	Display.inline;	break;
                     case "inline-block":	display=	Display.inlineBlock;	break;
                 }
                 break;
         }
     }
 }