public void AddAttributes(IRichTextAttributes istyleClass, StringRange range) { var end = range.End; var styleClass = (RichTextAttributes)istyleClass; for (var i = range.Location; i < end; i++) { var c = classes[i]; if (c.Class1 == null) { c.Class1 = styleClass; } else if (c.Class2 == null) { c.Class2 = styleClass; } else if (c.Class3 == null) { c.Class3 = styleClass; } else if (c.Class4 == null) { c.Class4 = styleClass; } else { throw new Exception("Too much style"); } classes[i] = c; } }
public void Merge(IRichTextAttributes c) { if (c == null) { return; } if (c.FontSize > 1) { FontSize = c.FontSize; } if (c.FontName != null && c.FontName.Length > 0) { FontName = c.FontName; } if (c.ForegroundColor != null) { ForegroundColor = c.ForegroundColor; } if (c.BackgroundColor != null) { BackgroundColor = c.BackgroundColor; } if (!string.IsNullOrEmpty(c.Link)) { Link = c.Link; } if (c.UnderlineStyle != UnderlineStyle.None) { UnderlineStyle = c.UnderlineStyle; UnderlineColor = c.UnderlineColor; } }
public void AddAttributes(IRichTextAttributes styleClass, StringRange range) { if (range.Length == 0) { return; } var starts = spans [range.Location]; // // If there already an identical span // Span span = null; if (starts != null) { foreach (var s in starts) { if (s.Range.Length == range.Length) { span = s; break; } } if (span != null) { span.AddClass(styleClass.ClassName); return; } } // // If not, we need to insert it // span = new Span(range, styleClass.ClassName); span.Url = styleClass.Link; if (starts == null) { starts = new List <Span> (); spans [range.Location] = starts; starts.Add(span); return; } // // Insert it before shorter spans // var i = 0; while (i < starts.Count && starts [i].Range.Length >= range.Length) { i++; } starts.Insert(i, span); }
public void AddAttributes (IRichTextAttributes istyleClass, StringRange range) { var end = range.End; var styleClass = (RichTextAttributes)istyleClass; for (var i = range.Location; i < end; i++) { var c = classes[i]; if (c.Class1 == null) c.Class1 = styleClass; else if (c.Class2 == null) c.Class2 = styleClass; else if (c.Class3 == null) c.Class3 = styleClass; else if (c.Class4 == null) c.Class4 = styleClass; else throw new Exception ("Too much style"); classes[i] = c; } }
public void AddAttributes(IRichTextAttributes styleClass, StringRange range) { var attrs = ((NativeStringAttributesWrapper)styleClass).Attributes; s.AddAttributes(attrs, new NSRange(range.Location, range.Length)); }
public void AddAttributes (IRichTextAttributes styleClass, StringRange range) { if (range.Length == 0) return; var starts = spans [range.Location]; // // If there already an identical span // Span span = null; if (starts != null) { foreach (var s in starts) { if (s.Range.Length == range.Length) { span = s; break; } } if (span != null) { span.AddClass (styleClass.ClassName); return; } } // // If not, we need to insert it // span = new Span (range, styleClass.ClassName); span.Url = styleClass.Link; if (starts == null) { starts = new List<Span> (); spans [range.Location] = starts; starts.Add (span); return; } // // Insert it before shorter spans // var i = 0; while (i < starts.Count && starts [i].Range.Length >= range.Length) { i++; } starts.Insert (i, span); }
public void Merge (IRichTextAttributes c) { if (c == null) return; if (c.FontSize > 1) FontSize = c.FontSize; if (c.FontName != null && c.FontName.Length > 0) FontName = c.FontName; if (c.ForegroundColor != null) ForegroundColor = c.ForegroundColor; if (c.BackgroundColor != null) BackgroundColor = c.BackgroundColor; if (!string.IsNullOrEmpty (c.Link)) Link = c.Link; if (c.UnderlineStyle != UnderlineStyle.None) { UnderlineStyle = c.UnderlineStyle; UnderlineColor = c.UnderlineColor; } }