// * // * Copyright (C) 2008 Roger Alsing : http://www.RogerAlsing.com // * // * This library is free software; you can redistribute it and/or modify it // * under the terms of the GNU Lesser General Public License 2.1 or later, as // * published by the Free Software Foundation. See the included license.txt // * or http://www.gnu.org/copyleft/lesser.html for details. // * // * using System.Drawing; namespace Alsing.SourceCode { /// /// Word types /// public enum WordType { /// /// The word is a normal word/text /// Word = 0, /// /// The word is a space char /// Space = 1, /// /// The word is a tab char /// Tab = 2 } /// /// The word object class represents a word in a Row object /// public sealed class Word { #region General Declarations /// /// Color of the error wave lines /// public Color ErrorColor = Color.Red; /// /// True if the word has error wave lines /// public bool HasError; /// /// The ToolTip text for the word /// public string InfoTip; /// /// The pattern that created this word /// public Pattern Pattern; //the pattern that found this word /// /// The parent row /// public Row Row; //the row that holds this word /// /// The parent span /// public Span Span; //the span that this word is located in /// /// The style of the word /// public TextStyle Style; //the style of the word /// /// The text of the word /// public string Text; //the text in the word /// /// The type of the word /// public WordType Type; //word type , space , tab , word #endregion /// /// Gets the index of the word in the parent row /// public int Index { get { return Row.IndexOf(this); } } /// /// Returns the column where the word starts on the containing row. /// public int Column { get { int x = 0; foreach (Word w in Row) { if (w == this) return x; x += w.Text.Length; } return - 1; } } } }