**** Merged from MCS ****
[mono-project.git] / mcs / class / System.Windows.Forms / System.Windows.Forms / NumericUpDown.cs
blob7566db4ee93ee52eb6fcfbd18dfcc4e41e8a4fdf
1 //
2 // System.Windows.Forms.NumericUpDown.cs
3 //
4 // Author:
5 // stubbed out by Paul Osman (paul.osman@sympatico.ca)
6 // Dennis Hayes (dennish@raytek.com)
7 // Alexandre Pigolkine (pigolkine@gxm.de)
8 //
9 // (C) 2002/3 Ximian, Inc
13 // Permission is hereby granted, free of charge, to any person obtaining
14 // a copy of this software and associated documentation files (the
15 // "Software"), to deal in the Software without restriction, including
16 // without limitation the rights to use, copy, modify, merge, publish,
17 // distribute, sublicense, and/or sell copies of the Software, and to
18 // permit persons to whom the Software is furnished to do so, subject to
19 // the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be
22 // included in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 using System.ComponentModel;
33 namespace System.Windows.Forms {
35 // <summary>
37 // </summary>
39 public class NumericUpDown : UpDownBase, ISupportInitialize {
41 private decimal Value_ = 0;
42 private int DecimalPlaces_;
43 private bool Hexadecimal_ = false;
44 private decimal Increment_ = 1;
45 private decimal Maximum_ = 100;
46 private decimal Minimum_ = 0;
48 // --- Constructor
50 [MonoTODO]
51 public NumericUpDown()
56 public override void DownButton(){
57 if( Value_ > Minimum_) {
58 Value = Math.Max(Value_ - Increment_, Minimum_);
63 // --- Public Properties
66 [MonoTODO]
67 public int DecimalPlaces {
68 get {
69 return DecimalPlaces_;
71 set {
72 //FIXME:
73 DecimalPlaces_ = value;
77 [MonoTODO]
78 public bool Hexadecimal {
79 get {
80 return Hexadecimal_;
82 set {
83 //FIXME:
84 Hexadecimal_ = value;
88 public decimal Increment {
89 get {
90 return Increment_;
92 set {
93 Increment_ = value;
97 [MonoTODO]
98 public decimal Maximum {
99 get {
100 return Maximum_;
102 set {
103 //FIXME:
104 if( Maximum_ != value) {
105 Maximum_ = value;
106 Minimum = Math.Min(Maximum_,Minimum_);
107 Value = Math.Min(Value_,Minimum_);
112 [MonoTODO]
113 public decimal Minimum {
114 get {
115 return Minimum_;
117 set {
118 //FIXME:
119 if( Minimum_ != value) {
120 Minimum_ = value;
121 Maximum = Math.Max(Maximum_,Minimum_);
122 Value = Math.Max(Value_,Minimum_);
127 [MonoTODO]
128 public override string Text {
129 //FIXME: just to get it to run
130 get {
131 return Value_.ToString();
133 set {
134 Value = Decimal.Parse(value);
138 [MonoTODO]
139 public bool ThousandsSeparator {
140 get {
141 throw new NotImplementedException ();
143 set {
144 //FIXME:
148 [MonoTODO]
149 public decimal Value {
150 get {
151 return Value_;
153 set {
154 //FIXME:
155 if( Value_ != value) {
156 Value_ = value;
157 UpdateEditText();
163 // --- Public Methods
166 [MonoTODO]
167 public override string ToString()
169 //FIXME:
170 return base.ToString();
173 [MonoTODO]
174 public override void UpButton()
176 if( Value_ != Maximum_) {
177 Value = Math.Min(Value_ + Increment_, Maximum_);
182 // --- Public Events
185 public event EventHandler ValueChanged;
188 // --- Protected Methods
190 [MonoTODO]
191 protected override AccessibleObject CreateAccessibilityInstance()
193 //FIXME:
194 return base.CreateAccessibilityInstance();
197 [MonoTODO]
198 protected override void OnTextBoxKeyPress(object source, KeyPressEventArgs e)
200 //FIXME:
201 base.OnTextBoxKeyPress(source, e);
204 [MonoTODO]
205 protected virtual void OnValueChanged(EventArgs e)
207 //FIXME:
210 [MonoTODO]
211 protected void ParseEditText()
213 //FIXME:
216 [MonoTODO]
217 protected override void UpdateEditText()
219 //FIXME:
220 base.Text = Value_.ToString();
223 [MonoTODO]
224 protected override void ValidateEditText()
226 //FIXME:
227 base.ValidateEditText();
230 void ISupportInitialize.BeginInit(){
231 //FIXME:
234 void ISupportInitialize.EndInit(){
235 //FIXME: