// // // // // $Revision$ // using System; namespace ICSharpCode.TextEditor.Document { /// /// This delegate is used for document events. /// public delegate void DocumentEventHandler(object sender, DocumentEventArgs e); /// /// This class contains more information on a document event /// public class DocumentEventArgs : EventArgs { IDocument document; int offset; int length; string text; /// /// always a valid Document which is related to the Event. /// public IDocument Document { get { return document; } } /// /// -1 if no offset was specified for this event /// public int Offset { get { return offset; } } /// /// null if no text was specified for this event /// public string Text { get { return text; } } /// /// -1 if no length was specified for this event /// public int Length { get { return length; } } /// /// Creates a new instance off /// public DocumentEventArgs(IDocument document) : this(document, -1, -1, null) { } /// /// Creates a new instance off /// public DocumentEventArgs(IDocument document, int offset) : this(document, offset, -1, null) { } /// /// Creates a new instance off /// public DocumentEventArgs(IDocument document, int offset, int length) : this(document, offset, length, null) { } /// /// Creates a new instance off /// public DocumentEventArgs(IDocument document, int offset, int length, string text) { this.document = document; this.offset = offset; this.length = length; this.text = text; } public override string ToString() { return String.Format("[DocumentEventArgs: Document = {0}, Offset = {1}, Text = {2}, Length = {3}]", Document, Offset, Text, Length); } } }