MouseEventArgs.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. //
  2. // System.Windows.Forms.MouseEventArgs.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.Runtime.InteropServices;
  12. namespace System.Windows.Forms {
  13. // <summary>
  14. // This is only a template. Nothing is implemented yet.
  15. //
  16. // </summary>
  17. public class MouseEventArgs : EventArgs {
  18. #region Fields
  19. private MouseButtons button;
  20. private int clicks;
  21. private int x;
  22. private int y;
  23. private int delta;
  24. #endregion
  25. public MouseEventArgs(MouseButtons button, int clicks, int x, int y, int delta)
  26. {
  27. this.button = button;
  28. this.clicks = clicks;
  29. this.x = x;
  30. this.y = y;
  31. this.delta = delta;
  32. }
  33. #region Public Properties
  34. [ComVisible(true)]
  35. public MouseButtons Button
  36. {
  37. get {
  38. return button;
  39. }
  40. }
  41. [ComVisible(true)]
  42. public int Clicks {
  43. get {
  44. return clicks;
  45. }
  46. }
  47. [ComVisible(true)]
  48. public int Delta {
  49. get {
  50. return delta;
  51. }
  52. }
  53. [ComVisible(true)]
  54. public int X {
  55. get {
  56. return x;
  57. }
  58. }
  59. [ComVisible(true)]
  60. public int Y {
  61. get {
  62. return y;
  63. }
  64. }
  65. #endregion
  66. #region Public Methods
  67. /// <summary>
  68. /// Equality Operator
  69. /// </summary>
  70. ///
  71. /// <remarks>
  72. /// Compares two MouseEventArgs objects.
  73. /// The return value is based on the equivalence of
  74. /// X, Y, Clicks, Delta and Button Property
  75. /// of the two MouseEventArgs.
  76. /// </remarks>
  77. public static bool operator == (MouseEventArgs MouseEventArgsA, MouseEventArgs MouseEventArgsB)
  78. {
  79. return (MouseEventArgsA.X == MouseEventArgsB.X) &&
  80. (MouseEventArgsA.Y == MouseEventArgsB.Y) &&
  81. (MouseEventArgsA.Clicks == MouseEventArgsB.Clicks) &&
  82. (MouseEventArgsA.Delta == MouseEventArgsB.Delta) &&
  83. (MouseEventArgsA.Button == MouseEventArgsB.Button);
  84. }
  85. /// <summary>
  86. /// Inequality Operator
  87. /// </summary>
  88. ///
  89. /// <remarks>
  90. /// Compares two MouseEventArgs objects.
  91. /// The return value is based on the equivalence of
  92. /// X, Y, Clicks, Delta and Button Property
  93. /// of the two MouseEventArgs.
  94. /// </remarks>
  95. public static bool operator != (MouseEventArgs MouseEventArgsA, MouseEventArgs MouseEventArgsB)
  96. {
  97. return (MouseEventArgsA.X != MouseEventArgsB.X) ||
  98. (MouseEventArgsA.Y != MouseEventArgsB.Y) ||
  99. (MouseEventArgsA.Clicks != MouseEventArgsB.Clicks) ||
  100. (MouseEventArgsA.Delta != MouseEventArgsB.Delta) ||
  101. (MouseEventArgsA.Button != MouseEventArgsB.Button);
  102. }
  103. /// <summary>
  104. /// Equals Method
  105. /// </summary>
  106. ///
  107. /// <remarks>
  108. /// Checks equivalence of this
  109. /// MouseEventArgs and another
  110. /// object.
  111. /// </remarks>
  112. public override bool Equals (object obj)
  113. {
  114. if (!(obj is MouseEventArgs))return false;
  115. return (this == (MouseEventArgs) obj);
  116. }
  117. /// <summary>
  118. /// GetHashCode Method
  119. /// </summary>
  120. ///
  121. /// <remarks>
  122. /// Calculates a hashing value.
  123. /// </remarks>
  124. [MonoTODO]
  125. public override int GetHashCode ()
  126. {
  127. //FIXME: add class specific stuff;
  128. return base.GetHashCode();
  129. }
  130. /// <summary>
  131. /// ToString Method
  132. /// </summary>
  133. ///
  134. /// <remarks>
  135. /// Formats the object as a string.
  136. /// </remarks>
  137. [MonoTODO]
  138. public override string ToString ()
  139. {
  140. //FIXME: add class specific stuff;
  141. return base.ToString();
  142. }
  143. #endregion
  144. }
  145. }