Free cookie consent management tool by TermsFeed Policy Generator

source: stable/HeuristicLab.CodeEditor/3.4/CodeEditorBase.cs @ 17563

Last change on this file since 17563 was 17181, checked in by swagner, 5 years ago

#2875: Merged r17180 from trunk to stable

File size: 4.1 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 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 System.Windows.Forms;
28using HeuristicLab.Common;
29using ICSharpCode.NRefactory.TypeSystem;
30
31namespace HeuristicLab.CodeEditor {
32  public class CodeEditorBase : UserControl {
33    public virtual string UserCode { get; set; }
34
35    public virtual string Prefix { get; set; }
36
37    public virtual string Suffix { get; set; }
38
39    public virtual bool ReadOnly { get; set; }
40
41    public virtual bool Locked { get; set; }
42
43    public virtual void AddAssemblies(IEnumerable<Assembly> assemblies) { }
44
45    public virtual Task AddAssembliesAsync(IEnumerable<Assembly> assemblies) {
46      return null;
47    }
48
49    public virtual void AddAssembly(Assembly assembly) { }
50
51    public virtual void RemoveAssembly(Assembly assembly) { }
52
53    public virtual void RemoveAssemblies(IEnumerable<Assembly> assemblies) { }
54
55    public virtual void ScrollAfterPrefix() { }
56
57    public virtual void ScrollToPosition(int line, int column) { }
58
59    public virtual void ClearEditHistory() { }
60
61    public virtual void ShowCompileErrors(CompilerErrorCollection compileErrors) { }
62
63    #region Events
64    public event EventHandler TextEditorTextChanged;
65    protected virtual void OnTextEditorTextChanged() {
66      var handler = TextEditorTextChanged;
67      if (handler != null) handler(this, EventArgs.Empty);
68    }
69
70    public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesLoading;
71    protected virtual void OnAssembliesLoading(IEnumerable<Assembly> args) {
72      var handler = AssembliesLoading;
73      if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));
74    }
75
76    public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesLoaded;
77    protected virtual void OnAssembliesLoaded(IEnumerable<Assembly> args) {
78      var handler = AssembliesLoaded;
79      if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));
80    }
81
82    public event EventHandler<EventArgs<IEnumerable<IUnresolvedAssembly>>> InternalAssembliesLoaded;
83    protected virtual void OnInternalAssembliesLoaded(IEnumerable<IUnresolvedAssembly> args) {
84      var handler = InternalAssembliesLoaded;
85      if (handler != null) handler(this, new EventArgs<IEnumerable<IUnresolvedAssembly>>(args));
86    }
87
88    public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesUnloading;
89    protected virtual void OnAssembliesUnloading(IEnumerable<Assembly> args) {
90      var handler = AssembliesUnloading;
91      if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));
92    }
93
94    public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesUnloaded;
95    protected virtual void OnAssembliesUnloaded(IEnumerable<Assembly> args) {
96      var handler = AssembliesUnloaded;
97      if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));
98    }
99
100    public event EventHandler<EventArgs<IEnumerable<IUnresolvedAssembly>>> InternalAssembliesUnloaded;
101    protected virtual void OnInternalAssembliesUnloaded(IEnumerable<IUnresolvedAssembly> args) {
102      var handler = InternalAssembliesUnloaded;
103      if (handler != null) handler(this, new EventArgs<IEnumerable<IUnresolvedAssembly>>(args));
104    }
105    #endregion
106  }
107}
Note: See TracBrowser for help on using the repository browser.