// Author:
// stubbed out by Paul Osman (paul.osman@sympatico.ca)
// Dennis Hayes (dennish@raytek.com)
+// Alexandre Pigolkine (pigolkine@gxm.de)
//
-// (C) 2002 Ximian, Inc
+// (C) 2002/3 Ximian, Inc
//
using System.ComponentModel;
namespace System.Windows.Forms {
public class NumericUpDown : UpDownBase, ISupportInitialize {
+ private decimal Value_ = 0;
+ private int DecimalPlaces_;
+ private bool Hexadecimal_ = false;
+ private decimal Increment_ = 1;
+ private decimal Maximum_ = 100;
+ private decimal Minimum_ = 0;
//
// --- Constructor
//
}
public override void DownButton(){
- throw new NotImplementedException ();
+ if( Value_ > Minimum_) {
+ Value = Math.Max(Value_ - Increment_, Minimum_);
+ }
}
+
//
// --- Public Properties
//
[MonoTODO]
public int DecimalPlaces {
get {
- throw new NotImplementedException ();
+ return DecimalPlaces_;
}
set {
- throw new NotImplementedException ();
+ //FIXME:
+ DecimalPlaces_ = value;
}
}
[MonoTODO]
public bool Hexadecimal {
get {
- throw new NotImplementedException ();
+ return Hexadecimal_;
}
set {
- throw new NotImplementedException ();
+ //FIXME:
+ Hexadecimal_ = value;
}
}
+ public decimal Increment {
+ get {
+ return Increment_;
+ }
+ set {
+ Increment_ = value;
+ }
+ }
+
[MonoTODO]
public decimal Maximum {
get {
- throw new NotImplementedException ();
+ return Maximum_;
}
set {
- throw new NotImplementedException ();
+ //FIXME:
+ if( Maximum_ != value) {
+ Maximum_ = value;
+ Minimum = Math.Min(Maximum_,Minimum_);
+ Value = Math.Min(Value_,Minimum_);
+ }
}
}
[MonoTODO]
public decimal Minimum {
get {
- throw new NotImplementedException ();
+ return Minimum_;
}
set {
- throw new NotImplementedException ();
+ //FIXME:
+ if( Minimum_ != value) {
+ Minimum_ = value;
+ Maximum = Math.Max(Maximum_,Minimum_);
+ Value = Math.Max(Value_,Minimum_);
+ }
}
}
public override string Text {
//FIXME: just to get it to run
get {
- return base.Text;
+ return Value_.ToString();
}
set {
- base.Text = value;
+ Value = Decimal.Parse(value);
}
}
throw new NotImplementedException ();
}
set {
- throw new NotImplementedException ();
+ //FIXME:
}
}
[MonoTODO]
public decimal Value {
get {
- throw new NotImplementedException ();
+ return Value_;
}
set {
- throw new NotImplementedException ();
+ //FIXME:
+ if( Value_ != value) {
+ Value_ = value;
+ UpdateEditText();
+ }
}
}
[MonoTODO]
public override string ToString()
{
- throw new NotImplementedException ();
+ //FIXME:
+ return base.ToString();
}
[MonoTODO]
public override void UpButton()
{
- throw new NotImplementedException ();
+ if( Value_ != Maximum_) {
+ Value = Math.Min(Value_ + Increment_, Maximum_);
+ }
}
//
[MonoTODO]
protected override AccessibleObject CreateAccessibilityInstance()
{
- throw new NotImplementedException ();
+ //FIXME:
+ return base.CreateAccessibilityInstance();
}
[MonoTODO]
protected override void OnTextBoxKeyPress(object source, KeyPressEventArgs e)
{
- throw new NotImplementedException ();
+ //FIXME:
+ base.OnTextBoxKeyPress(source, e);
}
[MonoTODO]
protected virtual void OnValueChanged(EventArgs e)
{
- throw new NotImplementedException ();
+ //FIXME:
}
[MonoTODO]
protected void ParseEditText()
{
- throw new NotImplementedException ();
+ //FIXME:
}
[MonoTODO]
protected override void UpdateEditText()
{
- throw new NotImplementedException ();
+ //FIXME:
+ base.Text = Value_.ToString();
}
[MonoTODO]
protected override void ValidateEditText()
{
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public override bool Equals(object o) {
- throw new NotImplementedException ();
- }
-
- [MonoTODO]
- public override int GetHashCode() {
- //FIXME add our proprities
- return base.GetHashCode();
+ //FIXME:
+ base.ValidateEditText();
}
void ISupportInitialize.BeginInit(){