changeset 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 b5460ba7c93e
files dynamin/gui/check_box.d dynamin/gui/container.d dynamin/gui/control.d dynamin/gui/notebook.d dynamin/gui/window.d
diffstat 5 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dynamin/gui/check_box.d	Mon Aug 10 02:46:42 2009 -0500
+++ b/dynamin/gui/check_box.d	Mon Aug 10 02:48:15 2009 -0500
@@ -76,7 +76,10 @@
 	}
 	/// ditto
 	void checked(bool b) {
+		auto old = _checkState;
 		_checkState = b ? CheckState.Checked : CheckState.Unchecked;
+		if(_checkState == old)
+			return;
 		repaint();
 		checkedChanged(new EventArgs);
 	}
--- a/dynamin/gui/container.d	Mon Aug 10 02:46:42 2009 -0500
+++ b/dynamin/gui/container.d	Mon Aug 10 02:48:15 2009 -0500
@@ -315,6 +315,8 @@
 	Size minSize() { return _minSize; }
 	/// ditto
 	void minSize(Size size) {
+		if(_minSize == size)
+			return;
 		_minSize = size;
 		minSizeChanged(new EventArgs);
 	}
@@ -336,6 +338,8 @@
 	Size maxSize() { return _maxSize; }
 	/// ditto
 	void maxSize(Size size) {
+		if(_maxSize == size)
+			return;
 		_maxSize = size;
 		minSizeChanged(new EventArgs);
 	}
--- a/dynamin/gui/control.d	Mon Aug 10 02:46:42 2009 -0500
+++ b/dynamin/gui/control.d	Mon Aug 10 02:48:15 2009 -0500
@@ -495,6 +495,8 @@
 			throw new Exception("cannot set location of a window's content");
 		pt.x = round(pt.x);
 		pt.y = round(pt.y);
+		if(_location == pt)
+			return;
 		repaint();
 		_location = pt;
 		repaint();
@@ -523,6 +525,8 @@
 			newSize.height = 0;
 		newSize.width = round(newSize.width);
 		newSize.height = round(newSize.height);
+		if(_size == newSize)
+			return;
 		repaint();
 		_size = newSize;
 		repaint();
@@ -578,6 +582,8 @@
 	string text() { return _text.dup; }
 	/// ditto
 	void text(string str) {
+		if(_text == str)
+			return;
 		_text = str.dup;
 		repaint();
 		//TextChanged(EventArgs e) // TODO: add event
@@ -589,6 +595,8 @@
 	Color backColor() { return _backColor; }
 	/// ditto
 	void backColor(Color c) {
+		if(_backColor == c)
+			return;
 		_backColor = c;
 		repaint();
 	}
@@ -599,6 +607,8 @@
 	Color foreColor() { return _foreColor; }
 	/// ditto
 	void foreColor(Color c) {
+		if(_foreColor == c)
+			return;
 		_foreColor = c;
 		repaint();
 	}
@@ -617,6 +627,8 @@
 	}
 	/// ditto
 	void font(Font f) {
+		if(_font is f)
+			return;
 		_font = f;
 		repaint();
 	}
--- a/dynamin/gui/notebook.d	Mon Aug 10 02:46:42 2009 -0500
+++ b/dynamin/gui/notebook.d	Mon Aug 10 02:48:15 2009 -0500
@@ -151,6 +151,8 @@
 	int selectedIndex() { return _selectedIndex; }
 	/// ditto
 	void selectedIndex(int index) {
+		if(_selectedIndex == index)
+			return;
 		if(index < -1)
 			throw new IllegalArgumentException("index cannot be less than -1");
 		_selectedIndex = index;
--- a/dynamin/gui/window.d	Mon Aug 10 02:46:42 2009 -0500
+++ b/dynamin/gui/window.d	Mon Aug 10 02:48:15 2009 -0500
@@ -397,6 +397,8 @@
 	//       the taskbar, then show it on taskbar if window has an owner,
 	//       but don't if it does not
 	void owner(Window w) {
+		if(_owner == w)
+			return;
 		_owner = w;
 		if(!handleCreated)
 			return;
@@ -410,6 +412,8 @@
 	bool visible() { return _visible; }
 	/// ditto
 	void visible(bool b) {
+		if(_visible == b)
+			return;
 		_visible = b;
 		backend_visible = b;
 
@@ -450,6 +454,8 @@
 	WindowBorderStyle borderStyle() { return _borderStyle; }
 	/// ditto
 	void borderStyle(WindowBorderStyle border) {
+		if(_borderStyle == border)
+			return;
 		if(border > WindowBorderStyle.Tool)
 			throw new IllegalArgumentException("Window.borderStyle(): invalid border style");
 		_borderStyle = border;
@@ -495,6 +501,8 @@
 	bool resizable() { return _resizable; }
 	/// ditto
 	void resizable(bool b) {
+		if(_resizable == b)
+			return;
 		_resizable = b;
 		if(!handleCreated)
 			return;