diff mde/gui/widget/Floating.d @ 111:1655693702fc

Resolved ticket #4, allowing widgets to reload strings and recalculate sizes mid-run. Removed prefinalize and finalize and added setup as the new second initialization phase, which can be re-run.
author Diggory Hardy <diggory.hardy@gmail.com>
date Sat, 06 Dec 2008 17:41:42 +0000
parents 42e241e7be3e
children b16a534f5302
line wrap: on
line diff
--- a/mde/gui/widget/Floating.d	Fri Dec 05 11:29:39 2008 +0000
+++ b/mde/gui/widget/Floating.d	Sat Dec 06 17:41:42 2008 +0000
@@ -60,10 +60,13 @@
         super (mgr, id, data);
     }
     
-    void finalize () {
+    bool setup (uint n, uint flags) {
         foreach (i, ref d; sWData) with (d) {
             auto widg = subWidgets[i];
-            d.border = mgr.renderer.getBorder (borderType, widg.isWSizable, widg.isHSizable);
+	    if (!widg.setup (n, flags) && n != 0 && !(flags & 1))
+		continue;	// no changes; skip the rest
+	    
+	    d.border = mgr.renderer.getBorder (borderType, widg.isWSizable, widg.isHSizable);
             mw = widg.minWidth  + border.x1 + border.x2;
             mh = widg.minHeight + border.y1 + border.y2;
 	    if (w < mw || !widg.isWSizable) w = mw;
@@ -71,6 +74,7 @@
             widg.setWidth  (w - border.x1 - border.x2, -1);
             widg.setHeight (h - border.y1 - border.y2, -1);
         }
+	return false;	// floating area size is not changed
     }
     
     bool saveChanges () {