2 // System.Windows.Forms.Button.cs
5 // stubbed out by Jaak Simm (jaaksimm@firm.ee)
6 // implemented for Gtk+ by Philip Van Hoof (me@freax.org)
8 // (C) Ximian, Inc., 2002
13 namespace System.Windows.Forms {
18 public class ScrollBar : Control {
19 internal Gtk.Adjustment adj;
23 private double step_increment;
24 private double page_increment;
25 private double page_size;
31 public ScrollBar() : base(){
36 this.step_increment = 1;
37 this.page_increment = 10;
39 this.adj = new Gtk.Adjustment(val, lower, upper, step_increment, page_increment, page_size);
40 //spec says tabstop defaults to false.
46 // --- Public Properties
50 public int LargeChange {
51 get {return (int)page_increment;}
54 String st = String.Format (
55 "'{0}' is not a valid value for LargeChange."+
56 "It should be >= 0", value
58 throw new ArgumentException (st);
60 page_increment = value;
66 get {return (int) upper;}
71 if (value < this.Value)
79 get {return (int) lower;}
89 public int SmallChange {
90 get { return (int) step_increment;}
93 String st = String.Format (
94 "'{0}' is not a valid value for SmallChange."+
95 "It should be >= 0", value
97 throw new ArgumentException (st);
99 step_increment = value;
105 get {return (int) val; }
108 if ((value > upper) || (value < lower)){
109 String st = String.Format (
110 "'{0}' is not a valid value for Minimum."+
111 " It should be betwen Minimum and Maximum", value);
113 throw new ArgumentException (st);
124 public event ScrollEventHandler Scroll;
125 public event EventHandler ValueChanged;
127 protected virtual void OnValueChanged (EventArgs args){
128 if (ValueChanged != null)
129 ValueChanged (this, args);
131 protected virtual void OnScroll (ScrollEventArgs args){
136 protected override void OnEnabledChanged(EventArgs e){
137 throw new NotImplementedException();
141 protected override void OnHandleCreated(EventArgs e){
142 throw new NotImplementedException();
147 internal protected void changed_cb (object o, EventArgs args){
148 val = this.adj.Value;
149 OnValueChanged(args);
150 OnScroll (new ScrollEventArgs(ScrollEventType.ThumbPosition ,(int) val));
153 internal protected void ConnectToChanged (){
154 this.adj.ValueChanged += new EventHandler (changed_cb);
157 internal protected void UpdateGtkScroll(){
158 this.adj.SetBounds (lower, upper, step_increment, page_increment, page_size);
159 if ((int) val != this.adj.Value)
160 this.adj.Value = (int) val;