Xwt.GtkBackend.FastPangoAttrList.AddAttribute C# (CSharp) Метод

AddAttribute() публичный Метод

public AddAttribute ( TextIndexer indexer, Xwt.Drawing.TextAttribute attr ) : void
indexer TextIndexer
attr Xwt.Drawing.TextAttribute
Результат void
        public void AddAttribute(TextIndexer indexer, TextAttribute attr)
        {
            var start = (uint) indexer.IndexToByteIndex (attr.StartIndex);
            var end = (uint) indexer.IndexToByteIndex (attr.StartIndex + attr.Count);

            if (attr is BackgroundTextAttribute) {
                var xa = (BackgroundTextAttribute)attr;
                AddBackgroundAttribute (xa.Color.ToGtkValue (), start, end);
            }
            else if (attr is ColorTextAttribute) {
                var xa = (ColorTextAttribute)attr;
                AddForegroundAttribute (xa.Color.ToGtkValue (), start, end);
            }
            else if (attr is FontWeightTextAttribute) {
                var xa = (FontWeightTextAttribute)attr;
                AddWeightAttribute ((Pango.Weight)(int)xa.Weight, start, end);
            }
            else if (attr is FontStyleTextAttribute) {
                var xa = (FontStyleTextAttribute)attr;
                AddStyleAttribute ((Pango.Style)(int)xa.Style, start, end);
            }
            else if (attr is UnderlineTextAttribute) {
                var xa = (UnderlineTextAttribute)attr;
                AddUnderlineAttribute (xa.Underline ? Pango.Underline.Single : Pango.Underline.None, start, end);
            }
            else if (attr is StrikethroughTextAttribute) {
                var xa = (StrikethroughTextAttribute)attr;
                AddStrikethroughAttribute (xa.Strikethrough, start, end);
            }
            else if (attr is FontTextAttribute) {
                var xa = (FontTextAttribute)attr;
                AddFontAttribute ((Pango.FontDescription)Toolkit.GetBackend (xa.Font), start, end);
            }
            else if (attr is LinkTextAttribute) {
                // TODO: support "link-color" style prop for TextLayoutBackendHandler and CellRendererText
                AddUnderlineAttribute (Pango.Underline.Single, start, end);
                AddForegroundAttribute (DefaultLinkColor, start, end);
            }
        }