diff mde/gui/gui.d @ 28:b5fadd8d930b

Small addition to GUI, paths work-around for Windows. New GUI widget containing a widget. Paths on windows now uses "." and "./user" as a temporary measure. committer: Diggory Hardy <diggory.hardy@gmail.com>
author Diggory Hardy <diggory.hardy@gmail.com>
date Tue, 08 Apr 2008 15:52:21 +0100
parents 0aa621b3e070
children f985c28c0ec9
line wrap: on
line diff
--- a/mde/gui/gui.d	Fri Apr 04 17:07:38 2008 +0100
+++ b/mde/gui/gui.d	Tue Apr 08 15:52:21 2008 +0100
@@ -16,6 +16,7 @@
 /// Base GUI module.
 module mde.gui.gui;
 
+import mde.gui.IWindow;
 import mde.gui.Widget;
 import mde.gui.exception;
 
@@ -68,11 +69,11 @@
                 windows ~= w;
                 try {
                     w.finalise();
+                    
+                    gl.addDrawCallback (&w.draw);
                 } catch (WindowLoadException e) {
                     logger.error ("Window failed to load: " ~ e.msg);
                 }
-                
-                gl.addDrawCallback (&w.draw);
             }
         }
     }
@@ -91,7 +92,7 @@
 * Let the window load a table of widget data, of type int[][widgetID]. Each widget will, when
 * created, be given its int[] of data, which this() must confirm is valid (or throw).
 */
-class Window : mt.IDataSection
+class Window : mt.IDataSection, IWindow
 {
     alias int widgetID;     // Widget ID type. Each ID is unique under this window. Type is int since this is the widget data type.
     private int[][widgetID] widgetData;     // Data for all widgets under this window.
@@ -101,7 +102,7 @@
     int x,y;                        // Window position
     int w,h;                        // Window size (calculated from Widgets)
     
-    const BORDER_WIDTH = 5;         // Temporary way to handle window decorations
+    const BORDER_WIDTH = 8;         // Temporary way to handle window decorations
     
     
     // Call after loading is finished to setup the window and confirm that it's valid.
@@ -122,7 +123,7 @@
             if (d is null) throw new WindowLoadException ("Widget not found");
             
             // Throws WidgetDataException (a WindowLoadException) if bad data:
-            Widget w = createWidget (*d);
+            Widget w = createWidget (this, *d);
             widgets[i] = w;
             return w;
         }