diff mde/gui/widget/layout.d @ 72:159775502bb4

The first dynamically generated widget lists, based on Options, are here!
author Diggory Hardy <diggory.hardy@gmail.com>
date Sat, 05 Jul 2008 18:27:46 +0100
parents 77c7d3235114
children 3dfd934100f7
line wrap: on
line diff
--- a/mde/gui/widget/layout.d	Sat Jul 05 15:36:39 2008 +0100
+++ b/mde/gui/widget/layout.d	Sat Jul 05 18:27:46 2008 +0100
@@ -19,6 +19,9 @@
 import mde.gui.widget.Widget;
 import mde.gui.exception;
 
+import mde.gui.widget.TextWidget;
+import mde.gui.content.options;
+
 debug {
     import tango.util.log.Log : Log, Logger;
     private Logger logger;
@@ -84,24 +87,31 @@
 /*************************************************************************************************
  * Trial layout of sub-widgets of one type only.
  *************************************************************************************************/
-class TrialLayout : GridWidget
+class TrialContentLayoutWidget : GridWidget
 {
     this (IWindow wind, int[] data) {
-        assert (false, "Not ready");
-        if (data.length != 6) throw new WidgetDataException;
-        super (wind, data);
+        debug scope (failure)
+                logger.warn ("TrialContentLayoutWidget: failure");
+        if (data.length != 3) throw new WidgetDataException;
         
-        rows = data[1];
-        cols = data[2];
+        OptionList optsList = OptionList.trial();
+        rows = optsList.list.length;
+        cols = 1;
         
         // Get all sub-widgets
         subWidgets.length = rows*cols;
-        foreach (i, ref subWidget; subWidgets) {
-            //subWidget = new ContentWidget (data[3..6]);
+        foreach (i, c; optsList.list) {
+            subWidgets[i] = new ContentOptionWidget (wind, data[1..3], c);
         }
+        super (wind, data);
     }
     
+    int[] getCreationData () {
+        return [widgetType];
+    }
     
+private:
+    OptionList optsList;
 }
 
 
@@ -115,7 +125,7 @@
  *
  * The grid has no border but has spacing between widgets.
  *************************************************************************************************/
-class GridWidget : Widget
+abstract class GridWidget : Widget
 {
     //BEGIN Creation & saving
     /** Partial constructor for a grid layout widget.