ConvertEventArgs.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. //
  2. // System.Windows.Forms.ConvertEventArgs.cs
  3. //
  4. // Author:
  5. // Stubbed out by Jaak Simm ([email protected])
  6. // Finished by Dennis Hayes ([email protected])
  7. // Gianandrea Terzi ([email protected])
  8. //
  9. // (C) Ximian, Inc., 2002
  10. //
  11. namespace System.Windows.Forms {
  12. /// <summary>
  13. /// Provides data for the Format and Parse events.
  14. /// </summary>
  15. public class ConvertEventArgs : EventArgs {
  16. #region Fields
  17. private Type desiredtype;
  18. private object objectvalue;
  19. #endregion
  20. //Constructor
  21. public ConvertEventArgs(object objectValue,Type desiredType)
  22. {
  23. this.desiredtype = desiredType;
  24. this.objectvalue = objectValue;
  25. }
  26. #region Public Properties
  27. public Type DesiredType
  28. {
  29. get {
  30. return desiredtype;
  31. }
  32. }
  33. public object Value {
  34. get {
  35. return objectvalue;
  36. }
  37. set {
  38. objectvalue = value;
  39. }
  40. }
  41. #endregion
  42. #region Public Methods
  43. /// <summary>
  44. /// Equality Operator
  45. /// </summary>
  46. ///
  47. /// <remarks>
  48. /// Compares two ConvertEventArgs objects.
  49. /// The return value is based on the equivalence of
  50. /// DesiredType and Value Property
  51. /// of the two ContentsResizedEventArgs.
  52. /// </remarks>
  53. public static bool operator == (ConvertEventArgs ConvertEventArgsA, ConvertEventArgs ConvertEventArgsB)
  54. {
  55. return (ConvertEventArgsA.DesiredType == ConvertEventArgsB.DesiredType) &&
  56. (ConvertEventArgsA.Value == ConvertEventArgsB.Value);
  57. }
  58. /// <summary>
  59. /// Inequality Operator
  60. /// </summary>
  61. ///
  62. /// <remarks>
  63. /// Compares two ConvertEventArgs objects.
  64. /// The return value is based on the equivalence of
  65. /// DesiredType and Value Property
  66. /// of the two ContentsResizedEventArgs.
  67. /// </remarks>
  68. public static bool operator != (ConvertEventArgs ConvertEventArgsA, ConvertEventArgs ConvertEventArgsB)
  69. {
  70. return (ConvertEventArgsA.DesiredType != ConvertEventArgsB.DesiredType) ||
  71. (ConvertEventArgsA.Value != ConvertEventArgsB.Value);
  72. }
  73. /// <summary>
  74. /// Equals Method
  75. /// </summary>
  76. ///
  77. /// <remarks>
  78. /// Checks equivalence of this
  79. /// ConvertEventArgs and another
  80. /// object.
  81. /// </remarks>
  82. public override bool Equals (object obj)
  83. {
  84. if (!(obj is ConvertEventArgs))return false;
  85. return (this == (ConvertEventArgs) obj);
  86. }
  87. /// <summary>
  88. /// GetHashCode Method
  89. /// </summary>
  90. ///
  91. /// <remarks>
  92. /// Calculates a hashing value.
  93. /// </remarks>
  94. [MonoTODO]
  95. public override int GetHashCode ()
  96. {
  97. //FIXME: add class specific stuff;
  98. return base.GetHashCode();
  99. }
  100. /// <summary>
  101. /// ToString Method
  102. /// </summary>
  103. ///
  104. /// <remarks>
  105. /// Formats the object as a string.
  106. /// </remarks>
  107. [MonoTODO]
  108. public override string ToString ()
  109. {
  110. //FIXME: add class specific stuff;
  111. return base.ToString() + " ConvertEventArgs";
  112. }
  113. #endregion
  114. }
  115. }