TextColumn.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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.Editors;
  34. using XPTable.Events;
  35. using XPTable.Models.Design;
  36. using XPTable.Renderers;
  37. using XPTable.Sorting;
  38. namespace XPTable.Models
  39. {
  40. /// <summary>
  41. /// Summary description for TextColumn.
  42. /// </summary>
  43. [DesignTimeVisible(false),
  44. ToolboxItem(false)]
  45. public class TextColumn : Column
  46. {
  47. #region Constructor
  48. /// <summary>
  49. /// Creates a new TextColumn with default values
  50. /// </summary>
  51. public TextColumn() : base()
  52. {
  53. }
  54. /// <summary>
  55. /// Creates a new TextColumn with the specified header text
  56. /// </summary>
  57. /// <param name="text">The text displayed in the column's header</param>
  58. public TextColumn(string text) : base(text)
  59. {
  60. }
  61. /// <summary>
  62. /// Creates a new TextColumn with the specified header text and width
  63. /// </summary>
  64. /// <param name="text">The text displayed in the column's header</param>
  65. /// <param name="width">The column's width</param>
  66. public TextColumn(string text, int width) : base(text, width)
  67. {
  68. }
  69. /// <summary>
  70. /// Creates a new TextColumn with the specified header text, width and visibility
  71. /// </summary>
  72. /// <param name="text">The text displayed in the column's header</param>
  73. /// <param name="width">The column's width</param>
  74. /// <param name="visible">Specifies whether the column is visible</param>
  75. public TextColumn(string text, int width, bool visible) : base(text, width, visible)
  76. {
  77. }
  78. /// <summary>
  79. /// Creates a new TextColumn with the specified header text and image
  80. /// </summary>
  81. /// <param name="text">The text displayed in the column's header</param>
  82. /// <param name="image">The image displayed on the column's header</param>
  83. public TextColumn(string text, Image image) : base(text, image)
  84. {
  85. }
  86. /// <summary>
  87. /// Creates a new TextColumn with the specified header text, image and width
  88. /// </summary>
  89. /// <param name="text">The text displayed in the column's header</param>
  90. /// <param name="image">The image displayed on the column's header</param>
  91. /// <param name="width">The column's width</param>
  92. public TextColumn(string text, Image image, int width) : base(text, image, width)
  93. {
  94. }
  95. /// <summary>
  96. /// Creates a new TextColumn with the specified header text, image, width and visibility
  97. /// </summary>
  98. /// <param name="text">The text displayed in the column's header</param>
  99. /// <param name="image">The image displayed on the column's header</param>
  100. /// <param name="width">The column's width</param>
  101. /// <param name="visible">Specifies whether the column is visible</param>
  102. public TextColumn(string text, Image image, int width, bool visible) : base(text, image, width, visible)
  103. {
  104. }
  105. #endregion
  106. #region Methods
  107. /// <summary>
  108. /// Gets a string that specifies the name of the Column's default CellRenderer
  109. /// </summary>
  110. /// <returns>A string that specifies the name of the Column's default
  111. /// CellRenderer</returns>
  112. public override string GetDefaultRendererName()
  113. {
  114. return "TEXT";
  115. }
  116. /// <summary>
  117. /// Gets the Column's default CellRenderer
  118. /// </summary>
  119. /// <returns>The Column's default CellRenderer</returns>
  120. public override ICellRenderer CreateDefaultRenderer()
  121. {
  122. return new TextCellRenderer();
  123. }
  124. /// <summary>
  125. /// Gets a string that specifies the name of the Column's default CellEditor
  126. /// </summary>
  127. /// <returns>A string that specifies the name of the Column's default
  128. /// CellEditor</returns>
  129. public override string GetDefaultEditorName()
  130. {
  131. return "TEXT";
  132. }
  133. /// <summary>
  134. /// Gets the Column's default CellEditor
  135. /// </summary>
  136. /// <returns>The Column's default CellEditor</returns>
  137. public override ICellEditor CreateDefaultEditor()
  138. {
  139. return new TextCellEditor();
  140. }
  141. #endregion
  142. #region Properties
  143. /// <summary>
  144. /// Gets the Type of the Comparer used to compare the Column's Cells when
  145. /// the Column is sorting
  146. /// </summary>
  147. public override Type DefaultComparerType
  148. {
  149. get
  150. {
  151. return typeof(TextComparer);
  152. }
  153. }
  154. #endregion
  155. }
  156. }