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