2007-03-29 Jonathan Pobst <monkey@jpobst.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / ToolStripStatusLabel.cs
1 //
2 // StatusStrip.cs
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining
5 // a copy of this software and associated documentation files (the
6 // "Software"), to deal in the Software without restriction, including
7 // without limitation the rights to use, copy, modify, merge, publish,
8 // distribute, sublicense, and/or sell copies of the Software, and to
9 // permit persons to whom the Software is furnished to do so, subject to
10 // the following conditions:
11 // 
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
14 // 
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 //
23 // Copyright (c) 2006 Jonathan Pobst
24 //
25 // Authors:
26 //      Jonathan Pobst (monkey@jpobst.com)
27 //
28 #if NET_2_0
29
30 using System;
31 using System.Drawing;
32 using System.ComponentModel;
33 using System.Runtime.InteropServices;
34 using System.Windows.Forms.Design;
35
36 namespace System.Windows.Forms
37 {
38         [ToolStripItemDesignerAvailability (ToolStripItemDesignerAvailability.StatusStrip)]
39         public class ToolStripStatusLabel : ToolStripLabel
40         {
41                 private ToolStripStatusLabelBorderSides border_sides;
42                 private Border3DStyle border_style;
43                 private bool spring;
44                 
45                 #region Public Constructors
46                 public ToolStripStatusLabel ()
47                         : this (String.Empty, null, null, String.Empty)
48                 {
49                 }
50
51                 public ToolStripStatusLabel (Image image)
52                         : this (String.Empty, image, null, String.Empty)
53                 {
54                 }
55
56                 public ToolStripStatusLabel (string text)
57                         : this (text, null, null, String.Empty)
58                 {
59                 }
60
61                 public ToolStripStatusLabel (string text, Image image)
62                         : this (text, image, null, String.Empty)
63                 {
64                 }
65
66                 public ToolStripStatusLabel (string text, Image image, EventHandler onClick)
67                         : this (text, image, onClick, String.Empty)
68                 {
69                 }
70
71                 public ToolStripStatusLabel (string text, Image image, EventHandler onClick, string name)
72                         : base (text, image, false, onClick, name)
73                 {
74                         this.border_style = Border3DStyle.Flat;
75                 }
76                 #endregion
77
78                 #region Public Properties
79                 [Browsable (false)]
80                 [EditorBrowsable (EditorBrowsableState.Advanced)]
81                 public new ToolStripItemAlignment Alignment {
82                         get { return base.Alignment; }
83                         set { base.Alignment = value; }
84                 }
85                 
86                 [DefaultValue (ToolStripStatusLabelBorderSides.None)]
87                 public ToolStripStatusLabelBorderSides BorderSides {
88                         get { return this.border_sides; }
89                         set { this.border_sides = value; }
90                 }
91                 
92                 [DefaultValue (Border3DStyle.Flat)]
93                 public Border3DStyle BorderStyle {
94                         get { return this.border_style; }
95                         set { this.border_style = value; }
96                 }
97                 
98                 [DefaultValue (false)]
99                 public bool Spring {
100                         get { return this.spring; }
101                         set { this.spring = value; }
102                 }
103                 #endregion
104
105                 #region Protected Properties
106                 protected internal override Padding DefaultMargin {
107                         get { return new Padding (0, 3, 0, 2); }
108                 }
109                 #endregion
110
111                 #region Public Methods
112                 public override Size GetPreferredSize (Size constrainingSize)
113                 {
114                         return base.GetPreferredSize (constrainingSize);
115                 }
116                 #endregion
117
118                 #region Protected Methods
119                 protected override void OnPaint (PaintEventArgs e)
120                 {
121                         base.OnPaint (e);
122                 }
123                 #endregion
124         }
125 }
126 #endif