+2004-12-17 Lluis Sanchez Gual <lluis@novell.com>
+
+ * CssStyleCollection.cs: Make it work as a standalone collection.
+ * HtmlTextWriter.cs: Added static method for getting style names.
+
2004-12-14 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* ControlCollection.cs: fix off-by-one and store a null at the end to
private StateBag bag;
private StateBag style;
+ internal CssStyleCollection ()
+ {
+ }
+
internal CssStyleCollection (StateBag bag)
{
this.bag = bag;
public void Add (string key, string value)
{
style [key] = value;
- bag ["style"] = BagToString ();
+ if (bag != null)
+ bag ["style"] = BagToString ();
+ }
+
+#if NET_2_0
+ public
+#else
+ internal
+#endif
+ void Add (HtmlTextWriterStyle key, string value)
+ {
+ Add (HtmlTextWriter.StaticGetStyleName (key), value);
}
public void Clear ()
{
- bag.Remove ("style");
+ if (bag != null)
+ bag.Remove ("style");
style.Clear ();
}
{
if (style [key] != null) {
style.Remove (key);
- bag ["style"] = BagToString ();
+ if (bag != null)
+ bag ["style"] = BagToString ();
}
}
}
}\r
\r
protected string GetStyleName(HtmlTextWriterStyle styleKey){\r
+ return StaticGetStyleName (styleKey);\r
+}\r
+\r
+internal static string StaticGetStyleName (HtmlTextWriterStyle styleKey){\r
if ((int) styleKey >= 0 && (int) styleKey < HtmlTextWriter._styleNameLookupArray.Length)\r
return HtmlTextWriter._styleNameLookupArray[(int) styleKey];\r
return System.String.Empty;\r