瀏覽代碼

added addStyleString

ncannasse 12 年之前
父節點
當前提交
245763ed4b
共有 1 個文件被更改,包括 9 次插入1 次删除
  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;