[3244] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[12009] | 3 | * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[3244] | 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.Drawing;
|
---|
| 23 |
|
---|
| 24 | namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views {
|
---|
[10520] | 25 | public class VisualTreeNode<T> where T : class {
|
---|
[3244] | 26 | private static readonly Color defaultLineColor = Color.Black;
|
---|
| 27 | private static readonly Color defaultTextColor = Color.Black;
|
---|
| 28 | private static readonly Color defaultFillColor = Color.White;
|
---|
| 29 | private const int defaultPreferredWidth = 70;
|
---|
| 30 | private const int defaultPreferredHeight = 46;
|
---|
| 31 |
|
---|
[10520] | 32 | public VisualTreeNode(T content) :
|
---|
| 33 | this(content, defaultLineColor) {
|
---|
[3244] | 34 | }
|
---|
| 35 |
|
---|
[10520] | 36 | public VisualTreeNode(T content, Color lineColor) :
|
---|
| 37 | this(content, lineColor, defaultTextColor) {
|
---|
[3244] | 38 | }
|
---|
| 39 |
|
---|
[10520] | 40 | public VisualTreeNode(T content, Color lineColor, Color textColor) :
|
---|
| 41 | this(content, lineColor, textColor, defaultFillColor) {
|
---|
[3244] | 42 | }
|
---|
| 43 |
|
---|
[10520] | 44 | public VisualTreeNode(T content, Color lineColor, Color textColor, Color fillColor) :
|
---|
| 45 | this(content, lineColor, textColor, fillColor, defaultPreferredWidth, defaultPreferredHeight) {
|
---|
[3244] | 46 | }
|
---|
| 47 |
|
---|
[10520] | 48 | public VisualTreeNode(T content, Color lineColor, Color textColor, Color fillColor, int width, int height) {
|
---|
| 49 | this.content = content;
|
---|
[3244] | 50 | this.lineColor = lineColor;
|
---|
| 51 | this.textColor = textColor;
|
---|
| 52 | this.fillColor = fillColor;
|
---|
| 53 | this.preferredWidth = width;
|
---|
| 54 | this.preferredHeight = height;
|
---|
[10520] | 55 | this.ToolTip = content.ToString();
|
---|
[3244] | 56 | }
|
---|
| 57 |
|
---|
| 58 | #region members for internal use only
|
---|
| 59 | private int x;
|
---|
| 60 | public int X {
|
---|
| 61 | get { return x; }
|
---|
| 62 | internal set { this.x = value; }
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | private int y;
|
---|
| 66 | public int Y {
|
---|
| 67 | get { return y; }
|
---|
| 68 | internal set { this.y = value; }
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | private int width;
|
---|
| 72 | public int Width {
|
---|
| 73 | get { return this.width; }
|
---|
| 74 | internal set { this.width = value; }
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | private int height;
|
---|
| 78 | public int Height {
|
---|
| 79 | get { return this.height; }
|
---|
| 80 | internal set { this.height = value; }
|
---|
| 81 | }
|
---|
| 82 | #endregion
|
---|
| 83 |
|
---|
[10520] | 84 | private T content;
|
---|
| 85 | public T Content {
|
---|
| 86 | get { return this.content; }
|
---|
[8980] | 87 | set {
|
---|
[10520] | 88 | content = value;
|
---|
| 89 | ToolTip = Content.ToString();
|
---|
[8980] | 90 | }
|
---|
[3244] | 91 | }
|
---|
| 92 |
|
---|
| 93 | private int preferredWidth;
|
---|
| 94 | public int PreferredWidth {
|
---|
| 95 | get { return this.preferredWidth; }
|
---|
| 96 | set { this.preferredWidth = value; }
|
---|
| 97 | }
|
---|
| 98 |
|
---|
| 99 | private int preferredHeight;
|
---|
| 100 | public int PreferredHeight {
|
---|
| 101 | get { return this.preferredHeight; }
|
---|
| 102 | set { this.preferredHeight = value; }
|
---|
| 103 | }
|
---|
| 104 |
|
---|
| 105 | private Color lineColor;
|
---|
| 106 | public Color LineColor {
|
---|
| 107 | get { return this.lineColor; }
|
---|
| 108 | set { this.lineColor = value; }
|
---|
| 109 | }
|
---|
| 110 |
|
---|
| 111 | private Color textColor;
|
---|
| 112 | public Color TextColor {
|
---|
| 113 | get { return this.textColor; }
|
---|
| 114 | set { this.textColor = value; }
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 | private Color fillColor;
|
---|
| 118 | public Color FillColor {
|
---|
| 119 | get { return this.fillColor; }
|
---|
| 120 | set { this.fillColor = value; }
|
---|
| 121 | }
|
---|
| 122 |
|
---|
| 123 | private string toolTip;
|
---|
| 124 | public string ToolTip {
|
---|
| 125 | get { return toolTip; }
|
---|
| 126 | set { toolTip = value; }
|
---|
| 127 | }
|
---|
| 128 | }
|
---|
| 129 | }
|
---|