StatusBarDrawItemEventArgs.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. //
  2. // System.Windows.Forms.StatusBarDrawItemEventArgs
  3. //
  4. // Author:
  5. // stubbed out by Richard Baumann ([email protected])
  6. // Partially completed by Dennis Hayes ([email protected])
  7. //
  8. // (C) Ximian, Inc., 2002
  9. //
  10. using System.Drawing;
  11. namespace System.Windows.Forms {
  12. /// <summary>
  13. /// Provides data for the DrawItem event.
  14. /// </summary>
  15. public class StatusBarDrawItemEventArgs : DrawItemEventArgs {
  16. private StatusBarPanel panel;
  17. /// --- Constructor ---
  18. public StatusBarDrawItemEventArgs(Graphics g, Font font,
  19. Rectangle r, int itemId, DrawItemState itemState,
  20. StatusBarPanel panel, Color foreColor, Color backColor)
  21. : base(g, font, r, itemId, itemState, foreColor, backColor) {
  22. this.panel = panel;
  23. }
  24. public StatusBarDrawItemEventArgs(Graphics g, Font font,
  25. Rectangle r, int itemId, DrawItemState itemState, StatusBarPanel panel)
  26. : base(g, font, r, itemId, itemState) {
  27. this.panel = panel;
  28. }
  29. #region Public Properties
  30. public StatusBarPanel Panel
  31. {
  32. get {
  33. return panel;
  34. }
  35. }
  36. #endregion
  37. #region Public Methods
  38. /// <summary>
  39. /// Equality Operator
  40. /// </summary>
  41. ///
  42. /// <remarks>
  43. /// Compares two StatusBarDrawItemEventArgs objects.
  44. /// The return value is based on the equivalence of
  45. /// the BackColor, Bounds, Font, ForeColor, Graphics,
  46. /// Index, Panel, and State properties of the two
  47. /// StatusBarDrawItemEventArgs.
  48. /// </remarks>
  49. public static bool operator == (StatusBarDrawItemEventArgs objA, StatusBarDrawItemEventArgs objB)
  50. {
  51. return ((objA.panel == objB.panel) && ((DrawItemEventArgs) objA == (DrawItemEventArgs) objB));
  52. }
  53. /// <summary>
  54. /// Inequality Operator
  55. /// </summary>
  56. ///
  57. /// <remarks>
  58. /// Compares two StatusBarDrawItemEventArgs objects.
  59. /// The return value is based on the equivalence of
  60. /// the BackColor, Bounds, Font, ForeColor, Graphics,
  61. /// Index, Panel, and State properties of the two
  62. /// StatusBarDrawItemEventArgs.
  63. /// </remarks>
  64. public static bool operator != (StatusBarDrawItemEventArgs objA, StatusBarDrawItemEventArgs objB)
  65. {
  66. return ((objA.panel != objB.panel) || ((DrawItemEventArgs) objA != (DrawItemEventArgs) objB));
  67. }
  68. /// <summary>
  69. /// Equals Method
  70. /// </summary>
  71. ///
  72. /// <remarks>
  73. /// Checks equivalence of this
  74. /// StatusBarDrawItemEventArgs and another object.
  75. /// </remarks>
  76. public override bool Equals (object obj)
  77. {
  78. if (!(obj is StatusBarDrawItemEventArgs))return false;
  79. return (this == (StatusBarDrawItemEventArgs) obj);
  80. }
  81. /// <summary>
  82. /// GetHashCode Method
  83. /// </summary>
  84. ///
  85. /// <remarks>
  86. /// Calculates a hashing value.
  87. /// Returns DrawItemEventArgs.GetHashCode().
  88. /// </remarks>
  89. public override int GetHashCode ()
  90. {
  91. // FIXME: In a perfect world, get hashcode would include
  92. // Panel, but this shouldbe good enough.
  93. return base.GetHashCode();
  94. }
  95. /// <summary>
  96. /// ToString Method
  97. /// </summary>
  98. ///
  99. /// <remarks>
  100. /// Formats the StatusBarDrawItemEventArgs as a string.
  101. /// </remarks>
  102. public override string ToString ()
  103. {
  104. return base.ToString() + panel.ToString();
  105. }
  106. #endregion
  107. }
  108. }