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); }
protected override void OnLoadData() { var view = (ITextCellViewFrontend)Frontend; if (view.Markup != null) { FormattedText tx = FormattedText.FromMarkup(view.Markup); cellRenderer.Text = tx.Text; var atts = new FastPangoAttrList(); atts.AddAttributes(new TextIndexer(tx.Text), tx.Attributes); cellRenderer.Attributes = new Pango.AttrList(atts.Handle); atts.Dispose(); mixedMarkupText = true; } else { cellRenderer.Text = view.Text; if (mixedMarkupText) { cellRenderer.Attributes = new Pango.AttrList(); } } cellRenderer.Editable = view.Editable; cellRenderer.Ellipsize = view.Ellipsize.ToGtkValue(); }
public void SetFormattedText(FormattedText text) { Label.Text = text.Text; var list = new FastPangoAttrList(); TextIndexer indexer = new TextIndexer(text.Text); list.AddAttributes(indexer, text.Attributes); gtk_label_set_attributes(Label.Handle, list.Handle); }
public void SetFormattedText(FormattedText text) { Label.Text = text.Text; formattedText = text; var list = new FastPangoAttrList(); 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); if (links != null) { links.Clear(); } foreach (var attr in text.Attributes.OfType <LinkTextAttribute> ()) { LabelLink ll = new LabelLink() { StartIndex = indexer.IndexToByteIndex(attr.StartIndex), EndIndex = indexer.IndexToByteIndex(attr.StartIndex + attr.Count), Target = attr.Target }; if (links == null) { links = new List <LabelLink> (); EnableLinkEvents(); } links.Add(ll); } if (links == null || links.Count == 0) { links = null; indexer = null; } }
protected override void OnLoadData () { var view = (ITextCellViewFrontend) Frontend; if (view.Markup != null) { FormattedText tx = FormattedText.FromMarkup (view.Markup); cellRenderer.Text = tx.Text; var atts = new FastPangoAttrList (); atts.AddAttributes (new TextIndexer (tx.Text), tx.Attributes); cellRenderer.Attributes = new Pango.AttrList (atts.Handle); atts.Dispose (); } else { cellRenderer.Text = view.Text; } cellRenderer.Editable = view.Editable; cellRenderer.Ellipsize = view.Ellipsize.ToGtkValue (); }
public void LoadData(TreeModel treeModel, TreeIter iter) { this.treeModel = treeModel; this.iter = iter; view.Initialize (this); if (view.Markup != null) { FormattedText tx = FormattedText.FromMarkup (view.Markup); Text = tx.Text; var atts = new FastPangoAttrList (); atts.AddAttributes (new TextIndexer (tx.Text), tx.Attributes); Attributes = new Pango.AttrList (atts.Handle); atts.Dispose (); } else { Text = view.Text; } Editable = view.Editable; }
public void LoadData(TreeModel treeModel, TreeIter iter) { this.treeModel = treeModel; this.iter = iter; view.Initialize(this); if (view.Markup != null) { FormattedText tx = FormattedText.FromMarkup(view.Markup); Text = tx.Text; var atts = new FastPangoAttrList(); atts.AddAttributes(new TextIndexer(tx.Text), tx.Attributes); Attributes = new Pango.AttrList(atts.Handle); atts.Dispose(); } else { Text = view.Text; } Editable = view.Editable; }
public void SetFormattedText(FormattedText text) { Label.Text = text.Text; var list = new FastPangoAttrList(); indexer = new TextIndexer(text.Text); list.AddAttributes(indexer, text.Attributes); gtk_label_set_attributes(Label.Handle, list.Handle); if (links != null) { links.Clear(); } foreach (var attr in text.Attributes.OfType <LinkTextAttribute> ()) { LabelLink ll = new LabelLink() { StartIndex = indexer.IndexToByteIndex(attr.StartIndex), EndIndex = indexer.IndexToByteIndex(attr.StartIndex + attr.Count), Target = attr.Target }; if (links == null) { links = new List <LabelLink> (); EnableLinkEvents(); } links.Add(ll); } if (links == null || links.Count == 0) { links = null; indexer = null; } }
public void SetFormattedText (FormattedText text) { Label.Text = text.Text; var list = new FastPangoAttrList (); indexer = new TextIndexer (text.Text); list.AddAttributes (indexer, text.Attributes); gtk_label_set_attributes (Label.Handle, list.Handle); if (links != null) links.Clear (); foreach (var attr in text.Attributes.OfType<LinkTextAttribute> ()) { LabelLink ll = new LabelLink () { StartIndex = indexer.IndexToByteIndex (attr.StartIndex), EndIndex = indexer.IndexToByteIndex (attr.StartIndex + attr.Count), Target = attr.Target }; if (links == null) { links = new List<LabelLink> (); EnableLinkEvents (); } links.Add (ll); } if (links == null || links.Count == 0) { links = null; indexer = null; } }
public void SetFormattedText(FormattedText text) { Label.Text = text.Text; var list = new FastPangoAttrList (); TextIndexer indexer = new TextIndexer (text.Text); list.AddAttributes (indexer, text.Attributes); gtk_label_set_attributes (Label.Handle, list.Handle); }
public void SetFormattedText(FormattedText text) { Label.Text = text.Text; formattedText = text; var list = new FastPangoAttrList (); 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); if (links != null) links.Clear (); foreach (var attr in text.Attributes.OfType<LinkTextAttribute> ()) { LabelLink ll = new LabelLink () { StartIndex = indexer.IndexToByteIndex (attr.StartIndex), EndIndex = indexer.IndexToByteIndex (attr.StartIndex + attr.Count), Target = attr.Target }; if (links == null) { links = new List<LabelLink> (); EnableLinkEvents (); } links.Add (ll); } if (links == null || links.Count == 0) { links = null; indexer = null; } }