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