changeset 70:340c3777ea68

Use Container.descendantsPlus in getFocusableDescendants for shorter code.
author Jordan Miner <jminer7@gmail.com>
date Mon, 10 Aug 2009 03:38:06 -0500
parents b5460ba7c93e
children 63ea570c8d7c
files dynamin/gui/container.d
diffstat 1 files changed, 3 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/dynamin/gui/container.d	Mon Aug 10 03:22:42 2009 -0500
+++ b/dynamin/gui/container.d	Mon Aug 10 03:38:06 2009 -0500
@@ -50,24 +50,13 @@
 	// allocation will be done.
 	Control[] getFocusableDescendants(Control[] des = null) {
 		uint cur = 0;
-
-		void addDescendants(Container c) {
-			if(c._focusable) { // TODO: && c.enabled) {
+		foreach(d; &descendantsPlus) {
+			if(d.focusable) { // TODO: && ch.enabled) {
 				if(cur == des.length)
 					des.length = des.length + 20;
-				des[cur++] = c;
-			}
-			foreach(ch; c._children) {
-				if(cast(Container)ch)
-					addDescendants(cast(Container)ch);
-				else if(ch.focusable) { // TODO: && ch.enabled) {
-					if(cur == des.length)
-						des.length = des.length + 20;
-					des[cur++] = ch;
-				}
+				des[cur++] = d;
 			}
 		}
-		addDescendants(this);
 		return des[0..cur];
 	}
 	unittest {