//
//
//
//
// $Revision$
//
using System;
using System.Collections.Generic;
using System.Windows.Input;
using ICSharpCode.NRefactory;
using ICSharpCode.SharpDevelop.Editor.CodeCompletion;
namespace ICSharpCode.SharpDevelop.Editor
{
public interface ITextEditorProvider : IFileDocumentProvider
{
ITextEditor TextEditor {
get;
}
}
///
/// Interface for text editors.
///
public interface ITextEditor : IServiceProvider
{
///
/// Gets the primary view if split-view is active.
/// If split-view is disabled, the current ITextEditor instance is returned.
/// This property never returns null.
///
/// bool isSecondaryView = (editor != editor.PrimaryView);
ITextEditor PrimaryView { get; }
///
/// Gets the document that is being edited.
///
IDocument Document { get; }
///
/// Gets an object that represents the caret inside this text editor.
/// This property never returns null.
///
ITextEditorCaret Caret { get; }
///
/// Gets the set of options used in the text editor.
/// This property never returns null.
///
ITextEditorOptions Options { get; }
///
/// Gets the language binding attached to this text editor.
/// This property never returns null.
///
ILanguageBinding Language { get; }
///
/// Gets the start offset of the selection.
///
int SelectionStart { get; }
///
/// Gets the length of the selection.
///
int SelectionLength { get; }
///
/// Gets/Sets the selected text.
///
string SelectedText { get; set; }
///
/// Sets the selection.
///
/// Start offset of the selection
/// Length of the selection
void Select(int selectionStart, int selectionLength);
///
/// Is raised when the selection changes.
///
event EventHandler SelectionChanged;
///
/// Is raised before a key is pressed.
///
event KeyEventHandler KeyPress;
///
/// Sets the caret to the specified line/column and brings the caret into view.
///
void JumpTo(int line, int column);
string FileName { get; }
ICompletionListWindow ShowCompletionWindow(ICompletionItemList data);
///
/// Gets the completion window that is currently open.
///
ICompletionListWindow ActiveCompletionWindow { get; }
///
/// Open a new insight window showing the specified insight items.
///
/// The insight items to show in the window.
/// If this property is null or an empty list, the insight window will not be shown.
/// The insight window; or null if no insight window was opened.
IInsightWindow ShowInsightWindow(IEnumerable items);
///
/// Gets the insight window that is currently open.
///
IInsightWindow ActiveInsightWindow { get; }
[Obsolete("Use the overload taking ICompletionItemList")]
void ShowCompletionWindow(ICSharpCode.TextEditor.Gui.CompletionWindow.ICompletionDataProvider provider, char ch);
}
public interface ITextEditorOptions
{
///
/// Gets the text used for one indentation level.
///
string IndentationString { get; }
///
/// Gets whether a '}' should automatically be inserted when a block is opened.
///
bool AutoInsertBlockEnd { get; }
///
/// Gets if tabs should be converted to spaces.
///
bool ConvertTabsToSpaces { get; }
///
/// Gets the size of an indentation level.
///
int IndentationSize { get; }
///
/// Gets the column of the vertical ruler (line that signifies the maximum line length
/// defined by the coding style)
/// This property returns a valid value even if the vertical ruler is set to be invisible.
///
int VerticalRulerColumn { get; }
}
public interface ITextEditorCaret
{
///
/// Gets/Sets the caret offset;
///
int Offset { get; set; }
///
/// Gets/Sets the caret line number.
/// Line numbers are counted starting from 1.
///
int Line { get; set; }
///
/// Gets/Sets the caret column number.
/// Column numbers are counted starting from 1.
///
int Column { get; set; }
///
/// Gets/sets the caret position.
///
Location Position { get; set; }
///
/// Is raised whenever the position of the caret has changed.
///
event EventHandler PositionChanged;
}
}