Mercurial > projects > dynamin
comparison dynamin/gui/control.d @ 68:6580fabb7dce
Setting a property to the value it already is shouldn't do anything
author | Jordan Miner <jminer7@gmail.com> |
---|---|
date | Mon, 10 Aug 2009 02:48:15 -0500 |
parents | 419e38206522 |
children | 76b081749316 |
comparison
equal
deleted
inserted
replaced
67:419e38206522 | 68:6580fabb7dce |
---|---|
493 void location(Point pt) { | 493 void location(Point pt) { |
494 if((cast(Window)_parent) !is null) | 494 if((cast(Window)_parent) !is null) |
495 throw new Exception("cannot set location of a window's content"); | 495 throw new Exception("cannot set location of a window's content"); |
496 pt.x = round(pt.x); | 496 pt.x = round(pt.x); |
497 pt.y = round(pt.y); | 497 pt.y = round(pt.y); |
498 if(_location == pt) | |
499 return; | |
498 repaint(); | 500 repaint(); |
499 _location = pt; | 501 _location = pt; |
500 repaint(); | 502 repaint(); |
501 moved(new EventArgs); | 503 moved(new EventArgs); |
502 } | 504 } |
521 newSize.width = 0; | 523 newSize.width = 0; |
522 if(newSize.height < 0) | 524 if(newSize.height < 0) |
523 newSize.height = 0; | 525 newSize.height = 0; |
524 newSize.width = round(newSize.width); | 526 newSize.width = round(newSize.width); |
525 newSize.height = round(newSize.height); | 527 newSize.height = round(newSize.height); |
528 if(_size == newSize) | |
529 return; | |
526 repaint(); | 530 repaint(); |
527 _size = newSize; | 531 _size = newSize; |
528 repaint(); | 532 repaint(); |
529 resized(new EventArgs); | 533 resized(new EventArgs); |
530 } | 534 } |
576 * Gets or sets the text that this control shows. | 580 * Gets or sets the text that this control shows. |
577 */ | 581 */ |
578 string text() { return _text.dup; } | 582 string text() { return _text.dup; } |
579 /// ditto | 583 /// ditto |
580 void text(string str) { | 584 void text(string str) { |
585 if(_text == str) | |
586 return; | |
581 _text = str.dup; | 587 _text = str.dup; |
582 repaint(); | 588 repaint(); |
583 //TextChanged(EventArgs e) // TODO: add event | 589 //TextChanged(EventArgs e) // TODO: add event |
584 } | 590 } |
585 | 591 |
587 * Gets or sets the background color of this control. | 593 * Gets or sets the background color of this control. |
588 */ | 594 */ |
589 Color backColor() { return _backColor; } | 595 Color backColor() { return _backColor; } |
590 /// ditto | 596 /// ditto |
591 void backColor(Color c) { | 597 void backColor(Color c) { |
598 if(_backColor == c) | |
599 return; | |
592 _backColor = c; | 600 _backColor = c; |
593 repaint(); | 601 repaint(); |
594 } | 602 } |
595 | 603 |
596 /** | 604 /** |
597 * Gets or sets the foreground color of this control. | 605 * Gets or sets the foreground color of this control. |
598 */ | 606 */ |
599 Color foreColor() { return _foreColor; } | 607 Color foreColor() { return _foreColor; } |
600 /// ditto | 608 /// ditto |
601 void foreColor(Color c) { | 609 void foreColor(Color c) { |
610 if(_foreColor == c) | |
611 return; | |
602 _foreColor = c; | 612 _foreColor = c; |
603 repaint(); | 613 repaint(); |
604 } | 614 } |
605 | 615 |
606 /** | 616 /** |
615 //else | 625 //else |
616 return _font; | 626 return _font; |
617 } | 627 } |
618 /// ditto | 628 /// ditto |
619 void font(Font f) { | 629 void font(Font f) { |
630 if(_font is f) | |
631 return; | |
620 _font = f; | 632 _font = f; |
621 repaint(); | 633 repaint(); |
622 } | 634 } |
623 | 635 |
624 void setCurrentCursor(Cursor cur) { | 636 void setCurrentCursor(Cursor cur) { |