/// /// Copyright © 2003-2008 JetBrains s.r.o. /// You may distribute under the terms of the GNU General Public License, as published by the Free Software Foundation, version 2 (see License.txt in the repository root folder). /// using System; using System.Drawing; namespace JetBrains.UI.RichText { /// /// Represents style of text block /// public struct TextStyle { /// /// Enumerates different text drawing effects /// public enum EffectStyle { /// /// No effects /// None, /// /// Underline with straight line /// StraightUnderline, /// /// Underline with weavy line /// WeavyUnderline, /// /// Strike out with straight line /// StrikeOut } #region Fields /// /// Font style /// private FontStyle myFontStyle; /// /// Foreground color /// private Color myForegroundColor; /// /// Background color /// private Color myBackgroundColor; /// /// Effect to use /// private TextStyle.EffectStyle myEffect; /// /// Effect color /// private Color myEffectColor; #endregion #region Properties /// /// Gets or sets font style /// public FontStyle FontStyle { get { return myFontStyle; } set { myFontStyle = value; } } /// /// Gets or sets foreground color /// public Color ForegroundColor { get { return myForegroundColor; } set { myForegroundColor = value; } } /// /// Gets or sets background color /// public Color BackgroundColor { get { return myBackgroundColor; } set { myBackgroundColor = value; } } /// /// Gets or sets used effect /// public TextStyle.EffectStyle Effect { get { return myEffect; } set { myEffect = value; } } /// /// Gets or sets effect color /// public Color EffectColor { get { return myEffectColor; } set { myEffectColor = value; } } #endregion #region Statics /// /// Default text style /// private static TextStyle myDefaultStyle = new TextStyle(FontStyle.Regular, SystemColors.WindowText, SystemColors.Window); /// /// Gets default text style /// public static TextStyle DefaultStyle { get { return myDefaultStyle; } } #endregion /// /// Defines a text style. /// /// /// This contructor defines style with no effects. /// /// The font style to use /// Foreground color /// Background clor public TextStyle( FontStyle fontStyle, Color foregroundColor, Color backgroundColor ) { myFontStyle = fontStyle; myForegroundColor = foregroundColor; myBackgroundColor = backgroundColor; myEffect = TextStyle.EffectStyle.None; myEffectColor = Color.Transparent; } /// /// Defines a text style. /// /// The font style to use /// Foreground color /// Background clor /// Effect to use /// Effect color to use public TextStyle( FontStyle fontStyle, Color foregroundColor, Color backgroundColor, EffectStyle effect, Color effectColor ) { myFontStyle = fontStyle; myForegroundColor = foregroundColor; myBackgroundColor = backgroundColor; myEffect = effect; myEffectColor = effectColor; } } }