/// <summary> /// Gets the style from the parent. /// </summary> /// <param name="styleName">Name of the style.</param> /// <returns></returns> public MarginBlockStyle GetParent(string styleName) { LineBlockStyle parentLineStyle = lineStyle.Parent; return(parentLineStyle == null ? null : parentLineStyle.MarginStyles.Get(styleName)); }
/// <summary> /// Initializes a new instance of the <see cref="MarginBlockStyleCollection"/> class. /// </summary> /// <param name="lineStyle">The line style.</param> public MarginBlockStyleCollection(LineBlockStyle lineStyle) { if (lineStyle == null) { throw new ArgumentNullException("lineStyle"); } this.lineStyle = lineStyle; }
/// <summary> /// Initializes a new instance of the <see cref="MarginBlockStyle"/> class. /// </summary> /// <param name="styleName">Name of the style.</param> /// <param name="parentLineStyle">The parent line style.</param> public MarginBlockStyle( string styleName, LineBlockStyle parentLineStyle) { if (styleName == null) { throw new ArgumentNullException("styleName"); } this.styleName = styleName; this.parentLineStyle = parentLineStyle; }
/// <summary> /// Initializes a new instance of the <see cref="LineBlockStyle"/> class. /// </summary> /// <param name="parent">The parent.</param> public LineBlockStyle(LineBlockStyle parent) : this() { Parent = parent; }
/// <summary> /// Initializes a new instance of the <see cref="Theme"/> class. /// </summary> public Theme() { // Create the initial styles along with the styles used internally // by the text editor. lineStyles = new BlockStyleDictionary <LineBlockStyle>(); // Set up the base style as a fallback for everything. var baseStyle = new LineBlockStyle(); baseStyle.MarginStyles.Add(LineNumberStyle); var marginStyle = new LineBlockStyle(baseStyle); // Set the default text style. var textStyle = new LineBlockStyle(baseStyle); textStyle.Margins.Top = 4; textStyle.Margins.Bottom = 4; textStyle.Margins.Left = 8; MarginBlockStyle lineNumberStyle = textStyle.MarginStyles.Add( LineNumberStyle); lineNumberStyle.Alignment = Alignment.Right; lineNumberStyle.BackgroundColor = new Color(0.9, 0.9, 0.9); lineNumberStyle.ForegroundColor = new Color(0.5, 0.5, 0.5); lineNumberStyle.Borders.Right = new Border(1, new Color(0.5, 0.5, 0.5)); lineNumberStyle.Padding.Right = 4; lineNumberStyle.Padding.Left = 4; lineNumberStyle.Padding.Top = 4; lineNumberStyle.Padding.Bottom = 4; lineNumberStyle.Margins.Right = 0; // Store the styles in the theme. lineStyles[BaseStyleName] = baseStyle; lineStyles[MarginStyle] = marginStyle; lineStyles[TextStyle] = textStyle; // Common region styles for the editor. regionStyles = new BlockStyleDictionary <RegionBlockStyle>(); var backgroundRegionStyle = new RegionBlockStyle(); backgroundRegionStyle.BackgroundColor = new Color(1, 1, 1); regionStyles[BackgroundRegionStyleName] = backgroundRegionStyle; var currentLineRegionStyle = new RegionBlockStyle(); currentLineRegionStyle.BackgroundColor = new Color( 255 / 255.0, 250 / 255.0, 205 / 255.0); regionStyles[CurrentLineRegionStyleName] = currentLineRegionStyle; var currentWrappedLineRegionStyle = new RegionBlockStyle(); currentWrappedLineRegionStyle.BackgroundColor = new Color( 238 / 255.0, 233 / 255.0, 191 / 255.0); regionStyles[CurrentWrappedLineRegionStyleName] = currentWrappedLineRegionStyle; // Indicator styles. indicatorStyles = new IDictionary.Dictionary <string, IndicatorStyle>(); }