/// <summary> /// Returns the name for a style to use after registered. Generates a unique style name. /// </summary> /// <param name="style"></param> /// <returns></returns> public static uint Register(ICssStyle style) { var id = Id++; _registry.Add(id, new WeakReference <ICssStyle>(style)); return(id); }
/// <summary> /// Returns the name for a style to use after registered. /// </summary> /// <param name="style"></param> /// <returns></returns> public string Register(ICssStyle style) { Id += 1; var name = "generated-style-" + Id; _registered.Add(name, style); return(name); }
public void Styles() { var styleDefs = DomStyles.StyleDefs; ICssStyle style = styleDefs["padding-left"]; Assert.AreEqual(CssStyleType.Unit | CssStyleType.Option, style.Type, "Padding style is correct type"); style = styleDefs["word-wrap"]; HashSet <string> expectedOpts = new HashSet <string>(new string[] { "normal", "break-word" }); Assert.AreEqual(expectedOpts, style.Options, "word-wrap has correct options"); }
public static string WrapCssClassName(this ICssStyle style, string inner) { return(string.Format(".{0} {{ {1} }}", style.Name, inner)); }
private static StringBuilder renderStyle(ICssStyle style) => new StringBuilder($"<style type=\"text/css\">{style.GetStyle()}</style>");
/// <summary> /// Sets CSS style that will be inserted before table tag. /// </summary> public Table SetStyle(ICssStyle style) { this.style = style; return(this); }