/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. using System;
  4. using System.Collections.Generic;
  5. using System.Windows.Media;
  6. using ICSharpCode.ILSpy.Bookmarks;
  7. namespace ICSharpCode.ILSpy.AvalonEdit
  8. {
  9. /// <summary>
  10. /// Represents a text marker.
  11. /// </summary>
  12. public interface ITextMarker
  13. {
  14. /// <summary>
  15. /// Gets the start offset of the marked text region.
  16. /// </summary>
  17. int StartOffset { get; }
  18. /// <summary>
  19. /// Gets the end offset of the marked text region.
  20. /// </summary>
  21. int EndOffset { get; }
  22. /// <summary>
  23. /// Gets the length of the marked region.
  24. /// </summary>
  25. int Length { get; }
  26. /// <summary>
  27. /// Deletes the text marker.
  28. /// </summary>
  29. void Delete();
  30. /// <summary>
  31. /// Gets whether the text marker was deleted.
  32. /// </summary>
  33. bool IsDeleted { get; }
  34. /// <summary>
  35. /// Event that occurs when the text marker is deleted.
  36. /// </summary>
  37. event EventHandler Deleted;
  38. /// <summary>
  39. /// Gets/Sets the background color.
  40. /// </summary>
  41. Color? BackgroundColor { get; set; }
  42. /// <summary>
  43. /// Gets/Sets the foreground color.
  44. /// </summary>
  45. Color? ForegroundColor { get; set; }
  46. /// <summary>
  47. /// Gets/Sets the type of the marker. Use TextMarkerType.None for normal markers.
  48. /// </summary>
  49. TextMarkerType MarkerType { get; set; }
  50. /// <summary>
  51. /// Gets/Sets the color of the marker.
  52. /// </summary>
  53. Color MarkerColor { get; set; }
  54. /// <summary>
  55. /// Gets/Sets an object with additional data for this text marker.
  56. /// </summary>
  57. object Tag { get; set; }
  58. /// <summary>
  59. /// Gets/Sets an object that will be displayed as tooltip in the text editor.
  60. /// </summary>
  61. object ToolTip { get; set; }
  62. /// <summary>
  63. /// Gets or sets if the marker is visible or not.
  64. /// </summary>
  65. Predicate<object> IsVisible { get; set; }
  66. /// <summary>
  67. /// Gets or sets the bookmark.
  68. /// </summary>
  69. IBookmark Bookmark { get; set; }
  70. }
  71. public enum TextMarkerType
  72. {
  73. /// <summary>
  74. /// Use no marker
  75. /// </summary>
  76. None,
  77. /// <summary>
  78. /// Use squiggly underline marker
  79. /// </summary>
  80. SquigglyUnderline
  81. }
  82. public interface ITextMarkerService
  83. {
  84. /// <summary>
  85. /// Creates a new text marker. The text marker will be invisible at first,
  86. /// you need to set one of the Color properties to make it visible.
  87. /// </summary>
  88. ITextMarker Create(int startOffset, int length);
  89. /// <summary>
  90. /// Gets the list of text markers.
  91. /// </summary>
  92. IEnumerable<ITextMarker> TextMarkers { get; }
  93. /// <summary>
  94. /// Removes the specified text marker.
  95. /// </summary>
  96. void Remove(ITextMarker marker);
  97. /// <summary>
  98. /// Removes all text markers that match the condition.
  99. /// </summary>
  100. void RemoveAll(Predicate<ITextMarker> predicate);
  101. }
  102. }