Changeset 4068 for trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/PropertySystem/Descriptors/ShapeBaseDescriptor.cs
- Timestamp:
- 07/22/10 00:44:01 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/Netron.Diagramming.Core-3.0.2672.12446/PropertySystem/Descriptors/ShapeBaseDescriptor.cs
r2768 r4068 1 1 using System; 2 2 using System.Drawing; 3 using System.Collections.Generic;4 using System.Text;5 using System.ComponentModel;6 3 using System.Drawing.Design; 7 namespace Netron.Diagramming.Core 8 { 4 namespace Netron.Diagramming.Core { 5 /// <summary> 6 /// Abstract base class for more specialized instances of the <see cref="ShapeBase"/> class. 7 /// </summary> 8 abstract class ShapeBaseDescriptor : DiagramEntityBaseDescriptor { 9 10 #region Constants 11 #endregion 12 13 #region Fields 14 15 #endregion 16 17 #region Properties 18 19 #endregion 20 21 #region Constructor 9 22 /// <summary> 10 /// Abstract base class for more specialized instances of the <see cref="ShapeBase"/> class.23 /// Initializes a new instance of the <see cref="ShapeBaseDescriptor"/> class. 11 24 /// </summary> 12 abstract class ShapeBaseDescriptor : DiagramEntityBaseDescriptor 13 { 25 /// <param name="provider">The provider.</param> 26 /// <param name="objectType">Type of the object.</param> 27 public ShapeBaseDescriptor(ShapeProvider provider, Type objectType) 28 : base(provider, objectType) { 29 AddBaseProperties(); 30 } 31 #endregion 14 32 15 #region Constants 16 #endregion 17 18 #region Fields 19 20 #endregion 21 22 #region Properties 23 24 #endregion 25 26 #region Constructor 27 /// <summary> 28 /// Initializes a new instance of the <see cref="ShapeBaseDescriptor"/> class. 29 /// </summary> 30 /// <param name="provider">The provider.</param> 31 /// <param name="objectType">Type of the object.</param> 32 public ShapeBaseDescriptor(ShapeProvider provider, Type objectType) 33 : base(provider, objectType) 34 { 35 AddBaseProperties(); 36 } 37 #endregion 38 39 #region Methods 40 /// <summary> 41 /// Adds the properties of the <see cref="ShapeBase"/> 42 /// </summary> 43 private void AddBaseProperties() 44 { 45 this.AddProperty("Width", typeof(int), constLayout, "The width of the shape."); 46 this.AddProperty("Height", typeof(int), constLayout, "The height of the shape."); 47 this.AddProperty("Location", typeof(Point), constLayout, "The location of the shape.", Point.Empty, typeof(UITypeEditor), typeof(Netron.Diagramming.Core.PointConverter)); 48 } 33 #region Methods 34 /// <summary> 35 /// Adds the properties of the <see cref="ShapeBase"/> 36 /// </summary> 37 private void AddBaseProperties() { 38 this.AddProperty("Width", typeof(int), constLayout, "The width of the shape."); 39 this.AddProperty("Height", typeof(int), constLayout, "The height of the shape."); 40 this.AddProperty("Location", typeof(Point), constLayout, "The location of the shape.", Point.Empty, typeof(UITypeEditor), typeof(Netron.Diagramming.Core.PointConverter)); 41 } 49 42 50 43 51 /// <summary> 52 /// Override this method to return the appropriate value corresponding to the property 53 /// </summary> 54 /// <param name="sender"></param> 55 /// <param name="e"></param> 56 protected override void GetValue(object sender, PropertyEventArgs e) 57 { 58 base.GetValue(sender, e); 59 switch (e.Name.ToLower()) 60 { 61 case "width": 62 e.Value = (e.Component as ShapeBase).Width; 63 break; 64 case "height": 65 e.Value = (e.Component as ShapeBase).Height; 66 break; 67 case "location": 68 e.Value = (e.Component as ShapeBase).Location; 69 break; 44 /// <summary> 45 /// Override this method to return the appropriate value corresponding to the property 46 /// </summary> 47 /// <param name="sender"></param> 48 /// <param name="e"></param> 49 protected override void GetValue(object sender, PropertyEventArgs e) { 50 base.GetValue(sender, e); 51 switch (e.Name.ToLower()) { 52 case "width": 53 e.Value = (e.Component as ShapeBase).Width; 54 break; 55 case "height": 56 e.Value = (e.Component as ShapeBase).Height; 57 break; 58 case "location": 59 e.Value = (e.Component as ShapeBase).Location; 60 break; 70 61 71 62 72 63 } 73 64 74 65 75 66 } 76 67 77 68 78 69 79 /// <summary> 80 /// Override this method to set the appropriate value corresponding to the property 81 /// </summary> 82 /// <param name="sender"></param> 83 /// <param name="e"></param> 84 protected override void SetValue(object sender, PropertyEventArgs e) 85 { 86 base.SetValue(sender, e); 70 /// <summary> 71 /// Override this method to set the appropriate value corresponding to the property 72 /// </summary> 73 /// <param name="sender"></param> 74 /// <param name="e"></param> 75 protected override void SetValue(object sender, PropertyEventArgs e) { 76 base.SetValue(sender, e); 87 77 88 switch (e.Name.ToLower()) 89 { 90 case "width": 91 (e.Component as ShapeBase).Width = (int)e.Value; 92 break; 93 case "height": 94 (e.Component as ShapeBase).Height = (int)e.Value; 95 break; 96 case "location": 97 Point p = (Point)e.Value; 98 (e.Component as ShapeBase).Location = new Point(p.X, p.Y); 99 break; 100 } 101 } 78 switch (e.Name.ToLower()) { 79 case "width": 80 (e.Component as ShapeBase).Width = (int)e.Value; 81 break; 82 case "height": 83 (e.Component as ShapeBase).Height = (int)e.Value; 84 break; 85 case "location": 86 Point p = (Point)e.Value; 87 (e.Component as ShapeBase).Location = new Point(p.X, p.Y); 88 break; 89 } 90 } 102 91 103 92 104 105 93 #endregion 94 } 106 95 }
Note: See TracChangeset
for help on using the changeset viewer.