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

Last change on this file since 1711 was 1711, checked in by kopal, 12 years ago
  • serialization of model now works (still needed view reconstruction using the deserialized model)
File size: 3.2 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 { get; set; }
55
56        private double minWidth=150;
57        /// <summary>
58        /// Minimum Width of this VisualElementModel
59        /// </summary>
60        public double MinWidth
61        {
62            get { return minWidth; }
63            set
64            {
65                if (value > 150)
66                {
67                    minWidth = value;
68                };
69            }
70        }
71
72        private double minHeight = 150;
73        /// <summary>
74        /// Minimum Height of this VisualElementModel
75        /// </summary>
76        public double MinHeight
77        {
78            get{ return minHeight; }
79            set
80            {
81                if (value > 150)
82                {
83                    minHeight = value;
84                };
85            }
86        }
87
88        /// <summary>
89        /// Width of this VisualElementModel
90        /// </summary>
91        public double Width { get; set; }
92
93        /// <summary>
94        /// Height of this VisualElementModel
95        /// </summary>
96        public double Height { get; set; }
97
98        /// <summary>
99        /// Name of this VisualElementModel
100        /// </summary>
101        public string Name { get; set; }
102
103        /// <summary>
104        /// Indicates that this Model Element needs a GUI Update
105        /// </summary>
106        public Boolean GuiNeedsUpdate { get; set; }
107
108        /// <summary>
109        /// View Element of this VisualElement
110        /// </summary>
111        [NonSerialized]
112        public IUpdateableView UpdateableView = null;
113    }
114
115}
Note: See TracBrowser for help on using the repository browser.