NumberRendererData.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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 System.ComponentModel;
  32. using System.Drawing;
  33. using XPTable.Themes;
  34. namespace XPTable.Renderers
  35. {
  36. /// <summary>
  37. /// Contains information about the current state of a number Cell's
  38. /// up and down buttons
  39. /// </summary>
  40. public class NumberRendererData
  41. {
  42. #region Class Data
  43. /// <summary>
  44. /// The current state of the up button
  45. /// </summary>
  46. private UpDownStates upState;
  47. /// <summary>
  48. /// The current state of the down button
  49. /// </summary>
  50. private UpDownStates downState;
  51. /// <summary>
  52. /// The x coordinate of the last mouse click point
  53. /// </summary>
  54. private int clickX;
  55. /// <summary>
  56. /// The y coordinate of the last mouse click point
  57. /// </summary>
  58. private int clickY;
  59. #endregion
  60. #region Constructor
  61. /// <summary>
  62. /// Initializes a new instance of the NumberRendererData class
  63. /// </summary>
  64. public NumberRendererData()
  65. {
  66. this.upState = UpDownStates.Normal;
  67. this.downState = UpDownStates.Normal;
  68. this.clickX = -1;
  69. this.clickY = -1;
  70. }
  71. #endregion
  72. #region Properties
  73. /// <summary>
  74. /// Gets or sets the current state of the up button
  75. /// </summary>
  76. public UpDownStates UpButtonState
  77. {
  78. get
  79. {
  80. return this.upState;
  81. }
  82. set
  83. {
  84. if (!Enum.IsDefined(typeof(UpDownStates), value))
  85. {
  86. throw new InvalidEnumArgumentException("value", (int) value, typeof(UpDownStates));
  87. }
  88. this.upState = value;
  89. }
  90. }
  91. /// <summary>
  92. /// Gets or sets the current state of the down button
  93. /// </summary>
  94. public UpDownStates DownButtonState
  95. {
  96. get
  97. {
  98. return this.downState;
  99. }
  100. set
  101. {
  102. if (!Enum.IsDefined(typeof(UpDownStates), value))
  103. {
  104. throw new InvalidEnumArgumentException("value", (int) value, typeof(UpDownStates));
  105. }
  106. this.downState = value;
  107. }
  108. }
  109. /// <summary>
  110. /// Gets or sets the Point that the mouse was last clicked in a button
  111. /// </summary>
  112. public Point ClickPoint
  113. {
  114. get
  115. {
  116. return new Point(this.clickX, this.clickY);
  117. }
  118. set
  119. {
  120. this.clickX = value.X;
  121. this.clickY = value.Y;
  122. }
  123. }
  124. #endregion
  125. }
  126. }