ColumnEventArgs.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. //#########################################################################################
  2. //★★★★★★★ http://www.cnpopsoft.com [华普软件] ★★★★★★★
  3. //★★★★★★★ 华普软件 - VB & C#.NET 专业论文与源码荟萃! ★★★★★★★
  4. //#########################################################################################
  5. /*
  6. * Copyright ?2005, Mathew Hall
  7. * All rights reserved.
  8. *
  9. * Redistribution and use in source and binary forms, with or without modification,
  10. * are permitted provided that the following conditions are met:
  11. *
  12. * - Redistributions of source code must retain the above copyright notice,
  13. * this list of conditions and the following disclaimer.
  14. *
  15. * - Redistributions in binary form must reproduce the above copyright notice,
  16. * this list of conditions and the following disclaimer in the documentation
  17. * and/or other materials provided with the distribution.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  21. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  22. * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  23. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  24. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  25. * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  26. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  27. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  28. * OF SUCH DAMAGE.
  29. */
  30. using System;
  31. using XPTable.Models;
  32. namespace XPTable.Events
  33. {
  34. #region Delegates
  35. /// <summary>
  36. /// Represents the methods that will handle the PropertyChanged event of a Column,
  37. /// or a Table's BeginSort and EndSort events
  38. /// </summary>
  39. public delegate void ColumnEventHandler(object sender, ColumnEventArgs e);
  40. #endregion
  41. #region ColumnEventArgs
  42. /// <summary>
  43. /// Provides data for a Column's PropertyChanged event, or a Table's
  44. /// BeginSort and EndSort events
  45. /// </summary>
  46. public class ColumnEventArgs
  47. {
  48. #region Class Data
  49. /// <summary>
  50. /// The Column that Raised the event
  51. /// </summary>
  52. private Column source;
  53. /// <summary>
  54. /// The index of the Column in the ColumnModel
  55. /// </summary>
  56. private int index;
  57. /// <summary>
  58. /// The old value of the property that changed
  59. /// </summary>
  60. private object oldValue;
  61. /// <summary>
  62. /// The type of event
  63. /// </summary>
  64. private ColumnEventType eventType;
  65. #endregion
  66. #region Constructor
  67. /// <summary>
  68. /// Initializes a new instance of the ColumnEventArgs class with
  69. /// the specified Column source, column index and event type
  70. /// </summary>
  71. /// <param name="source">The Column that Raised the event</param>
  72. /// <param name="eventType">The type of event</param>
  73. /// <param name="oldValue">The old value of the changed property</param>
  74. public ColumnEventArgs(Column source, ColumnEventType eventType, object oldValue) : this(source, -1, eventType, oldValue)
  75. {
  76. }
  77. /// <summary>
  78. /// Initializes a new instance of the ColumnEventArgs class with
  79. /// the specified Column source, column index and event type
  80. /// </summary>
  81. /// <param name="source">The Column that Raised the event</param>
  82. /// <param name="index">The index of the Column</param>
  83. /// <param name="eventType">The type of event</param>
  84. /// <param name="oldValue">The old value of the changed property</param>
  85. public ColumnEventArgs(Column source, int index, ColumnEventType eventType, object oldValue) : base()
  86. {
  87. this.source = source;
  88. this.index = index;
  89. this.eventType = eventType;
  90. this.oldValue = oldValue;
  91. }
  92. #endregion
  93. #region Properties
  94. /// <summary>
  95. /// Gets the Column that Raised the event
  96. /// </summary>
  97. public Column Column
  98. {
  99. get
  100. {
  101. return this.source;
  102. }
  103. }
  104. /// <summary>
  105. ///
  106. /// </summary>
  107. /// <param name="column"></param>
  108. internal void SetColumn(Column column)
  109. {
  110. this.source = column;
  111. }
  112. /// <summary>
  113. /// Gets the index of the Column
  114. /// </summary>
  115. public int Index
  116. {
  117. get
  118. {
  119. return this.index;
  120. }
  121. }
  122. /// <summary>
  123. ///
  124. /// </summary>
  125. /// <param name="index"></param>
  126. internal void SetIndex(int index)
  127. {
  128. this.index = index;
  129. }
  130. /// <summary>
  131. /// Gets the type of event
  132. /// </summary>
  133. public ColumnEventType EventType
  134. {
  135. get
  136. {
  137. return this.eventType;
  138. }
  139. }
  140. /// <summary>
  141. /// Gets the old value of the Columns changed property
  142. /// </summary>
  143. public object OldValue
  144. {
  145. get
  146. {
  147. return this.oldValue;
  148. }
  149. }
  150. #endregion
  151. }
  152. #endregion
  153. }