[12473] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[17180] | 3 | * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[12473] | 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 |
|
---|
| 22 | using System;
|
---|
| 23 | using System.CodeDom.Compiler;
|
---|
| 24 | using System.Collections.Generic;
|
---|
| 25 | using System.Reflection;
|
---|
| 26 | using System.Threading.Tasks;
|
---|
[12659] | 27 | using System.Windows.Forms;
|
---|
[12473] | 28 | using HeuristicLab.Common;
|
---|
| 29 | using ICSharpCode.NRefactory.TypeSystem;
|
---|
| 30 |
|
---|
| 31 | namespace HeuristicLab.CodeEditor {
|
---|
[12659] | 32 | public class CodeEditorBase : UserControl {
|
---|
[12473] | 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 |
|
---|
[16528] | 59 | public virtual void ClearEditHistory() { }
|
---|
| 60 |
|
---|
[12473] | 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 | }
|
---|