#region Disclaimer / License
// Copyright (C) 2012, Jackie Ng
// http://trac.osgeo.org/mapguide/wiki/maestro, jumpinjackie@gmail.com
//
// Original code from SharpDevelop 3.2.1 licensed under the same terms (LGPL 2.1)
// Copyright 2002-2010 by
//
// AlphaSierraPapa, Christoph Wille
// Vordernberger Strasse 27/8
// A-8700 Leoben
// Austria
//
// email: office@alphasierrapapa.com
// court of jurisdiction: Landesgericht Leoben
//
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
#endregion
using ICSharpCode.TextEditor;
using ICSharpCode.TextEditor.Document;
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
namespace Maestro.Editors.Common
{
///
/// A text editor controller interface that supports auto-completion. Note that
/// all the methods will be called on another thread not the main UI thread and will therefore need to
/// be invoked.
///
public interface ITextEditor
{
///
/// Fired when a key is pressed but before any text has been added to the text editor.
///
///
/// The KeyPress handler should return true if the text editor should not process the key and not
/// insert any text.
///
event KeyEventHandler KeyPress;
///
/// Fired when dialog key is pressed but before any text has been added to the text editor.
///
///
/// The DialogKeyPress handler should return true if the text editor should not process the
/// dialog key.
///
event DialogKeyProcessor DialogKeyPress;
///
/// Gets or sets the indentation style.
///
IndentStyle IndentStyle { get; set; }
///
/// Inserts text at the current cursor location.
///
void Write(string text);
///
/// Inserts text at the current cursor location with the specified colour.
///
void Write(string text, Color backgroundColor);
///
/// Inserts text at the current cursor location with the specified colour.
///
void Write(string text, Color backgroundColor, Color foregroundColor);
///
/// Replaces the text at the specified index on the current line with the specified text.
///
void Replace(int index, int length, string text);
///
/// Gets or sets the current column position of the cursor on the current line. This is zero based.
///
int Column { get; set; }
///
/// Gets the length of the currently selected text.
///
int SelectionLength { get; }
///
/// Gets the start position of the currently selected text.
///
int SelectionStart { get; }
///
/// Gets the current line the cursor is on. This is zero based.
///
int Line { get; }
///
/// Gets the total number of lines in the text editor.
///
int TotalLines { get; }
///
/// Gets the text for the specified line.
///
string GetLine(int index);
///
/// Shows the code completion window.
///
void ShowCompletionWindow(ICompletionDataProvider completionDataProvider);
///
/// Shows the code completion window
///
///
/// The character just entered
void ShowCompletionWindow(ICompletionDataProvider completionDataProvider, char enteredChar);
///
/// Indicates whether the completion window is currently being displayed.
///
bool IsCompletionWindowDisplayed { get; }
///
/// Makes the current text content read only. Text can be entered at the end.
///
void MakeCurrentContentReadOnly();
///
/// Perform custom key press handling
///
///
bool ProcessKeyPress(System.Windows.Forms.Keys keyData);
///
/// Sets the parent control for this editor
///
///
void SetParent(System.Windows.Forms.Control ctrl);
}
}