Exemplo n.º 1
0
        internal static TextIndexer ApplyFormattedText(this Gtk.Label label, FormattedText text)
        {
            TextIndexer indexer = null;
            var         list    = new FastPangoAttrList();

            if (text != null)
            {
                if (label.IsRealized)
                {
                    var color    = Gdk.Color.Zero;
                    var colorVal = label.StyleGetProperty("link-color");
                    if (colorVal is Gdk.Color)
                    {
                        color = (Gdk.Color)colorVal;
                    }
                    if (!color.Equals(Gdk.Color.Zero))
                    {
                        list.DefaultLinkColor = color;
                    }
                }
                indexer = new TextIndexer(text.Text);
                list.AddAttributes(indexer, text.Attributes);
            }
            gtk_label_set_attributes(label.Handle, list.Handle);

            return(indexer);
        }