diff mde/gui/widget/TextWidget.d @ 77:3dfd934100f7

Continuing widget data changes started in last commit: all previous widgets work again now (but lacking saving).
author Diggory Hardy <diggory.hardy@gmail.com>
date Tue, 29 Jul 2008 17:11:22 +0100
parents 25cb7420dc91
children b525ff28774b
line wrap: on
line diff
--- a/mde/gui/widget/TextWidget.d	Mon Jul 28 18:49:18 2008 +0100
+++ b/mde/gui/widget/TextWidget.d	Tue Jul 29 17:11:22 2008 +0100
@@ -60,6 +60,7 @@
 }
 
 /// Basic text widget
+// FIXME (content, creation for different types)
 class ContentWidget(ContentT : IContent) : Widget
 {
     /** Constructor for a widget containing [fixed] content.
@@ -69,8 +70,8 @@
      * where contentID is an ID for the string ID of the contained content
      * and colour is an 8-bit-per-channel RGB colour of the form 0xRRGGBB. */
     this (IWidgetManager mgr, WidgetData data) {
-        if (data.length != 2) throw new WidgetDataException;
-        text.set (data.str, data[1]);
+        WDCheck (data, 2, 1);
+        text.set (data.strings[0], data.ints[1]);
         text.getDimensions (mw, mh);
         super (mgr,data);
     }
@@ -118,11 +119,11 @@
 /// Basic text widget
 class ContentOptionWidget : Widget
 {
-    this (IWindow wind, int[] data, IContent c) {
-        if (data.length != 2) throw new WidgetDataException;
-        content.set (c, data[1]);
+    this (IWidgetManager mgr, WidgetData data, IContent c) {
+        WDCheck (data, 2, 0);
+        content.set (c, data.ints[1]);
         content.getDimensions (mw, mh);
-        super (wind,data);
+        super (mgr,data);
     }
     
     void draw () {