// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using ICSharpCode.NRefactory.CSharp;
namespace ILSpy.Debugger.AvalonEdit.Editor
{
///
/// Represents an anchored location inside an .
///
public interface ITextAnchor
{
///
/// Gets the text location of this anchor.
///
/// Thrown when trying to get the Offset from a deleted anchor.
AstLocation Location { get; }
///
/// Gets the offset of the text anchor.
///
/// Thrown when trying to get the Offset from a deleted anchor.
int Offset { get; }
///
/// Controls how the anchor moves.
///
AnchorMovementType MovementType { get; set; }
///
/// Specifies whether the anchor survives deletion of the text containing it.
/// false: The anchor is deleted when the a selection that includes the anchor is deleted.
/// true: The anchor is not deleted.
///
bool SurviveDeletion { get; set; }
///
/// Gets whether the anchor was deleted.
///
bool IsDeleted { get; }
///
/// Occurs after the anchor was deleted.
///
event EventHandler Deleted;
///
/// Gets the line number of the anchor.
///
/// Thrown when trying to get the Offset from a deleted anchor.
int Line { get; }
///
/// Gets the column number of this anchor.
///
/// Thrown when trying to get the Offset from a deleted anchor.
int Column { get; }
}
///
/// Defines how a text anchor moves.
///
public enum AnchorMovementType
{
///
/// When text is inserted at the anchor position, the type of the insertion
/// determines where the caret moves to. For normal insertions, the anchor will stay
/// behind the inserted text.
///
Default = ICSharpCode.AvalonEdit.Document.AnchorMovementType.Default,
///
/// Behaves like a start marker - when text is inserted at the anchor position, the anchor will stay
/// before the inserted text.
///
BeforeInsertion = ICSharpCode.AvalonEdit.Document.AnchorMovementType.BeforeInsertion,
///
/// Behave like an end marker - when text is insered at the anchor position, the anchor will move
/// after the inserted text.
///
AfterInsertion = ICSharpCode.AvalonEdit.Document.AnchorMovementType.AfterInsertion
}
}