1 // Permission is hereby granted, free of charge, to any person obtaining
2 // a copy of this software and associated documentation files (the
3 // "Software"), to deal in the Software without restriction, including
4 // without limitation the rights to use, copy, modify, merge, publish,
5 // distribute, sublicense, and/or sell copies of the Software, and to
6 // permit persons to whom the Software is furnished to do so, subject to
7 // the following conditions:
9 // The above copyright notice and this permission notice shall be
10 // included in all copies or substantial portions of the Software.
12 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 // Copyright (c) 2004-2005 Novell, Inc.
23 // Jonathan Chambers (jonathan.chambers@ansys.com)
29 using System.Windows.Forms;
30 using System.ComponentModel;
33 namespace System.Windows.Forms.PropertyGridInternal
35 internal class GridEntry : GridItem
37 #region Local Variables
38 private bool expanded = true;
39 private GridItemCollection grid_items;
40 private GridItem parent;
41 private PropertyDescriptor property_descriptor;
42 private object selected_object;
45 private Rectangle plus_minus_bounds;
46 private Rectangle bounds;
47 #endregion // Local Variables
50 public GridEntry() : base() {
51 plus_minus_bounds = new Rectangle(0,0,0,0);
52 bounds = new Rectangle(0,0,0,0);
54 grid_items = new GridItemCollection();
57 public GridEntry(object obj, PropertyDescriptor prop_desc) : this() {
58 selected_object = obj;
59 property_descriptor = prop_desc;
61 #endregion // Constructors
63 #region Public Instance Properties
64 public override bool Expandable
67 return grid_items.Count > 0;
71 public override bool Expanded
82 public override System.Windows.Forms.GridItemCollection GridItems
89 public override System.Windows.Forms.GridItemType GridItemType
92 return GridItemType.Property;
96 public override string Label
99 return property_descriptor.Name;
103 public override System.Windows.Forms.GridItem Parent
110 public override System.ComponentModel.PropertyDescriptor PropertyDescriptor
113 return property_descriptor;
117 public override object Value
120 object return_value = null;
121 if (selected_object != null)
122 return_value = property_descriptor.GetValue(selected_object);
126 #endregion // Public Instance Properties
128 #region Public Instance Methods
130 public override bool Select () {
131 throw new NotImplementedException();
133 #endregion // Public Instance Methods
135 internal override int Top {
144 internal override Rectangle PlusMinusBounds {
146 return plus_minus_bounds;
149 plus_minus_bounds = value;
153 internal override Rectangle Bounds