GridEntry.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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:
  8. //
  9. // The above copyright notice and this permission notice shall be
  10. // included in all copies or substantial portions of the Software.
  11. //
  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.
  19. //
  20. // Copyright (c) 2004-2005 Novell, Inc.
  21. //
  22. // Authors:
  23. // Jonathan Chambers ([email protected])
  24. //
  25. // NOT COMPLETE
  26. using System;
  27. using System.Windows.Forms;
  28. using System.ComponentModel;
  29. using System.Drawing;
  30. namespace System.Windows.Forms.PropertyGridInternal
  31. {
  32. internal class GridEntry : GridItem
  33. {
  34. #region Local Variables
  35. private bool expanded = true;
  36. private GridItemCollection grid_items;
  37. private GridItem parent;
  38. private PropertyDescriptor property_descriptor;
  39. private object selected_object;
  40. private string label;
  41. private int top;
  42. private Rectangle plus_minus_bounds;
  43. #endregion // Local Variables
  44. #region Contructors
  45. public GridEntry() : base() {
  46. plus_minus_bounds = new Rectangle(0,0,0,0);
  47. top = -1;
  48. grid_items = new GridItemCollection();
  49. }
  50. public GridEntry(object obj, PropertyDescriptor prop_desc) : this() {
  51. selected_object = obj;
  52. property_descriptor = prop_desc;
  53. }
  54. #endregion // Constructors
  55. #region Public Instance Properties
  56. public override bool Expandable
  57. {
  58. get {
  59. return grid_items.Count > 0;
  60. }
  61. }
  62. public override bool Expanded
  63. {
  64. get {
  65. return expanded;
  66. }
  67. set {
  68. expanded = value;
  69. }
  70. }
  71. public override System.Windows.Forms.GridItemCollection GridItems
  72. {
  73. get {
  74. return grid_items;
  75. }
  76. }
  77. public override System.Windows.Forms.GridItemType GridItemType
  78. {
  79. get {
  80. return GridItemType.Property;
  81. }
  82. }
  83. public override string Label
  84. {
  85. get {
  86. return property_descriptor.Name;
  87. }
  88. }
  89. public override System.Windows.Forms.GridItem Parent
  90. {
  91. get {
  92. return parent;
  93. }
  94. }
  95. public override System.ComponentModel.PropertyDescriptor PropertyDescriptor
  96. {
  97. get {
  98. return property_descriptor;
  99. }
  100. }
  101. public override object Value
  102. {
  103. get {
  104. object return_value = null;
  105. if (selected_object != null)
  106. return_value = property_descriptor.GetValue(selected_object);
  107. return return_value;
  108. }
  109. }
  110. #endregion // Public Instance Properties
  111. #region Public Instance Methods
  112. [MonoTODO]
  113. public override bool Select () {
  114. throw new NotImplementedException();
  115. }
  116. #endregion // Public Instance Methods
  117. internal override int Top {
  118. get {
  119. return top;
  120. }
  121. set {
  122. top = value;
  123. }
  124. }
  125. internal override Rectangle PlusMinusBounds {
  126. get{
  127. return plus_minus_bounds;
  128. }
  129. set{
  130. plus_minus_bounds = value;
  131. }
  132. }
  133. }
  134. }