// // // // // $Revision$ // using System; using System.Drawing; namespace ICSharpCode.TextEditor.Document { public enum TextMarkerType { Invisible, SolidBlock, Underlined, WaveLine } /// /// Marks a part of a document. /// public class TextMarker : AbstractSegment { TextMarkerType textMarkerType; Color color; Color foreColor; string toolTip = null; bool overrideForeColor = false; public TextMarkerType TextMarkerType { get { return textMarkerType; } } public Color Color { get { return color; } } public Color ForeColor { get { return foreColor; } } public bool OverrideForeColor { get { return overrideForeColor; } } /// /// Marks the text segment as read-only. /// public bool IsReadOnly { get; set; } public string ToolTip { get { return toolTip; } set { toolTip = value; } } /// /// Gets the last offset that is inside the marker region. /// public int EndOffset { get { return Offset + Length - 1; } } public TextMarker(int offset, int length, TextMarkerType textMarkerType) : this(offset, length, textMarkerType, Color.Red) { } public TextMarker(int offset, int length, TextMarkerType textMarkerType, Color color) { if (length < 1) length = 1; this.offset = offset; this.length = length; this.textMarkerType = textMarkerType; this.color = color; } public TextMarker(int offset, int length, TextMarkerType textMarkerType, Color color, Color foreColor) { if (length < 1) length = 1; this.offset = offset; this.length = length; this.textMarkerType = textMarkerType; this.color = color; this.foreColor = foreColor; this.overrideForeColor = true; } } }