// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Media;
namespace ICSharpCode.SharpDevelop.Editor
{
///
/// Represents a text marker.
///
public interface ITextMarker
{
///
/// Gets the start offset of the marked text region.
///
int StartOffset { get; }
///
/// Gets the end offset of the marked text region.
///
int EndOffset { get; }
///
/// Gets the length of the marked region.
///
int Length { get; }
///
/// Deletes the text marker.
///
void Delete();
///
/// Gets whether the text marker was deleted.
///
bool IsDeleted { get; }
///
/// Event that occurs when the text marker is deleted.
///
event EventHandler Deleted;
///
/// Gets/Sets the background color.
///
Color? BackgroundColor { get; set; }
///
/// Gets/Sets the foreground color.
///
Color? ForegroundColor { get; set; }
///
/// Gets/Sets the font weight.
///
FontWeight? FontWeight { get; set; }
///
/// Gets/Sets the font style.
///
FontStyle? FontStyle { get; set; }
///
/// Gets/Sets the type of the marker. Use TextMarkerType.None for normal markers.
///
TextMarkerTypes MarkerTypes { get; set; }
///
/// Gets/Sets the color of the marker.
///
Color MarkerColor { get; set; }
///
/// Gets/Sets an object with additional data for this text marker.
///
object Tag { get; set; }
///
/// Gets/Sets an object that will be displayed as tooltip in the text editor.
///
object ToolTip { get; set; }
}
[Flags]
public enum TextMarkerTypes
{
///
/// Use no marker
///
None = 0x0000,
///
/// Use squiggly underline marker
///
SquigglyUnderline = 0x001,
///
/// Normal underline.
///
NormalUnderline = 0x002,
///
/// Horizontal line in the scroll bar.
///
LineInScrollBar = 0x0100,
///
/// Small triangle in the scroll bar, pointing to the right.
///
ScrollBarRightTriangle = 0x0400,
///
/// Small triangle in the scroll bar, pointing to the left.
///
ScrollBarLeftTriangle = 0x0800,
///
/// Small circle in the scroll bar.
///
CircleInScrollBar = 0x1000
}
[DocumentService]
public interface ITextMarkerService
{
///
/// Creates a new text marker. The text marker will be invisible at first,
/// you need to set one of the Color properties to make it visible.
///
ITextMarker Create(int startOffset, int length);
///
/// Gets the list of text markers.
///
IEnumerable TextMarkers { get; }
///
/// Removes the specified text marker.
///
void Remove(ITextMarker marker);
///
/// Removes all text markers that match the condition.
///
void RemoveAll(Predicate predicate);
///
/// Finds all text markers at the specified offset.
///
IEnumerable GetMarkersAtOffset(int offset);
}
}