Browse Source

added addStyleString

ncannasse 12 years ago
parent
commit
245763ed4b
1 changed files with 9 additions and 1 deletions
  1. 9 1
      h2d/comp/Component.hx

+ 9 - 1
h2d/comp/Component.hx

@@ -94,7 +94,7 @@ class Component extends Sprite {
 		needRebuild = true;
 		return this;
 	}
-	
+
 	public function addStyle(s) {
 		if( customStyle == null )
 			customStyle = new h2d.css.Style();
@@ -102,6 +102,14 @@ class Component extends Sprite {
 		needRebuild = true;
 		return this;
 	}
+
+	public function addStyleString(s) {
+		if( customStyle == null )
+			customStyle = new h2d.css.Style();
+		new h2d.css.Parser().parse(s, customStyle);
+		needRebuild = true;
+		return this;
+	}
 	
 	public function getClasses() : Iterable<String> {
 		return classes;