MeasureItemEventArgs.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. //
  2. // System.Windows.Forms.MeasureItemEventArgs.cs
  3. //
  4. // Author:
  5. // stubbed out by Paul Osman ([email protected])
  6. // Partially completed by Dennis Hayes ([email protected])
  7. // Gianandrea Terzi ([email protected])
  8. //
  9. // (C) 2002 Ximian, Inc
  10. //
  11. using System;
  12. using System.Reflection;
  13. using System.Globalization;
  14. //using System.Windows.Forms.AccessibleObject.IAccessible;
  15. using System.Drawing;
  16. namespace System.Windows.Forms {
  17. /// <summary>
  18. /// </summary>
  19. public class MeasureItemEventArgs : EventArgs {
  20. #region Fields
  21. private Graphics graphics;
  22. private int index;
  23. private int itemheight = -1;
  24. private int itemwidth = -1;
  25. #endregion
  26. //
  27. // --- Constructors
  28. //
  29. public MeasureItemEventArgs(Graphics graphics, int index)
  30. {
  31. this.index = index;
  32. this.graphics = graphics;
  33. }
  34. public MeasureItemEventArgs(Graphics graphics, int index, int itemheight)
  35. {
  36. this.index = index;
  37. this.graphics = graphics;
  38. itemheight = ItemHeight;
  39. }
  40. #region Public Properties
  41. public Graphics Graphics
  42. {
  43. get
  44. {
  45. return graphics;
  46. }
  47. }
  48. public int Index
  49. {
  50. get
  51. {
  52. return index;
  53. }
  54. }
  55. public int ItemHeight
  56. {
  57. get
  58. {
  59. return itemheight;
  60. }
  61. set
  62. {
  63. itemheight = value;
  64. }
  65. }
  66. public int ItemWidth
  67. {
  68. get
  69. {
  70. return itemwidth;
  71. }
  72. set
  73. {
  74. itemwidth = value;
  75. }
  76. }
  77. #endregion
  78. #region Public Methods
  79. /// <summary>
  80. /// Equality Operator
  81. /// </summary>
  82. ///
  83. /// <remarks>
  84. /// Compares two MeasureItemEventArgs objects.
  85. /// The return value is based on the equivalence of
  86. /// graphics, index, itemheight and itemwidth Property
  87. /// of the two MeasureItemEventArgs.
  88. /// </remarks>
  89. public static bool operator == (MeasureItemEventArgs MeasureItemEventArgsA, MeasureItemEventArgs MeasureItemEventArgsB)
  90. {
  91. return (MeasureItemEventArgsA.Graphics == MeasureItemEventArgsB.Graphics) &&
  92. (MeasureItemEventArgsA.Index == MeasureItemEventArgsB.Index) &&
  93. (MeasureItemEventArgsA.ItemHeight == MeasureItemEventArgsB.ItemHeight) &&
  94. (MeasureItemEventArgsA.ItemWidth == MeasureItemEventArgsB.ItemWidth);
  95. }
  96. /// <summary>
  97. /// Inequality Operator
  98. /// </summary>
  99. ///
  100. /// <remarks>
  101. /// Compares two MeasureItemEventArgs objects.
  102. /// The return value is based on the equivalence of
  103. /// graphics, index, itemheight and itemwidth Property
  104. /// of the two MeasureItemEventArgs.
  105. /// </remarks>
  106. public static bool operator != (MeasureItemEventArgs MeasureItemEventArgsA, MeasureItemEventArgs MeasureItemEventArgsB)
  107. {
  108. return (MeasureItemEventArgsA.Graphics != MeasureItemEventArgsB.Graphics) ||
  109. (MeasureItemEventArgsA.Index != MeasureItemEventArgsB.Index) ||
  110. (MeasureItemEventArgsA.ItemHeight != MeasureItemEventArgsB.ItemHeight) ||
  111. (MeasureItemEventArgsA.ItemWidth != MeasureItemEventArgsB.ItemWidth);
  112. }
  113. /// <summary>
  114. /// Equals Method
  115. /// </summary>
  116. ///
  117. /// <remarks>
  118. /// Checks equivalence of this
  119. /// PropertyTabChangedEventArgs and another
  120. /// object.
  121. /// </remarks>
  122. public override bool Equals (object obj)
  123. {
  124. if (!(obj is MeasureItemEventArgs))return false;
  125. return (this == (MeasureItemEventArgs) obj);
  126. }
  127. /// <summary>
  128. /// GetHashCode Method
  129. /// </summary>
  130. ///
  131. /// <remarks>
  132. /// Calculates a hashing value.
  133. /// </remarks>
  134. [MonoTODO]
  135. public override int GetHashCode ()
  136. {
  137. //FIXME: add class specific stuff;
  138. return base.GetHashCode();
  139. }
  140. /// <summary>
  141. /// ToString Method
  142. /// </summary>
  143. ///
  144. /// <remarks>
  145. /// Formats the object as a string.
  146. /// </remarks>
  147. [MonoTODO]
  148. public override string ToString ()
  149. {
  150. //FIXME: add class specific stuff;
  151. return base.ToString();
  152. }
  153. #endregion
  154. }
  155. }