diff mde/gui/widget/Floating.d @ 121:5b37d0400732

Widgets now receive and store their parent (IParentWidget). Infinite widget recursion checks. WidgetManager code redistributed. WidgetManager code redistributed between classes; WMScreen class moved to WMScreen.d. addContent function now calls makeWidget with another id.
author Diggory Hardy <diggory.hardy@gmail.com>
date Fri, 02 Jan 2009 18:07:10 +0000
parents b16a534f5302
children d3b2cefd46c9
line wrap: on
line diff
--- a/mde/gui/widget/Floating.d	Thu Jan 01 15:16:00 2009 +0000
+++ b/mde/gui/widget/Floating.d	Fri Jan 02 18:07:10 2009 +0000
@@ -38,15 +38,16 @@
  */
 class FloatingAreaWidget : AParentWidget
 {
-    this (IWidgetManager mgr, widgetID id, WidgetData data) {
+    this (IWidgetManager mgr, IParentWidget parent, widgetID id, WidgetData data) {
         if (data.ints.length != 1 + data.strings.length)
             throw new WidgetDataException (this);
+        super (mgr, parent, id);
         
         subWidgets.length = data.strings.length;        // widgets created from string data
         sWOrder.length = subWidgets.length;
         sWData.length = subWidgets.length;
         foreach (i,s; data.strings) {
-            subWidgets[i] = mgr.makeWidget (s);
+            subWidgets[i] = mgr.makeWidget (this, s);
             sWOrder[i] = i;
             sWData[i].borderType = cast(BTYPE) data.ints[i+1];
         }
@@ -56,11 +57,10 @@
             foreach (i, ref d; sWData)
                 (&d.x)[0..4] = dd[i*4..i*4+4];
         }
-        
-        super (mgr, id, data);
     }
     
     override bool setup (uint n, uint flags) {
+        debug (mdeWidgets) logger.trace ("FloatingAreaWidget.setup");
         foreach (i, ref d; sWData) with (d) {
             auto widg = subWidgets[i];
 	    if (!widg.setup (n, flags) && n != 0 && !(flags & 1))
@@ -84,7 +84,7 @@
             dd[4*i..4*i+4] = (&d.x)[0..4];
         }
         
-        mgr.setDimData (id, dd);  // save positions
+        mgr.dimData (id, dd);	// save positions
         return true;
     }