public AdornmentAndData(AdornmentPositioningBehavior behavior, SnapshotSpan?visualSpan, object tag, AdornmentElement element, AdornmentRemovedCallback removedCallback) { _behavior = behavior; _visualSpan = visualSpan; _tag = tag; _element = element; _removedCallback = removedCallback; }
public void RemoveAdornment(AdornmentElement element) { if (element == null) { throw new ArgumentNullException("element"); } for (int i = 0; (i < _elements.Count); ++i) { AdornmentAndData data = _elements[i]; if (data.Adornment == element) { _elements.RemoveAt(i); this.RemoveTranslatableVisual(data); break; } } }
public void RemovedCallback(object tag, AdornmentElement element) { //An adornment was removed ... remove the corresponding entry from the _lineSpans. _lineSpans.Remove(tag); }
public bool AddAdornment(AdornmentPositioningBehavior behavior, SnapshotSpan?visualSpan, object tag, AdornmentElement element, AdornmentRemovedCallback removedCallback) { if (element == null) { throw new ArgumentNullException("element"); } if (_isOverlayLayer && behavior != AdornmentPositioningBehavior.OwnerControlled) { throw new ArgumentOutOfRangeException("behavior", "Only AdornmentPositioningBehavior.OwnerControlled is supported"); } if (IsTextRelative(behavior) && !visualSpan.HasValue) { throw new ArgumentNullException("visualSpan"); } bool visible = true; if (visualSpan.HasValue) { //Does the visual span intersect anything visible? visible = _view.TextViewLines.IntersectsBufferSpan(visualSpan.Value); } if (visible) { AdornmentAndData data = new AdornmentAndData(behavior, visualSpan, tag, element, removedCallback); _elements.Add(data); Children.Add(element); } return(visible); }
public bool AddAdornment(SnapshotSpan visualSpan, object tag, AdornmentElement element) { return(this.AddAdornment(AdornmentPositioningBehavior.TextRelative, visualSpan, tag, element, null)); }