New test.
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / ToolStripProgressBar.cs
1 //
2 // ToolStripProgressBar.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 using System.Drawing;
30 using System.ComponentModel;
31
32 namespace System.Windows.Forms
33 {
34         [DefaultProperty ("Value")]
35         public class ToolStripProgressBar : ToolStripControlHost
36         {
37                 #region Public Constructors
38                 public ToolStripProgressBar () : base (new ProgressBar ())
39                 {
40                 }
41
42                 public ToolStripProgressBar (string name) : this ()
43                 {
44                         this.Control.Name = name;
45                 }
46                 #endregion
47
48                 #region Public Properties
49                 [DefaultValue (100)]
50                 public int Maximum {
51                         get { return this.ProgressBar.Maximum; }
52                         set { this.ProgressBar.Maximum = value; }
53                 }
54
55                 [DefaultValue (0)]
56                 public int Minimum {
57                         get { return this.ProgressBar.Minimum; }
58                         set { this.ProgressBar.Minimum = value; }
59                 }
60
61                 [Browsable (false)]
62                 public ProgressBar ProgressBar {
63                         get { return (ProgressBar)base.Control; }
64                 }
65
66                 [DefaultValue (10)]
67                 public int Step {
68                         get { return this.ProgressBar.Step; }
69                         set { this.ProgressBar.Step = value; }
70                 }
71
72                 [DefaultValue (ProgressBarStyle.Blocks)]
73                 public ProgressBarStyle Style {
74                         get { return this.ProgressBar.Style; }
75                         set { this.ProgressBar.Style = value; }
76                 }
77
78                 [Browsable (false)]
79                 [EditorBrowsable (EditorBrowsableState.Never)]
80                 public override string Text {
81                         get { return base.Text; }
82                         set { base.Text = value; }
83                 }
84
85                 [Bindable (true)]
86                 [DefaultValue (0)]
87                 public int Value {
88                         get { return this.ProgressBar.Value; }
89                         set { this.ProgressBar.Value = value; }
90                 }
91                 #endregion
92
93                 #region Protected Properties
94                 protected internal override Padding DefaultMargin { get { return new Padding (1, 2, 1, 1); } }
95                 protected override Size DefaultSize { get { return new Size (100, 15); } }
96                 #endregion
97
98                 #region Public Methods
99                 public void Increment (int value)
100                 {
101                         this.ProgressBar.Increment (value);
102                 }
103
104                 public void PerformStep ()
105                 {
106                         this.ProgressBar.PerformStep ();
107                 }
108                 #endregion
109
110                 #region Protected Methods
111                 protected override void OnSubscribeControlEvents (Control control)
112                 {
113                         base.OnSubscribeControlEvents (control);
114                 }
115
116                 protected override void OnUnsubscribeControlEvents (Control control)
117                 {
118                         base.OnUnsubscribeControlEvents (control);
119                 }
120                 #endregion
121
122                 #region Public Events
123                 [Browsable (false)]
124                 [EditorBrowsable (EditorBrowsableState.Never)]
125                 public event KeyEventHandler KeyDown;
126                 [Browsable (false)]
127                 [EditorBrowsable (EditorBrowsableState.Never)]
128                 public event KeyPressEventHandler KeyPress;
129                 [Browsable (false)]
130                 [EditorBrowsable (EditorBrowsableState.Never)]
131                 public event KeyEventHandler KeyUp;
132                 [Browsable (false)]
133                 [EditorBrowsable (EditorBrowsableState.Never)]
134                 public event EventHandler LocationChanged;
135                 [Browsable (false)]
136                 [EditorBrowsable (EditorBrowsableState.Never)]
137                 public event EventHandler OwnerChanged;
138                 [Browsable (false)]
139                 [EditorBrowsable (EditorBrowsableState.Never)]
140                 public event EventHandler TextChanged;
141                 [Browsable (false)]
142                 [EditorBrowsable (EditorBrowsableState.Never)]
143                 public event EventHandler Validated;
144                 [Browsable (false)]
145                 [EditorBrowsable (EditorBrowsableState.Never)]
146                 public event CancelEventHandler Validating;
147                 #endregion
148         }
149 }
150 #endif