1 // CurvyWeb -- By Joey Adams
6 text = "Form1 Professional Edition";
7 background = activeBorder;
13 anchor = { horz = -19, vert = 44 };
18 Slider slider { this, size = { 25, 350 }, position = {375, 25}, direction=vertical, percent=(double)webDensity/200.0;
20 bool NotifySlide(Slider slider, double percent)
22 webDensity = (int)(percent*200);
28 void OnResize(int width, int height)
30 slider.position.x = width-25;
31 slider.size.h = height-50;
34 void OnRedraw(Surface surface)
37 w = this.clientSize.w-1;
38 h = this.clientSize.h-1;
43 surface.DrawLine(0,i*h/d,i*w/d,h);
46 /*void OnRedraw(Surface surface)
49 w = this.clientSize.w-1;
50 h = this.clientSize.h-1;
54 for (i=0; i<=d; i++) {
55 surface.DrawLine(i*w/d,0,i*w/d,h);
56 surface.DrawLine(0,i*h/d,w,i*h/d);
61 //Ar, ye slider be pirated from Acovel Player!
68 bool OnLeftButtonDown(int x, int y, Modifiers mods)
75 define skinBackground = Color { r = 40, g = 40, b = 40 };
76 define skinForeground = white;
80 ScrollDirection direction;
86 void OnRedraw(Surface surface)
88 if(direction == horizontal)
90 int pos = (int)((clientSize.w-7) * percent + 0.5) + 3;
91 surface.SetBackground(skinForeground);
92 surface.Area(0, clientSize.h / 2 - 3, clientSize.w-1, clientSize.h/2 + 3);
93 surface.SetForeground(black);
94 surface.Rectangle(1, clientSize.h / 2 - 2, clientSize.w-2, clientSize.h/2 + 2);
96 surface.SetBackground(darkGray);
97 surface.Area(pos - 3, 0, pos + 3, clientSize.h-1);
98 surface.SetForeground(white);
99 surface.Rectangle(pos - 3, 0, pos + 3, clientSize.h-1);
100 surface.VLine(2, clientSize.h-3, pos);
104 int pos = (int)((clientSize.h-7) * (1.0-percent) + 0.5) + 3;
105 surface.SetBackground(skinForeground);
106 surface.Area(clientSize.w / 2 - 3, 0, clientSize.w/2 + 3, clientSize.h-1);
107 surface.SetForeground(black);
108 surface.Rectangle(clientSize.w / 2 - 2, 1, clientSize.w/2 + 2, clientSize.h-2);
110 surface.SetBackground(darkGray);
111 surface.Area(0, pos - 3, clientSize.w-1, pos + 3);
112 surface.SetForeground(white);
113 surface.Rectangle(0, pos - 3, clientSize.w-1, pos + 3);
114 surface.HLine(2, clientSize.w-3, pos);
118 bool OnLeftButtonDown(int x, int y, Modifiers mods)
122 OnMouseMove(x, y, mods);
126 bool OnMouseMove(int x, int y, Modifiers mods)
130 if(direction == horizontal)
131 percent = ((double)x - offset - 3) / (double)(clientSize.w-7);
133 percent = 1.0-((double)y - offset - 3) / (double)(clientSize.h-7);
134 // TO FIX: Max(Min didn't work with double
135 if(percent < 0) percent = 0;
136 else if(percent > 1) percent = 1;
138 NotifySlide(master, this, percent);
143 void OnMouseCaptureLost()
145 OnLeftButtonUp(0,0,0);
148 bool OnLeftButtonUp(int x, int y, Modifiers mods)
154 NotifySlideUp(master, this, percent);
160 virtual bool Window::NotifySlide(Slider slider, double percent);
161 virtual bool Window::NotifySlideUp(Slider slider, double percent);
162 property double percent
164 get { return percent; }
165 set { if(!dragging) { percent = value; Update(null); } }
167 property ScrollDirection direction
169 set { direction = value; }
170 get { return direction; }