comparison dynamin/gui/scroll_bar.d @ 106:acdbb30fee7e

Port to D2. Most of the effort was dealing with immutable and const.
author Jordan Miner <jminer7@gmail.com>
date Mon, 17 Dec 2012 23:41:50 -0600
parents 5c8c1c2e12c0
children
comparison
equal deleted inserted replaced
105:97997a544ac0 106:acdbb30fee7e
236 this() { 236 this() {
237 _button1.direction = ArrowDirection.Left; 237 _button1.direction = ArrowDirection.Left;
238 _button2.direction = ArrowDirection.Right; 238 _button2.direction = ArrowDirection.Right;
239 } 239 }
240 protected: 240 protected:
241 void whenThumbMouseDown(MouseEventArgs e) { 241 override void whenThumbMouseDown(MouseEventArgs e) {
242 _thumbDragLoc = e.location.x; 242 _thumbDragLoc = e.location.x;
243 } 243 }
244 void whenThumbMouseDragged(MouseEventArgs e) { 244 override void whenThumbMouseDragged(MouseEventArgs e) {
245 _thumb.state = ButtonState.Pressed; 245 _thumb.state = ButtonState.Pressed;
246 thumbLocation = e.location.x + _thumb.location.x - _thumbDragLoc; 246 thumbLocation = e.location.x + _thumb.location.x - _thumbDragLoc;
247 } 247 }
248 void putControl(Control c, double location, double size) { 248 override void putControl(Control c, double location, double size) {
249 c.location = [location, 0.0]; 249 c.location = [location, 0.0];
250 c.size = [size, height]; 250 c.size = [size, height];
251 } 251 }
252 double breadth() { return height; } 252 override double breadth() { return height; }
253 double length() { return width; } 253 override double length() { return width; }
254 alias ScrollBar.thumbLocation thumbLocation; 254 alias ScrollBar.thumbLocation thumbLocation;
255 double thumbLocation() { return _thumb.x; } 255 override double thumbLocation() { return _thumb.x; }
256 double thumbSize() { return _thumb.width; } 256 override double thumbSize() { return _thumb.width; }
257 double trackStart() { return _track1.x; } 257 override double trackStart() { return _track1.x; }
258 double trackEnd() { return _track2.x+_track2.width; } 258 override double trackEnd() { return _track2.x+_track2.width; }
259 } 259 }
260 /// 260 ///
261 class VScrollBar : ScrollBar { 261 class VScrollBar : ScrollBar {
262 this() { 262 this() {
263 _button1.direction = ArrowDirection.Up; 263 _button1.direction = ArrowDirection.Up;
264 _button2.direction = ArrowDirection.Down; 264 _button2.direction = ArrowDirection.Down;
265 } 265 }
266 protected: 266 protected:
267 void whenThumbMouseDown(MouseEventArgs e) { 267 override void whenThumbMouseDown(MouseEventArgs e) {
268 _thumbDragLoc = e.location.y; 268 _thumbDragLoc = e.location.y;
269 } 269 }
270 void whenThumbMouseDragged(MouseEventArgs e) { 270 override void whenThumbMouseDragged(MouseEventArgs e) {
271 _thumb.state = ButtonState.Pressed; 271 _thumb.state = ButtonState.Pressed;
272 thumbLocation = e.location.y + _thumb.location.y - _thumbDragLoc; 272 thumbLocation = e.location.y + _thumb.location.y - _thumbDragLoc;
273 } 273 }
274 void putControl(Control c, double location, double size) { 274 override void putControl(Control c, double location, double size) {
275 c.location = [0.0, location]; 275 c.location = [0.0, location];
276 c.size = [width, size]; 276 c.size = [width, size];
277 } 277 }
278 double breadth() { return width; } 278 override double breadth() { return width; }
279 double length() { return height; } 279 override double length() { return height; }
280 alias ScrollBar.thumbLocation thumbLocation; 280 alias ScrollBar.thumbLocation thumbLocation;
281 double thumbLocation() { return _thumb.y; } 281 override double thumbLocation() { return _thumb.y; }
282 double thumbSize() { return _thumb.height; } 282 override double thumbSize() { return _thumb.height; }
283 double trackStart() { return _track1.y; } 283 override double trackStart() { return _track1.y; }
284 double trackEnd() { return _track2.y+_track2.height; } 284 override double trackEnd() { return _track2.y+_track2.height; }
285 } 285 }
286 286