Mercurial > projects > mde
diff mde/gui/widget/createWidget.d @ 39:5132301e9ed7
Implemented widget saving.
Widget creation data saving (sub-widgets, etc:) code there but not used.
Widget mutable data saving & loading: window size/position, row/column dimensions saved (still needs a fix in GridWidget.setSize()).
committer: Diggory Hardy <diggory.hardy@gmail.com>
author | Diggory Hardy <diggory.hardy@gmail.com> |
---|---|
date | Wed, 07 May 2008 13:07:03 +0100 |
parents | 052df9b2fe07 |
children | 07bd1a09e161 |
line wrap: on
line diff
--- a/mde/gui/widget/createWidget.d Mon May 05 17:02:21 2008 +0100 +++ b/mde/gui/widget/createWidget.d Wed May 07 13:07:03 2008 +0100 @@ -24,14 +24,13 @@ /** Create a widget of type data[0] (see enum WIDGET_TYPES) for _window window, with initialisation * data [1..$]. */ -IWidget createWidget (IWindow window, IWidget parent, int[] data) +IWidget createWidget (IWindow window, int[] data) in { assert (window !is null, "createWidget: window is null"); - assert (parent !is null, "createWidget: parent is null"); } body { if (data.length < 1) throw new WidgetDataException ("No widget data"); int type = data[0]; // type is first element of data - data = data[1..$]; // the rest is passed to the Widget + // the whole of data is passed to the Widget mixin (binarySearch ("type", WIDGETS)); throw new WidgetDataException ("Bad widget type"); @@ -100,7 +99,7 @@ ret ~= indent(indents); foreach (c; consts) { ret ~= "if (" ~ var ~ " == WIDGET_TYPE." ~ c ~ ") {\n" ~ - indent(indents+1) ~ "return new " ~ c ~ "Widget (window, parent, data);\n" ~ + indent(indents+1) ~ "return new " ~ c ~ "Widget (window, data);\n" ~ indent(indents) ~ "} else "; } ret = ret[0..$-6] ~ '\n'; // remove last else