Esempio n. 1
0
 public static CssStyleBroker GetInstance(CodeEditor editor)
 {
     if (instances.ContainsKey(editor))
     {
         return(instances[editor]);
     }
     return(instances[editor] = new CssStyleBroker());
 }
Esempio n. 2
0
        public string ToCss()
        {
            string text = TextDecoration.ToString().ToLower();

            if (TextDecoration == TextDecoration.LineThrough)
            {
                text = "line-through";
            }

            return(CssStyleBroker.WrapCssClassName(this, String.Format("text-decoration: {0}", text)));
        }
        public string ToCss()
        {
            StringBuilder output = new StringBuilder(40);

            if (BackgroundColor != null)
            {
                output.AppendLine(string.Format("background: #{0:X2}{1:X2}{2:X2};", BackgroundColor.Color.R,
                                                BackgroundColor.Color.G,
                                                BackgroundColor.Color.B));
            }
            if (ForegroundColor != null)
            {
                output.AppendLine(string.Format("color: #{0:X2}{1:X2}{2:X2} !important;", ForegroundColor.Color.R,
                                                ForegroundColor.Color.G,
                                                ForegroundColor.Color.B));
            }

            return(CssStyleBroker.WrapCssClassName(this, output.ToString()));
        }
Esempio n. 4
0
        public string ToCss()
        {
            StringBuilder output = new StringBuilder(40);

            if (TextDecoration != TextDecoration.None)
            {
                string text = TextDecoration.ToString().ToLower();
                if (TextDecoration == TextDecoration.LineThrough)
                {
                    text = "line-through";
                }

                output.AppendLine(string.Format("text-decoration: {0};", text));
            }

            if (FontWeight != null && FontWeight.HasValue)
            {
                output.AppendLine(string.Format("font-weight: {0};", FontWeight.Value.Weight));
            }

            if (FontStyle != FontStyle.Normal)
            {
                output.AppendLine(string.Format("font-style: {0};", FontStyle.ToString().ToLower()));
            }

            if (BackgroundColor != null)
            {
                output.AppendLine(string.Format("background: #{0:X2}{1:X2}{2:X2};", BackgroundColor.Color.R,
                                                BackgroundColor.Color.G,
                                                BackgroundColor.Color.B));
            }

            if (ForegroundColor != null)
            {
                output.AppendLine(string.Format("color: #{0:X2}{1:X2}{2:X2} !important;", ForegroundColor.Color.R,
                                                ForegroundColor.Color.G,
                                                ForegroundColor.Color.B));
            }

            return(CssStyleBroker.WrapCssClassName(this, output.ToString()));
        }
Esempio n. 5
0
        public string ToCss()
        {
            StringBuilder output = new StringBuilder(40);

            if (BackgroundColor != null)
            {
                output.AppendLine(string.Format("background: #{0:X2}{1:X2}{2:X2};", BackgroundColor.Color.R,
                                                BackgroundColor.Color.G,
                                                BackgroundColor.Color.B));
            }
#pragma warning disable CS0618 // Type or member is obsolete
            if (ForegroundColor != null)
            {
                output.AppendLine(string.Format("color: #{0:X2}{1:X2}{2:X2} !important;", ForegroundColor.Color.R,
                                                ForegroundColor.Color.G,
                                                ForegroundColor.Color.B));
            }
#pragma warning restore CS0618 // Type or member is obsolete

            return(CssStyleBroker.WrapCssClassName(this, output.ToString()));
        }
Esempio n. 6
0
 public CssLineStyle()
 {
     Id   = CssStyleBroker.Register(this);
     Name = "generated-style-" + Id;
 }
Esempio n. 7
0
 public CssInlineStyle(CodeEditor editor)
 {
     Name = CssStyleBroker.GetInstance(editor).Register(this);
 }
Esempio n. 8
0
 public string ToCss()
 {
     return(CssStyleBroker.WrapCssClassName(this, string.Format("background: url(\"{0}\");", GlyphImage.AbsoluteUri)));
 }