PageRenderTime 18ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/ILSpy.SharpDevelop.LGPL/AvalonEdit/ITextMarker.cs

http://github.com/icsharpcode/ILSpy
C# | 123 lines | 36 code | 21 blank | 66 comment | 0 complexity | 5f204804d032b80be60edd77bc21c530 MD5 | raw file
  1// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
  2// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
  3
  4using System;
  5using System.Collections.Generic;
  6using System.Windows.Media;
  7
  8using ICSharpCode.ILSpy.Bookmarks;
  9
 10namespace ICSharpCode.ILSpy.AvalonEdit
 11{
 12	/// <summary>
 13	/// Represents a text marker.
 14	/// </summary>
 15	public interface ITextMarker
 16	{
 17		/// <summary>
 18		/// Gets the start offset of the marked text region.
 19		/// </summary>
 20		int StartOffset { get; }
 21		
 22		/// <summary>
 23		/// Gets the end offset of the marked text region.
 24		/// </summary>
 25		int EndOffset { get; }
 26		
 27		/// <summary>
 28		/// Gets the length of the marked region.
 29		/// </summary>
 30		int Length { get; }
 31		
 32		/// <summary>
 33		/// Deletes the text marker.
 34		/// </summary>
 35		void Delete();
 36		
 37		/// <summary>
 38		/// Gets whether the text marker was deleted.
 39		/// </summary>
 40		bool IsDeleted { get; }
 41		
 42		/// <summary>
 43		/// Event that occurs when the text marker is deleted.
 44		/// </summary>
 45		event EventHandler Deleted;
 46		
 47		/// <summary>
 48		/// Gets/Sets the background color.
 49		/// </summary>
 50		Color? BackgroundColor { get; set; }
 51		
 52		/// <summary>
 53		/// Gets/Sets the foreground color.
 54		/// </summary>
 55		Color? ForegroundColor { get; set; }
 56		
 57		/// <summary>
 58		/// Gets/Sets the type of the marker. Use TextMarkerType.None for normal markers.
 59		/// </summary>
 60		TextMarkerType MarkerType { get; set; }
 61		
 62		/// <summary>
 63		/// Gets/Sets the color of the marker.
 64		/// </summary>
 65		Color MarkerColor { get; set; }
 66		
 67		/// <summary>
 68		/// Gets/Sets an object with additional data for this text marker.
 69		/// </summary>
 70		object Tag { get; set; }
 71		
 72		/// <summary>
 73		/// Gets/Sets an object that will be displayed as tooltip in the text editor.
 74		/// </summary>
 75		object ToolTip { get; set; }
 76		
 77		/// <summary>
 78		/// Gets or sets if the marker is visible or not.
 79		/// </summary>
 80		Predicate<object> IsVisible { get; set; }
 81		
 82		/// <summary>
 83		/// Gets or sets the bookmark.
 84		/// </summary>
 85		IBookmark Bookmark { get; set; }
 86	}
 87	
 88	public enum TextMarkerType
 89	{
 90		/// <summary>
 91		/// Use no marker
 92		/// </summary>
 93		None,
 94		/// <summary>
 95		/// Use squiggly underline marker
 96		/// </summary>
 97		SquigglyUnderline
 98	}
 99	
100	public interface ITextMarkerService
101	{
102		/// <summary>
103		/// Creates a new text marker. The text marker will be invisible at first,
104		/// you need to set one of the Color properties to make it visible.
105		/// </summary>
106		ITextMarker Create(int startOffset, int length);
107		
108		/// <summary>
109		/// Gets the list of text markers.
110		/// </summary>
111		IEnumerable<ITextMarker> TextMarkers { get; }
112		
113		/// <summary>
114		/// Removes the specified text marker.
115		/// </summary>
116		void Remove(ITextMarker marker);
117		
118		/// <summary>
119		/// Removes all text markers that match the condition.
120		/// </summary>
121		void RemoveAll(Predicate<ITextMarker> predicate);
122	}
123}