#region Using Directives using System; #endregion Using Directives namespace ScintillaNET { /// /// Provices data for the TextModified event /// /// /// TextModifiedEventHandler is used as an abstracted subset of the /// SCN_MODIFIED notification message. It's used whenever the SCNotification's /// modificationType flags are SC_MOD_INSERTTEXT ,SC_MOD_DELETETEXT, /// SC_MOD_BEFOREINSERT and SC_MOD_BEFORE_DELETE. They all use a /// TextModifiedEventArgs which corresponds to a subset of the /// SCNotification struct having to do with these modification types. /// public class TextModifiedEventArgs : ModifiedEventArgs { #region Constants private const string STRING_FORMAT = "ModificationTypeFlags\t:{0}\r\nPosition\t\t\t:{1}\r\nLength\t\t\t\t:{2}\r\nLinesAddedCount\t\t:{3}\r\nText\t\t\t\t:{4}\r\nIsUserChange\t\t\t:{5}\r\nMarkerChangeLine\t\t:{6}"; #endregion Constants #region Fields private bool _isUserChange; private int _length; private int _linesAddedCount; private int _markerChangedLine; private int _position; private string _text; #endregion Fields #region Methods /// /// Overridden. /// public override string ToString() { return string.Format(STRING_FORMAT, ModificationType, _position, _length, _linesAddedCount, _text, _isUserChange, _markerChangedLine) + Environment.NewLine + UndoRedoFlags.ToString(); } #endregion Methods #region Properties /// /// Returns true if the change was a direct result of user interaction /// public bool IsUserChange { get { return _isUserChange; } } /// /// Returns the length of the change occured. /// public int Length { get { return _length; } } /// /// Returns the # of lines added or removed as a result of the change /// public int LinesAddedCount { get { return _linesAddedCount; } } /// /// Returns the line # of where the marker change occured (if applicable) /// public int MarkerChangedLine { get { return _markerChangedLine; } } /// /// Returns the document position where the change occured /// public int Position { get { return _position; } } /// /// The affected text of the change /// public string Text { get { return _text; } } #endregion Properties #region Constructors /// /// Initializes a new instance of the TextModifiedEventArgs class. /// /// document position where the change occured /// _length of the change occured /// the # of lines added or removed as a result of the change /// affected text of the change /// true if the change was a direct result of user interaction /// the line # of where the marker change occured (if applicable) public TextModifiedEventArgs(int modificationType, bool isUserChange, int markerChangedLine, int position, int length, int linesAddedCount, string text) : base(modificationType) { _isUserChange = isUserChange; _markerChangedLine = markerChangedLine; _position = position; _length = length; _linesAddedCount = linesAddedCount; _text = text; } #endregion Constructors } }