comparison mde/gui/widget/createWidget.d @ 85:56c0ddd90193

Intermediate commit (not stable). Changes to init system.
author Diggory Hardy <diggory.hardy@gmail.com>
date Thu, 11 Sep 2008 11:33:51 +0100
parents ea58f277f487
children b525ff28774b
comparison
equal deleted inserted replaced
84:e0f1ec7fe73a 85:56c0ddd90193
51 data.ints = [WIDGET_TYPE.Debug]; 51 data.ints = [WIDGET_TYPE.Debug];
52 } 52 }
53 int type = data.ints[0]; // type is first element of data 53 int type = data.ints[0]; // type is first element of data
54 54
55 //pragma (msg, binarySearch ("type", WIDGETS)); 55 //pragma (msg, binarySearch ("type", WIDGETS));
56 mixin (binarySearch ("type", WIDGETS)); // creates widget by type as new *Widget (mgr, data); 56 mixin (binarySearch ("type", WIDGETS)); // creates widget by type: new XWidget (mgr, data [, parent]);
57 57
58 // Not returned a new widget... 58 // Not returned a new widget...
59 logger.error ("Bad widget type: {}; creating a debug widget instead.",type); 59 logger.error ("Bad widget type: {}; creating a debug widget instead.",type);
60 return new DebugWidget (mgr, data); 60 return new DebugWidget (mgr, data);
61 } 61 }
121 "}\n"; 121 "}\n";
122 } else { 122 } else {
123 char[] ret; 123 char[] ret;
124 foreach (c; consts) { 124 foreach (c; consts) {
125 ret ~= "if (" ~ var ~ " == WIDGET_TYPE." ~ c ~ ") {\n" ~ 125 ret ~= "if (" ~ var ~ " == WIDGET_TYPE." ~ c ~ ") {\n" ~
126 " debug logger.trace (\"Creating new "~c~"Widget.\");\n" ~ 126 " debug (mdeWidgets) logger.trace (\"Creating new "~c~"Widget.\");\n" ~
127 " static if (WIDGET_TYPE."~c~" & WIDGET_TYPE.TAKES_PARENT)\n" ~ 127 " static if (WIDGET_TYPE."~c~" & WIDGET_TYPE.TAKES_PARENT)\n" ~
128 " return new " ~ c ~ "Widget (mgr, data, parent);\n" ~ 128 " return new " ~ c ~ "Widget (mgr, data, parent);\n" ~
129 " else\n" ~ 129 " else\n" ~
130 " return new " ~ c ~ "Widget (mgr, data);\n" ~ 130 " return new " ~ c ~ "Widget (mgr, data);\n" ~
131 "} else "; 131 "} else ";