* Makefile.am:
[monodevelop.git] / extras / GtkSourceViewEditor / MonoDevelop.SourceEditor.Actions / IEditAction.cs
blobd6ba76f19dea4780ed7fab24408a316c708fa4e9
1 // IEditAction.cs
2 //
3 // This file was derived from a file from #Develop.
4 //
5 // Copyright (C) 2001-2007 Mike Krüger <mkrueger@novell.com>
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 using System;
22 using MonoDevelop.SourceEditor.Gui;
24 namespace MonoDevelop.SourceEditor.Actions
26 /// <summary>
27 /// To define a new key for the textarea, you must write a class which
28 /// implements this interface.
29 /// </summary>
30 public interface IEditAction
32 /// <value>
33 /// Whether to pass the event to the base editor
34 /// <value>
35 bool PassToBase {
36 get;
37 set;
40 /// <value>
41 /// An array of keys on which this edit action occurs.
42 /// </value>
43 Gdk.Key Key {
44 get;
45 set;
48 Gdk.ModifierType State {
49 get;
50 set;
53 /// <remarks>
54 /// When the key which is defined in the addin is pressed, this method will be invoked.
55 /// </remarks>
56 void Execute (SourceEditorView sourceView);
58 /// <remarks>
59 /// Invoked before the Execute method
60 /// <remarks>
61 void PreExecute (SourceEditorView sourceView);
63 /// <remarks>
64 /// Invoked after the Execute method
65 /// <remarks>
66 void PostExecute (SourceEditorView sourceView);
69 /// <summary>
70 /// To define a new key for the textarea, you must write a class which
71 /// implements this interface.
72 /// </summary>
73 public abstract class AbstractEditAction : IEditAction
75 Gdk.ModifierType modifier = Gdk.ModifierType.None;
76 Gdk.Key key;
77 bool pass = false;
79 // whether to pass the event to the base editor
80 public bool PassToBase {
81 get { return pass; }
82 set { pass = value; }
85 /// <value>
86 /// An array of keys on which this edit action occurs.
87 /// </value>
88 public Gdk.Key Key
90 get { return key; }
91 set { key = value; }
94 public Gdk.ModifierType State {
95 get { return modifier; }
96 set { modifier = value; }
99 /// <remarks>
100 /// When the key which is defined in the addin is pressed, this method will be invoked.
101 /// </remarks>
102 public abstract void Execute (SourceEditorView sourceView);
104 /// <remarks>
105 /// When the key which is defined in the addin is pressed,
106 /// this method will be invoked before Execute ().
107 /// </remarks>
108 public virtual void PreExecute (SourceEditorView sourceView)
112 /// <remarks>
113 /// When the key which is defined in the addin is pressed,
114 /// this method will be invoked after Execute ().
115 /// </remarks>
116 public virtual void PostExecute (SourceEditorView sourceView)
118 // reset the state
119 pass = false;