Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        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");
        }
Ejemplo n.º 4
0
 public static string WrapCssClassName(this ICssStyle style, string inner)
 {
     return(string.Format(".{0} {{ {1} }}", style.Name, inner));
 }
Ejemplo n.º 5
0
 private static StringBuilder renderStyle(ICssStyle style) => new StringBuilder($"<style type=\"text/css\">{style.GetStyle()}</style>");
Ejemplo n.º 6
0
 /// <summary>
 /// Sets CSS style that will be inserted before table tag.
 /// </summary>
 public Table SetStyle(ICssStyle style)
 {
     this.style = style;
     return(this);
 }