Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.CodeEditor/3.4/CodeEditorBase.cs @ 12473

Last change on this file since 12473 was 12473, checked in by ascheibe, 9 years ago

#2329 added a simple code editor for Linux

File size: 4.3 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab 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 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab 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 HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.CodeDom.Compiler;
24using System.Collections.Generic;
25using System.Reflection;
26using System.Threading.Tasks;
27using HeuristicLab.Common;
28using ICSharpCode.NRefactory.TypeSystem;
29
30namespace HeuristicLab.CodeEditor {
31  public class CodeEditorBase : System.Windows.Forms.UserControl {
32    public virtual string UserCode { get; set; }
33
34    public virtual string Prefix { get; set; }
35
36    public virtual string Suffix { get; set; }
37
38    public virtual bool ReadOnly { get; set; }
39
40    public virtual bool Locked { get; set; }
41
42    public virtual void AddAssemblies(IEnumerable<Assembly> assemblies) { }
43
44    public virtual Task AddAssembliesAsync(IEnumerable<Assembly> assemblies) {
45      return null;
46    }
47
48    public virtual void AddAssembly(Assembly assembly) { }
49
50    public virtual void RemoveAssembly(Assembly assembly) { }
51
52    public virtual void RemoveAssemblies(IEnumerable<Assembly> assemblies) { }
53
54    public virtual void ScrollAfterPrefix() { }
55
56    public virtual void ScrollToPosition(int line, int column) { }
57
58    public virtual void ShowCompileErrors(CompilerErrorCollection compileErrors) { }
59
60    #region Events
61    public event EventHandler TextEditorTextChanged;
62    protected virtual void TextEditor_TextChanged(object sender, EventArgs e) {
63      if (TextEditorTextChanged != null) {
64        TextEditorTextChanged(this, new EventArgs());
65      }
66    }
67    protected virtual void OnTextEditorTextChanged() {
68      var handler = TextEditorTextChanged;
69      if (handler != null) handler(this, EventArgs.Empty);
70    }
71
72    public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesLoading;
73    protected virtual void OnAssembliesLoading(IEnumerable<Assembly> args) {
74      var handler = AssembliesLoading;
75      if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));
76    }
77
78    public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesLoaded;
79    protected virtual void OnAssembliesLoaded(IEnumerable<Assembly> args) {
80      var handler = AssembliesLoaded;
81      if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));
82    }
83
84    public event EventHandler<EventArgs<IEnumerable<IUnresolvedAssembly>>> InternalAssembliesLoaded;
85    protected virtual void OnInternalAssembliesLoaded(IEnumerable<IUnresolvedAssembly> args) {
86      var handler = InternalAssembliesLoaded;
87      if (handler != null) handler(this, new EventArgs<IEnumerable<IUnresolvedAssembly>>(args));
88    }
89
90    public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesUnloading;
91    protected virtual void OnAssembliesUnloading(IEnumerable<Assembly> args) {
92      var handler = AssembliesUnloading;
93      if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));
94    }
95
96    public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesUnloaded;
97    protected virtual void OnAssembliesUnloaded(IEnumerable<Assembly> args) {
98      var handler = AssembliesUnloaded;
99      if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));
100    }
101
102    public event EventHandler<EventArgs<IEnumerable<IUnresolvedAssembly>>> InternalAssembliesUnloaded;
103    protected virtual void OnInternalAssembliesUnloaded(IEnumerable<IUnresolvedAssembly> args) {
104      var handler = InternalAssembliesUnloaded;
105      if (handler != null) handler(this, new EventArgs<IEnumerable<IUnresolvedAssembly>>(args));
106    }
107    #endregion
108  }
109}
Note: See TracBrowser for help on using the repository browser.