14 private Builder _builder;
16#pragma warning disable 649
18 private Gtk.Button okBut;
20 private Gtk.Button cancelBut;
22 private Gtk.SpinButton numericBox;
24 private Gtk.Scale bar;
25#pragma warning restore 649
29 #region Constructors / Destructors
37 Builder builder =
new Builder(
new FileStream(System.IO.Path.GetDirectoryName(Environment.ProcessPath) +
"/" +
"Glade/NumberPicker.glade", FileMode.Open));
38 return new NumberPicker(builder, builder.GetObject(
"numberPicker").Handle, min, max, start);
42 protected NumberPicker(Builder builder, IntPtr handle,
double min,
double max,
double start = 0) : base(handle)
45 builder.Autoconnect(
this);
46 okBut.ButtonPressEvent += OkBut_ButtonPressEvent;
47 cancelBut.ButtonPressEvent += CancelBut_ButtonPressEvent;
48 numericBox.ValueChanged += NumericBox_ValueChanged;
49 bar.ValueChanged += Bar_ValueChanged;
52 numericBox.Adjustment.StepIncrement = 1;
53 bar.Adjustment.StepIncrement = 1;
54 SelectedValue = start;
56 App.ApplyStyles(
this);
59 private void Bar_ValueChanged(
object sender, EventArgs e)
61 numericBox.Value = bar.Value;
64 private void NumericBox_ValueChanged(
object sender, EventArgs e)
66 bar.Value = numericBox.Value;
73 private void CancelBut_ButtonPressEvent(
object o, ButtonPressEventArgs args)
75 Respond(ResponseType.Cancel);
80 private void OkBut_ButtonPressEvent(
object o, ButtonPressEventArgs args)
83 Respond(ResponseType.Ok);
86 public double SelectedValue
88 get {
return numericBox.Value; }
91 numericBox.Value = value;
96 get {
return numericBox.Adjustment.Lower; }
99 numericBox.Adjustment.Lower = value;
100 bar.Adjustment.Lower = value;
105 get {
return numericBox.Adjustment.Upper; }
108 numericBox.Adjustment.Upper = value;
109 bar.Adjustment.Upper = value;