aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/ScrollBar.cs
blob: ea75d6d18c4a63c4219dd97416dc68530105916d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Xml.Serialization;
using System.ComponentModel;
using OpenTK.Input;

namespace Crow
{
	[DefaultTemplate("#Crow.Templates.ScrollBar.goml")]
	public class ScrollBar : NumericControl
	{
		Orientation _orientation;

		#region CTOR
		public ScrollBar() : base()	{}
		#endregion

		[XmlAttributeAttribute()][DefaultValue(0.0)]
		public override double Maximum {
			get { return base.Maximum; }
			set { base.Maximum = value; }
		}
		[XmlAttributeAttribute()][DefaultValue(Orientation.Vertical)]
		public virtual Orientation Orientation
		{
			get { return _orientation; }
			set {				
				if (_orientation == value)
					return;
				_orientation = value;
				NotifyValueChanged ("Orientation", _orientation);
				RegisterForGraphicUpdate ();
			}
		}
		public void onScrollBack (object sender, MouseButtonEventArgs e)
		{
			Value -= SmallIncrement;
		}
		public void onScrollForth (object sender, MouseButtonEventArgs e)
		{
			Value += SmallIncrement;
		}

		public void onSliderValueChange(object sender, ValueChangeEventArgs e){
			if (e.MemberName == "Value")
				Value = Convert.ToDouble(e.NewValue);
		}
	}
}