Mercurial > projects > dynamin
comparison dynamin/gui/control.d @ 104:5c8c1c2e12c0
Change from real to double.
double is not dependant on the platform, and it uses less space.
author | Jordan Miner <jminer7@gmail.com> |
---|---|
date | Fri, 06 Jul 2012 18:39:45 -0500 |
parents | 73060bc3f004 |
children | acdbb30fee7e |
comparison
equal
deleted
inserted
replaced
103:73060bc3f004 | 104:5c8c1c2e12c0 |
---|---|
407 */ | 407 */ |
408 bool contains(Point pt) { | 408 bool contains(Point pt) { |
409 return pt.x >= 0 && pt.y >= 0 && pt.x < width && pt.y < height; | 409 return pt.x >= 0 && pt.y >= 0 && pt.x < width && pt.y < height; |
410 } | 410 } |
411 /// ditto | 411 /// ditto |
412 bool contains(real x, real y) { | 412 bool contains(double x, double y) { |
413 return contains(Point(x, y)); | 413 return contains(Point(x, y)); |
414 } | 414 } |
415 | 415 |
416 /** | 416 /** |
417 * Returns true if this control is a top-level control and false otherwise. | 417 * Returns true if this control is a top-level control and false otherwise. |
479 _location = pt; | 479 _location = pt; |
480 repaint(); | 480 repaint(); |
481 moved(new EventArgs); | 481 moved(new EventArgs); |
482 } | 482 } |
483 /// ditto | 483 /// ditto |
484 void location(real[] pt) { | 484 void location(double[] pt) { |
485 assert(pt.length == 2, "pt must be just an x and y"); | 485 assert(pt.length == 2, "pt must be just an x and y"); |
486 location = Point(pt[0], pt[1]); | 486 location = Point(pt[0], pt[1]); |
487 } | 487 } |
488 | 488 |
489 /** | 489 /** |
509 _size = newSize; | 509 _size = newSize; |
510 repaint(); | 510 repaint(); |
511 resized(new EventArgs); | 511 resized(new EventArgs); |
512 } | 512 } |
513 /// ditto | 513 /// ditto |
514 void size(real[] newSize) { | 514 void size(double[] newSize) { |
515 assert(newSize.length == 2, "size must be just a width and height"); | 515 assert(newSize.length == 2, "size must be just a width and height"); |
516 size = Size(newSize[0], newSize[1]); | 516 size = Size(newSize[0], newSize[1]); |
517 } | 517 } |
518 | 518 |
519 /** | 519 /** |
531 * text, 0 may be returned. | 531 * text, 0 may be returned. |
532 */ | 532 */ |
533 int baseline() { return 0; } | 533 int baseline() { return 0; } |
534 | 534 |
535 /// Same as location.x | 535 /// Same as location.x |
536 real x() { return location.x; } | 536 double x() { return location.x; } |
537 /// Same as location.y | 537 /// Same as location.y |
538 real y() { return location.y; } | 538 double y() { return location.y; } |
539 /// Same as size.width | 539 /// Same as size.width |
540 real width() { return size.width; } | 540 double width() { return size.width; } |
541 /// Same as size.height | 541 /// Same as size.height |
542 real height() { return size.height; } | 542 double height() { return size.height; } |
543 | 543 |
544 /** | 544 /** |
545 * Gets or sets whether this control is elastic horizontally or vertically. | 545 * Gets or sets whether this control is elastic horizontally or vertically. |
546 * If a control is elastic, then it is intended to be made larger than its | 546 * If a control is elastic, then it is intended to be made larger than its |
547 * best size. | 547 * best size. |
645 // not invalidated | 645 // not invalidated |
646 if(_parent) | 646 if(_parent) |
647 _parent.repaint(rect + location); | 647 _parent.repaint(rect + location); |
648 } | 648 } |
649 /// ditto | 649 /// ditto |
650 void repaint(real x, real y, real width, real height) { | 650 void repaint(double x, double y, double width, double height) { |
651 repaint(Rect(x, y, width, height)); | 651 repaint(Rect(x, y, width, height)); |
652 } | 652 } |
653 /** | 653 /** |
654 * Causes the entire control to be repainted. | 654 * Causes the entire control to be repainted. |
655 */ | 655 */ |