(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / System.Windows.Forms / Gtk / ProgressBar.cs
blobf6485f5c19d7f6092051c161a94319544722cdc6
1 //
2 // System.Windows.Forms.ProgressBar
3 //
4 // Author:
5 // stubbed out by Jaak Simm (jaaksimm@firm.ee)
6 // Remco de Jong (rdj@rdj.cg.nu)
7 // Alberto Fernandez (infjaf00@yahoo.es)
8 //
9 // (C) Ximian, Inc., 2002
12 using System.Drawing;
13 using System.Drawing.Printing;
14 using System.ComponentModel;
16 namespace System.Windows.Forms {
18 /// <summary>
19 /// Represents a Windows progress bar control.
20 ///
21 /// </summary>
23 [MonoTODO]
24 public sealed class ProgressBar : Control {
26 #region Fields
27 private int maximum;
28 private int minimum;
29 private int step;
30 private int val;
31 #endregion
33 #region Constructor
35 public ProgressBar(){
36 maximum=100;
37 minimum=0;
38 step=10;
39 val=0;
40 this.Size = this.DefaultSize;
42 #endregion
45 /* #region Properties
46 [MonoTODO]
47 public override bool AllowDrop {
48 get { throw new NotImplementedException (); }
49 set { throw new NotImplementedException (); }
53 [MonoTODO]
54 public override Image BackgroundImage {
55 get { throw new NotImplementedException (); }
56 set { throw new NotImplementedException (); }
59 /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
60 /// public new bool CausesValidation {get; set;}
62 /* [MonoTODO]
63 protected override CreateParams CreateParams {
64 get { throw new NotImplementedException (); }
67 [MonoTODO]
68 protected override ImeMode DefaultImeMode {
69 get { throw new NotImplementedException (); }
73 [MonoTODO]
74 public override Font Font {
75 get { throw new NotImplementedException (); }
76 set { throw new NotImplementedException (); }
79 protected override Size DefaultSize {
80 get { return new System.Drawing.Size (100, 23); }
83 /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
84 /// public new ImeMode ImeMode {get; set;}
86 public int Maximum {
87 get { return maximum;}
88 set {
89 if (value < 0){
90 String st = String.Format (
91 "'{0}' is not a valid value for Maximum."+
92 "It should be >= 0", value
94 throw new ArgumentException (st);
96 maximum=value;
97 if (value < minimum)
98 minimum = value;
99 if (value < val)
100 val = value;
101 UpdateGtkProgressBar();
105 public int Minimum {
106 get { return minimum; }
107 set {
108 if (value < 0){
109 String st = String.Format (
110 "'{0}' is not a valid value for Minimum."+
111 "It should be >= 0", value
113 throw new ArgumentException (st);
115 minimum=value;
116 if (value > maximum)
117 maximum = value;
118 if (value > val)
119 val = value;
120 UpdateGtkProgressBar();
124 /// This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.
125 /// public new bool TabStop {get; set;}
126 /* [MonoTODO]
127 public override RightToLeft RightToLeft {
128 get { throw new NotImplementedException (); }
129 set { throw new NotImplementedException (); }
132 public int Step {
133 get { return step; }
134 set { step=value; }
139 public int Value {
140 get {
141 return val;
143 set {
144 if ((value > maximum) || (value < minimum)){
145 String st = String.Format (
146 "'{0}' is not a valid value for Value."+
147 " It should be betwen Minimum and Maximum", value);
149 throw new ArgumentException (st);
152 val=value;
153 UpdateGtkProgressBar();
156 // #endregion
161 /* #region Methods
162 [MonoTODO]
163 protected override void CreateHandle()
165 throw new NotImplementedException ();
168 public void Increment(int value) {
169 int tmp = Value + value;
170 tmp = (tmp < Minimum) ? Minimum : tmp;
171 tmp = (tmp > Maximum) ? Maximum : tmp;
172 Value = tmp;
175 /* [MonoTODO]
176 protected override void OnHandleCreated(EventArgs e)
178 throw new NotImplementedException ();
181 public void PerformStep(){
182 this.Increment (this.Step);
185 public override string ToString(){
186 String ret = String.Format (
187 "System.Windows.Forms.ProgressBar, " +
188 "Minimum: {0}, Maximum: {1}, Value: {2}",
189 this.Minimum,
190 this.Maximum,
191 this.Value);
192 return ret;
194 // #endregion
199 #region Events
201 * This member supports the .NET Framework infrastructure and is not intended to be used directly from your code:
202 public new event EventHandler DoubleClick;
203 public new event EventHandler Enter;
204 public new event KeyEventHandler KeyDown;
205 public new event KeyPressEventHandler KeyPress;
206 public new event KeyEventHandler KeyUp;
207 public new event EventHandler Leave;
208 public new event PaintEventHandler Paint;
210 #endregion
211 internal override Gtk.Widget CreateWidget () {
212 Gtk.ProgressBar pbar = new Gtk.ProgressBar ();
213 return pbar;
215 protected override void OnTextChanged(EventArgs e){
216 ((Gtk.ProgressBar)Widget).Text = Text;
218 internal void UpdateGtkProgressBar(){
219 float fraction = ((float) val / (float) maximum);
220 (Widget as Gtk.ProgressBar).Fraction = fraction;