TableModelEventArgs.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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 RowAdded and RowRemoved
  37. /// events of a TableModel
  38. /// </summary>
  39. public delegate void TableModelEventHandler(object sender, TableModelEventArgs e);
  40. #endregion
  41. #region TableModelEventArgs
  42. /// <summary>
  43. /// Provides data for a TableModel's RowAdded and RowRemoved events
  44. /// </summary>
  45. public class TableModelEventArgs : EventArgs
  46. {
  47. #region Class Data
  48. /// <summary>
  49. /// The TableModel that Raised the event
  50. /// </summary>
  51. private TableModel source;
  52. /// <summary>
  53. /// The affected Row
  54. /// </summary>
  55. private Row row;
  56. /// <summary>
  57. /// The start index of the affected Row(s)
  58. /// </summary>
  59. private int toIndex;
  60. /// <summary>
  61. /// The end index of the affected Row(s)
  62. /// </summary>
  63. private int fromIndex;
  64. #endregion
  65. #region Constructor
  66. /// <summary>
  67. /// Initializes a new instance of the TableModelEventArgs class with
  68. /// the specified TableModel source, start index, end index and affected Column
  69. /// </summary>
  70. /// <param name="source">The TableModel that originated the event</param>
  71. public TableModelEventArgs(TableModel source) : this(source, null, -1, -1)
  72. {
  73. }
  74. /// <summary>
  75. /// Initializes a new instance of the TableModelEventArgs class with
  76. /// the specified TableModel source, start index, end index and affected Column
  77. /// </summary>
  78. /// <param name="source">The TableModel that originated the event</param>
  79. /// <param name="fromIndex">The start index of the affected Row(s)</param>
  80. /// <param name="toIndex">The end index of the affected Row(s)</param>
  81. public TableModelEventArgs(TableModel source, int fromIndex, int toIndex) : this(source, null, fromIndex, toIndex)
  82. {
  83. }
  84. /// <summary>
  85. /// Initializes a new instance of the TableModelEventArgs class with
  86. /// the specified TableModel source, start index, end index and affected Column
  87. /// </summary>
  88. /// <param name="source">The TableModel that originated the event</param>
  89. /// <param name="row">The affected Row</param>
  90. /// <param name="fromIndex">The start index of the affected Row(s)</param>
  91. /// <param name="toIndex">The end index of the affected Row(s)</param>
  92. public TableModelEventArgs(TableModel source, Row row, int fromIndex, int toIndex)
  93. {
  94. this.source = source;
  95. this.row = row;
  96. this.fromIndex = fromIndex;
  97. this.toIndex = toIndex;
  98. }
  99. #endregion
  100. #region Properties
  101. /// <summary>
  102. /// Gets the TableModel that Raised the event
  103. /// </summary>
  104. public TableModel TableModel
  105. {
  106. get
  107. {
  108. return this.source;
  109. }
  110. }
  111. /// <summary>
  112. /// Gets the affected Row
  113. /// </summary>
  114. public Row Row
  115. {
  116. get
  117. {
  118. return this.row;
  119. }
  120. }
  121. /// <summary>
  122. /// Gets the start index of the affected Row(s)
  123. /// </summary>
  124. public int RowFromIndex
  125. {
  126. get
  127. {
  128. return this.fromIndex;
  129. }
  130. }
  131. /// <summary>
  132. /// Gets the end index of the affected Row(s)
  133. /// </summary>
  134. public int RowToIndex
  135. {
  136. get
  137. {
  138. return this.toIndex;
  139. }
  140. }
  141. #endregion
  142. }
  143. #endregion
  144. }