source: trunk/CrypPlugins/WorkspaceManager/Model/VisualElementModel.cs @ 1878

Last change on this file since 1878 was 1878, checked in by kopal, 11 years ago
  • ModelElements like WorkspaceModel and PluginModel now have a Parent which also is a PluginModel or a WorkspaceModel
  • PluginModel now have a method to get all "children" (other PluginModels having this one as Parent)
File size: 3.0 KB
Line 
1/*                             
2   Copyright 2010 Nils Kopal, Viktor M.
3
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7
8       http://www.apache.org/licenses/LICENSE-2.0
9
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15*/
16
17
18using System;
19using System.Collections.Generic;
20using System.Linq;
21using System.Text;
22using System.Windows;
23using WorkspaceManager.View.Interface;
24
25namespace WorkspaceManager.Model
26{
27    /// <summary>
28    /// Abstract super class for all Model Elements which will have
29    /// a representation by a View class. It is needed to represent
30    /// Coordinates and Dimensions
31    /// </summary>
32    [Serializable]
33    public abstract class VisualElementModel
34    {
35        /// <summary>
36        /// Called when this object is deleted
37        /// </summary>
38        [field: NonSerialized]
39        public event EventHandler<EventArgs> OnDelete;
40
41        /// <summary>
42        /// Triggers event OnDelete
43        /// </summary>
44        public void onDelete(){
45            if(OnDelete != null){
46                EventArgs args = new EventArgs();         
47                OnDelete.Invoke(this, args);
48            }
49        }
50
51        /// <summary>
52        /// Current Position of this VisualElementModel
53        /// </summary>
54        public Point Position;
55
56        /// <summary>
57        /// Minimum Width of this VisualElementModel
58        /// </summary>
59        public double MinWidth = 150;
60       
61        /// <summary>
62        /// Minimum Height of this VisualElementModel
63        /// </summary>     
64        public double MinHeight = 150;
65
66        /// <summary>
67        /// Width of this VisualElementModel
68        /// </summary>
69        public double Width = 150;
70
71        /// <summary>
72        /// Height of this VisualElementModel
73        /// </summary>
74        public double Height = 150;
75
76        /// <summary>
77        /// Name of this VisualElementModel
78        /// </summary>
79        public string Name;
80
81        /// <summary>
82        /// Indicates that this Model Element needs a GUI Update
83        /// </summary>
84        public Boolean GuiNeedsUpdate { get; set; }
85
86        /// <summary>
87        /// View Element of this VisualElement
88        /// </summary>
89        [NonSerialized]
90        public IUpdateableView UpdateableView = null;
91
92        private VisualElementModel parent = null;
93        /// <summary>
94        /// Get/Set the Parent of this VisualElementModel
95        /// </summary>
96        public VisualElementModel Parent
97        {
98            get { return this.parent; }
99            set { this.parent = value; }
100        }
101    }
102}
Note: See TracBrowser for help on using the repository browser.