[12473] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[14186] | 3 | * Copyright (C) 2002-2016 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;
|
---|
[12662] | 27 | using System.Windows.Forms;
|
---|
[12473] | 28 | using HeuristicLab.Common;
|
---|
| 29 | using ICSharpCode.NRefactory.TypeSystem;
|
---|
| 30 |
|
---|
| 31 | namespace HeuristicLab.CodeEditor {
|
---|
[12662] | 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 |
|
---|
| 59 | public virtual void ShowCompileErrors(CompilerErrorCollection compileErrors) { }
|
---|
| 60 |
|
---|
| 61 | #region Events
|
---|
| 62 | public event EventHandler TextEditorTextChanged;
|
---|
| 63 | protected virtual void OnTextEditorTextChanged() {
|
---|
| 64 | var handler = TextEditorTextChanged;
|
---|
| 65 | if (handler != null) handler(this, EventArgs.Empty);
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesLoading;
|
---|
| 69 | protected virtual void OnAssembliesLoading(IEnumerable<Assembly> args) {
|
---|
| 70 | var handler = AssembliesLoading;
|
---|
| 71 | if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesLoaded;
|
---|
| 75 | protected virtual void OnAssembliesLoaded(IEnumerable<Assembly> args) {
|
---|
| 76 | var handler = AssembliesLoaded;
|
---|
| 77 | if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));
|
---|
| 78 | }
|
---|
| 79 |
|
---|
| 80 | public event EventHandler<EventArgs<IEnumerable<IUnresolvedAssembly>>> InternalAssembliesLoaded;
|
---|
| 81 | protected virtual void OnInternalAssembliesLoaded(IEnumerable<IUnresolvedAssembly> args) {
|
---|
| 82 | var handler = InternalAssembliesLoaded;
|
---|
| 83 | if (handler != null) handler(this, new EventArgs<IEnumerable<IUnresolvedAssembly>>(args));
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesUnloading;
|
---|
| 87 | protected virtual void OnAssembliesUnloading(IEnumerable<Assembly> args) {
|
---|
| 88 | var handler = AssembliesUnloading;
|
---|
| 89 | if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | public event EventHandler<EventArgs<IEnumerable<Assembly>>> AssembliesUnloaded;
|
---|
| 93 | protected virtual void OnAssembliesUnloaded(IEnumerable<Assembly> args) {
|
---|
| 94 | var handler = AssembliesUnloaded;
|
---|
| 95 | if (handler != null) handler(this, new EventArgs<IEnumerable<Assembly>>(args));
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | public event EventHandler<EventArgs<IEnumerable<IUnresolvedAssembly>>> InternalAssembliesUnloaded;
|
---|
| 99 | protected virtual void OnInternalAssembliesUnloaded(IEnumerable<IUnresolvedAssembly> args) {
|
---|
| 100 | var handler = InternalAssembliesUnloaded;
|
---|
| 101 | if (handler != null) handler(this, new EventArgs<IEnumerable<IUnresolvedAssembly>>(args));
|
---|
| 102 | }
|
---|
| 103 | #endregion
|
---|
| 104 | }
|
---|
| 105 | }
|
---|