StatusBarPanel.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. // Permission is hereby granted, free of charge, to any person obtaining
  2. // a copy of this software and associated documentation files (the
  3. // "Software"), to deal in the Software without restriction, including
  4. // without limitation the rights to use, copy, modify, merge, publish,
  5. // distribute, sublicense, and/or sell copies of the Software, and to
  6. // permit persons to whom the Software is furnished to do so, subject to
  7. // the following conditions:
  8. //
  9. // The above copyright notice and this permission notice shall be
  10. // included in all copies or substantial portions of the Software.
  11. //
  12. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  13. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  15. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  16. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  17. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  18. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  19. //
  20. // Copyright (c) 2004 Novell, Inc.
  21. //
  22. // Authors:
  23. // Jackson Harper ([email protected])
  24. using System;
  25. using System.Drawing;
  26. using System.ComponentModel;
  27. namespace System.Windows.Forms {
  28. public class StatusBarPanel : Component, ISupportInitialize {
  29. private StatusBar parent;
  30. private string text = String.Empty;
  31. private string tool_tip_text = String.Empty;
  32. private Icon icon;
  33. private HorizontalAlignment alignment = HorizontalAlignment.Left;
  34. private StatusBarPanelAutoSize auto_size = StatusBarPanelAutoSize.None;
  35. private StatusBarPanelBorderStyle border_style = StatusBarPanelBorderStyle.Sunken;
  36. private StatusBarPanelStyle style;
  37. private int width = 100;
  38. private int min_width = 10;
  39. public StatusBarPanel ()
  40. {
  41. }
  42. public HorizontalAlignment Alignment {
  43. get { return alignment; }
  44. set { alignment = value; }
  45. }
  46. public StatusBarPanelAutoSize AutoSize {
  47. get { return auto_size; }
  48. set { auto_size = value; }
  49. }
  50. public StatusBarPanelBorderStyle BorderStyle {
  51. get { return border_style; }
  52. set { border_style = value; }
  53. }
  54. public Icon Icon {
  55. get { return icon; }
  56. set { icon = value; }
  57. }
  58. public int MinWidth {
  59. get {
  60. if (AutoSize == StatusBarPanelAutoSize.None)
  61. return Width;
  62. return min_width;
  63. }
  64. set {
  65. if (value < 0)
  66. throw new ArgumentException ("value");
  67. min_width = value;
  68. }
  69. }
  70. public int Width {
  71. get { return width; }
  72. set {
  73. if (value < 0)
  74. throw new ArgumentException ("value");
  75. width = value;
  76. }
  77. }
  78. public StatusBarPanelStyle Style {
  79. get { return style; }
  80. set { style = value; }
  81. }
  82. public string Text {
  83. get { return text; }
  84. set { text = value; }
  85. }
  86. public string ToolTipText {
  87. get { return tool_tip_text; }
  88. set { tool_tip_text = value; }
  89. }
  90. public StatusBar Parent {
  91. get { return parent; }
  92. }
  93. internal void SetParent (StatusBar parent)
  94. {
  95. this.parent = parent;
  96. }
  97. public override string ToString ()
  98. {
  99. return "StatusBarPanel: {" + Text +"}";
  100. }
  101. [MonoTODO]
  102. protected override void Dispose (bool disposing)
  103. {
  104. }
  105. [MonoTODO]
  106. public virtual void BeginInit()
  107. {
  108. }
  109. [MonoTODO]
  110. public virtual void EndInit()
  111. {
  112. }
  113. }
  114. }