changeset 58:d43523ed4b62

Included a wdim typedef for all variables to do with window position or size instead of just using int.
author Diggory Hardy <diggory.hardy@gmail.com>
date Sat, 14 Jun 2008 17:15:06 +0100
parents 9e1f05fbbcef
children 672b6b162a36
files codeDoc/jobs.txt mde/gui/Gui.d mde/gui/IGui.d mde/gui/renderer/IRenderer.d mde/gui/renderer/SimpleRenderer.d mde/gui/widget/Ifaces.d mde/gui/widget/Widget.d mde/gui/widget/Window.d mde/gui/widget/layout.d mde/gui/widget/miscWidgets.d
diffstat 10 files changed, 125 insertions(+), 104 deletions(-) [+]
line wrap: on
line diff
--- a/codeDoc/jobs.txt	Sat Jun 14 13:09:03 2008 +0100
+++ b/codeDoc/jobs.txt	Sat Jun 14 17:15:06 2008 +0100
@@ -52,5 +52,3 @@
 
 
 Done (for mercurial log message):
-Coloured and alpha-blended text is now supported.
-TextWidgets get text colour from argument.
\ No newline at end of file
--- a/mde/gui/Gui.d	Sat Jun 14 13:09:03 2008 +0100
+++ b/mde/gui/Gui.d	Sat Jun 14 17:15:06 2008 +0100
@@ -147,17 +147,18 @@
     void clickEvent (ushort cx, ushort cy, ubyte b, bool state) {
         debug scope (failure)
                 logger.warn ("clickEvent: failed!");
+        
         // NOTE: buttons receive the up-event even when drag-callbacks are in place.
         foreach (dg; clickCallbacks)
-            if (dg (cx, cy, b, state)) return;      // See IGui.addClickCallback's documentation
+            if (dg (cast(wdabs)cx, cast(wdabs)cy, b, state)) return;      // See IGui.addClickCallback's documentation
         
         foreach (i,w; windows) {
-            IWidget widg = w.getWidget (cx,cy);
+            IWidget widg = w.getWidget (cast(wdabs)cx,cast(wdabs)cy);
             if (widg !is null) {
                 // Bring to front
                 windows = w ~ windows[0..i] ~ windows[i+1..$];
                 
-                widg.clickEvent (cx,cy,b,state);
+                widg.clickEvent (cast(wdabs)cx,cast(wdabs)cy,b,state);
                 return;     // only pass to first window
             }
         }
@@ -170,7 +171,7 @@
         debug scope (failure)
                 logger.warn ("motionEvent: failed!");
         foreach (dg; motionCallbacks)
-            dg (cx, cy);
+            dg (cast(wdabs)cx, cast(wdabs)cy);
     }
     
     //END Methods for external use
@@ -184,10 +185,10 @@
         imde.mainSchedule.request(imde.SCHEDULE.DRAW);
     }
     
-    void addClickCallback (bool delegate(ushort, ushort, ubyte, bool) dg) {
+    void addClickCallback (bool delegate(wdabs, wdabs, ubyte, bool) dg) {
         clickCallbacks[dg.ptr] = dg;
     }
-    void addMotionCallback (void delegate(ushort, ushort) dg) {
+    void addMotionCallback (void delegate(wdabs, wdabs) dg) {
         motionCallbacks[dg.ptr] = dg;
     }
     void removeCallbacks (void* frame) {
@@ -202,6 +203,6 @@
     char[] rendName;    // Name of renderer; for saving and creating renderers
     
     // callbacks indexed by their frame pointers:
-    bool delegate(ushort cx, ushort cy, ubyte b, bool state) [void*] clickCallbacks;
-    void delegate(ushort cx, ushort cy) [void*] motionCallbacks;
+    bool delegate(wdabs cx, wdabs cy, ubyte b, bool state) [void*] clickCallbacks;
+    void delegate(wdabs cx, wdabs cy) [void*] motionCallbacks;
 }
--- a/mde/gui/IGui.d	Sat Jun 14 13:09:03 2008 +0100
+++ b/mde/gui/IGui.d	Sat Jun 14 17:15:06 2008 +0100
@@ -13,8 +13,29 @@
 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
+/** Contains the IGui interface and some basic types used by the gui package. */
 module mde.gui.IGui;
 
+/** Window coordinate and dimension/size type (int).
+ *
+ * Used to disambiguate between general integers and coordinates; all widget positions/sizes should
+ * use this type (or one of the aliases below). */
+typedef int		wdim;
+
+/** Aliases of wdim providing extra information about what their contents hold: absolute position,
+ * position relative to the containing widget (wdrel should not be used if relative to anything
+ * else), or size. Their use instead of wdim is optional (and in some cases wdim values aren't of
+ * any of these types). Also don't use these aliases for variables which may also be used to other
+ * effects, e.g. if they can have special values with special meanings. */
+alias wdim	wdabs;
+alias wdim	wdrel;	/// ditto
+alias wdim	wdsize;	/// ditto
+
+/// A pair of wdim variables, and strictly no other data (methods may be added if deemed useful).
+struct wdimPair {
+    wdim x, y;	/// data
+}
+
 /** The Gui interface.
 *
 * This contains the functions for use by Windows, not those for external use (use Gui directly for
@@ -36,9 +57,9 @@
      * required (i.e. the event should not be handled by anything else), false otherwise.
      * Note that this is not a mechanism to prevent unwanted event handling, and in the future may
      * be removed (so event handling cannot be cut short). */
-    void addClickCallback (bool delegate (ushort cx, ushort cy, ubyte b, bool state) dg);
+    void addClickCallback (bool delegate (wdabs cx, wdabs cy, ubyte b, bool state) dg);
     /** Add a mouse motion callback: delegate will be called for all motion events recieved. */
-    void addMotionCallback (void delegate (ushort cx, ushort cy) dg);
+    void addMotionCallback (void delegate (wdabs cx, wdabs cy) dg);
     /** Remove all event callbacks with _frame pointer frame. */
     void removeCallbacks (void* frame);
 }
--- a/mde/gui/renderer/IRenderer.d	Sat Jun 14 13:09:03 2008 +0100
+++ b/mde/gui/renderer/IRenderer.d	Sat Jun 14 17:15:06 2008 +0100
@@ -16,6 +16,8 @@
 /** Interface for the renderer. This is planned to replace decoration.d */
 module mde.gui.renderer.IRenderer;
 
+public import mde.gui.IGui;	// wdim type is used by just about everything including this
+
 /** Interface for renderers.
 *
 * Renderers provide unified drawing methods for widget, e.g. to draw a window background, a frame,
@@ -29,7 +31,7 @@
     /// A container for the dimensions
     struct BorderDimensions {
         /// The dimensions: left, top, right, bottom
-        ubyte l, t, r, b;
+        wdim l, t, r, b;
         
         void opAddAssign (BorderDimensions d) {
             l += d.l;
@@ -61,23 +63,23 @@
     * Returns:
     *   RESIZE_TYPE = NONE for a move, an or'd combination of L/R/T/B for resizing.
     */
-    RESIZE_TYPE getResizeType (int cx, int cy, int w, int h);
+    RESIZE_TYPE getResizeType (wdim cx, wdim cy, wdim w, wdim h);
     
     /** Return the renderer's between-widget spacing (for layout widgets). */
-    int layoutSpacing ();
+    wdim layoutSpacing ();
     //END Get dimensions
     
     //BEGIN draw routines
     /** Draw a window border plus background. */
-    void drawWindow (int x, int y, int w, int h);
+    void drawWindow (wdim x, wdim y, wdim w, wdim h);
     
     /** Draws a widget background. Usually doesn't do anything since backgrounds are transparent. */
-    void drawWidgetBack (int x, int y, int w, int h);
+    void drawWidgetBack (wdim x, wdim y, wdim w, wdim h);
     
     /** Draws a blank widget (temporary) */
-    void drawBlank (int x, int y, int w, int h);
+    void drawBlank (wdim x, wdim y, wdim w, wdim h);
     
     /** Draws a button frame, in if pushed == true. */
-    void drawButton (int x, int y, int w, int h, bool pushed);
+    void drawButton (wdim x, wdim y, wdim w, wdim h, bool pushed);
     //END draw routines
 }
--- a/mde/gui/renderer/SimpleRenderer.d	Sat Jun 14 13:09:03 2008 +0100
+++ b/mde/gui/renderer/SimpleRenderer.d	Sat Jun 14 17:15:06 2008 +0100
@@ -43,8 +43,7 @@
             else
                 l = r = 0;
             if (hSizable) {
-                t = 2;
-                b = 6;
+                t = b = 6;
             } else
                 t = b = 0;
         }
@@ -52,7 +51,7 @@
         return border;
     }
     
-    RESIZE_TYPE getResizeType (int cx, int cy, int w, int h) {
+    RESIZE_TYPE getResizeType (wdim cx, wdim cy, wdim w, wdim h) {
         RESIZE_TYPE resizeType = RESIZE_TYPE.NONE;
         if (cx < resize.l || cx >= w - resize.r ||
             cy < resize.t || cy >= h - resize.b) { // window is being resized
@@ -75,12 +74,12 @@
         return resizeType;
     }
     
-    int layoutSpacing () {
+    wdim layoutSpacing () {
         return 4;
     }
     
     
-    void drawWindow (int x, int y, int w, int h) {
+    void drawWindow (wdim x, wdim y, wdim w, wdim h) {
         gl.setColor (0f, 0f, .7f);
         gl.drawBox (x,y, w,h);
         
@@ -91,14 +90,14 @@
         gl.drawBox (x+border.l, y+border.t, w-border.l-border.r, h-border.t-border.b);
     }
 
-    void drawWidgetBack (int x, int y, int w, int h) {}
+    void drawWidgetBack (wdim x, wdim y, wdim w, wdim h) {}
     
-    void drawBlank (int x, int y, int w, int h) {
+    void drawBlank (wdim x, wdim y, wdim w, wdim h) {
         gl.setColor (.4f, .4f, .4f);
         gl.drawBox (x,y, w,h);
     }
     
-    void drawButton (int x, int y, int w, int h, bool pushed) {
+    void drawButton (wdim x, wdim y, wdim w, wdim h, bool pushed) {
         if (pushed)
             gl.setColor (1f, 0f, 1f);
         else
--- a/mde/gui/widget/Ifaces.d	Sat Jun 14 13:09:03 2008 +0100
+++ b/mde/gui/widget/Ifaces.d	Sat Jun 14 17:15:06 2008 +0100
@@ -116,10 +116,10 @@
     
     /** Calculate the minimal size the widget could be shrunk to (or its fixed size), taking into
      * account child-widgets or other contents. */
-    void getMinimalSize (out int w, out int h);
+    void getMinimalSize (out wdim w, out wdim h);
     
     /** Get the current size of the widget. */
-    void getCurrentSize (out int w, out int h);
+    void getCurrentSize (out wdim w, out wdim h);
     
     /** Used to adjust the size.
      *
@@ -139,11 +139,11 @@
      *
      * If the actual size is needed, call getCurrentSize afterwards. setPosition must be called
      * afterwards if the widget might be a layout widget. */
-    void setWidth (int nw, int dir);
-    void setHeight (int nh, int dir);	/// ditto
+    void setWidth (wdim nw, int dir);
+    void setHeight (wdim nh, int dir);	/// ditto
     
     /** Set the current position (i.e. called on init and move). */
-    void setPosition (int x, int y);
+    void setPosition (wdim x, wdim y);
 //END Size and position
     
 //BEGIN Events
@@ -156,7 +156,7 @@
      * (x,y).
      *
      * Note: use global coordinates (x,y) not coordinates relative to the widget. */
-    IWidget getWidget (int x, int y);
+    IWidget getWidget (wdim x, wdim y);
     
     /** Receive a mouse click event.
      *
@@ -164,7 +164,7 @@
      * to the Widget's local coordinates.
      *
      * Widget may assume coordinates are on the widget (caller must check). */
-    void clickEvent (ushort cx, ushort cy, ubyte b, bool state);
+    void clickEvent (wdabs cx, wdabs cy, ubyte b, bool state);
 //END Events
     
     /** Draw, using the stored values of x and y.
--- a/mde/gui/widget/Widget.d	Sat Jun 14 13:09:03 2008 +0100
+++ b/mde/gui/widget/Widget.d	Sat Jun 14 17:15:06 2008 +0100
@@ -61,26 +61,26 @@
     bool isHSizable () {    return false;   }
     
     /* Return minimal/fixed size. */
-    void getMinimalSize (out int a, out int b) {
+    void getMinimalSize (out wdim a, out wdim b) {
         a = mw;
         b = mh;
     }
     
-    void getCurrentSize (out int cw, out int ch) {
+    void getCurrentSize (out wdim cw, out wdim ch) {
         cw = w;
         ch = h;
     }
     
     /* Set size: minimal size is (mw,mh). Note that both resizable and fixed widgets should allow
      * enlarging, so in both cases this is a correct implementation. */
-    void setWidth (int nw, int) {
+    void setWidth (wdim nw, int) {
         w = (nw >= mw ? nw : mw);
     }
-    void setHeight (int nh, int) {
+    void setHeight (wdim nh, int) {
         h = (nh >= mh ? nh : mh);
     }
     
-    void setPosition (int nx, int ny) {
+    void setPosition (wdim nx, wdim ny) {
         x = nx;
         y = ny;
     }
@@ -89,12 +89,12 @@
 //BEGIN Events
     /* This method is only called when the location is over this widget; hence for all widgets
      * without children this method is valid. */
-    IWidget getWidget (int,int) {
+    IWidget getWidget (wdim,wdim) {
         return this;
     }
     
     /* Dummy event method (suitable for all widgets which don't respond to events). */
-    void clickEvent (ushort cx, ushort cy, ubyte b, bool state) {}
+    void clickEvent (wdabs cx, wdabs cy, ubyte b, bool state) {}
 //END Events
     
     /* Basic draw method: draw the background (all widgets should do this). */
@@ -105,9 +105,9 @@
 protected:
     final int widgetType;	// the type (stored for saving)
     IWindow window;		// the enclosing window
-    int x, y;			// position
-    int w, h;			// size
-    int mw = 0, mh = 0;		// minimal or fixed size, depending on whether the widget is
+    wdim x, y;			// position
+    wdim w, h;			// size
+    wdim mw = 0, mh = 0;	// minimal or fixed size, depending on whether the widget is
     				// resizible; both types of widgets should actually be expandable.
 }
 
@@ -115,8 +115,8 @@
 class FixedWidget : Widget {
     // Check data.length is at least 3 before calling!
     this (IWindow wind, int[] data) {
-        mw = data[1];
-        mh = data[2];
+        mw = cast(wdim) data[1];
+        mh = cast(wdim) data[2];
         super (wind, data);
         w = mw;
         h = mh;
--- a/mde/gui/widget/Window.d	Sat Jun 14 13:09:03 2008 +0100
+++ b/mde/gui/widget/Window.d	Sat Jun 14 17:15:06 2008 +0100
@@ -75,7 +75,8 @@
         border = rend.setSizable (isWSizable, isHSizable);  // depends on widget
         
         // Note: this should return an empty array, but we shouldn't make a fuss if it's not empty:
-        widget.adjust (mutableData);    // adjust/set size, etc., depends on rend
+        if ((widget.adjust (mutableData)).length != 0)	// adjust/set size, etc., depends on rend
+            logger.warn ("Local widget position data is invalid!");
         mutableData = null;             // no longer needed
         
         widget.getCurrentSize (w,h);    // and get this size
@@ -107,9 +108,9 @@
             }
         } else if (tp == INT) {
             if (id == X && x == -1) {
-                x = parseTo!(int) (dt);
+                x = cast(wdim) parseTo!(int) (dt);
             } else if (id == Y && y == -1) {
-                y = parseTo!(int) (dt);
+                y = cast(wdim) parseTo!(int) (dt);
             }
         }
     }
@@ -210,30 +211,30 @@
         return widget.isHSizable;
     }
     
-    void getMinimalSize (out int wM, out int hM) {
+    void getMinimalSize (out wdim wM, out wdim hM) {
         // mw/mh are calculated by finalise();
         wM = mw;
         hM = mh;
     }
-    void getCurrentSize (out int cw, out int ch) {
+    void getCurrentSize (out wdim cw, out wdim ch) {
         cw = w;
         ch = h;
     }
     
-    void setWidth (int nw, int dir) {
+    void setWidth (wdim nw, int dir) {
         if (nw < mw) w = mw;	// clamp
         else w = nw;
         xw = x + w;
         widget.setWidth (w - border.l - border.r, dir);
     }
-    void setHeight (int nh, int dir) {
+    void setHeight (wdim nh, int dir) {
         if (nh < mh) h = mh;	// clamp
         else h = nh;
         yh = y + h;
         widget.setHeight (h - border.t - border.b, dir);
     }
     
-    void setPosition (int nx, int ny) {
+    void setPosition (wdim nx, wdim ny) {
         x = nx;
         y = ny;
         
@@ -248,7 +249,7 @@
         gui_.requestRedraw ();  // necessary whenever the window is moved; setPosition is called after resizes and moves
     }
     
-    IWidget getWidget (int cx, int cy) {
+    IWidget getWidget (wdim cx, wdim cy) {
         if (cx < x || cx >= xw || cy < y || cy >= yh)   // not over window
             return null;
         if (cx >= widgetX && cx < xw-border.r && cy >= widgetY && cy < yh-border.b)
@@ -257,7 +258,7 @@
         else                                            // over the window border
             return this;
     }
-    void clickEvent (ushort cx, ushort cy, ubyte b, bool state) {
+    void clickEvent (wdabs cx, wdabs cy, ubyte b, bool state) {
         if (b == 1 && state == true) {
             resizeType = rend.getResizeType (cx-x, cy-y, w,h);
             
@@ -300,10 +301,10 @@
     alias IRenderer.RESIZE_TYPE RESIZE_TYPE;
     
     //BEGIN Window moving and resizing
-    void moveCallback (ushort cx, ushort cy) {
+    void moveCallback (wdabs cx, wdabs cy) {
         setPosition (cx-xDrag, cy-yDrag);
     }
-    void resizeCallback (ushort cx, ushort cy) {
+    void resizeCallback (wdabs cx, wdabs cy) {
         debug scope(failure)
                 logger.trace ("resizeCallback: failure");
         
@@ -312,7 +313,7 @@
         // pointless but fairly effective.
         
         if (resizeType & RESIZE_TYPE.L) {
-            int xSize = xDrag - cx;
+            wdim xSize = xDrag - cx;
             if (xSize < mw) xSize = mw;	// clamp
             x += w - xSize;
             setWidth (xSize, 1);
@@ -321,7 +322,7 @@
             setWidth (xDrag + cx, -1);
         }
         if (resizeType & RESIZE_TYPE.T) {
-            int ySize = yDrag - cy;
+            wdim ySize = yDrag - cy;
             if (ySize < mh) ySize = mh;
             y += h - ySize;
             setHeight (ySize, 1);
@@ -334,7 +335,7 @@
         // resizing:
         setPosition (x, y);
     }
-    bool endCallback (ushort cx, ushort cy, ubyte b, bool state) {
+    bool endCallback (wdabs cx, wdabs cy, ubyte b, bool state) {
         if (b == 1 && state == false) {
             // The mouse shouldn't have moved since the motion callback
             // was last called, so there's nothing else to do now.
@@ -344,7 +345,7 @@
         }
         return false;       // we haven't handled it
     }
-    int xDrag, yDrag;               // where a drag starts relative to x and y
+    wdim xDrag, yDrag;              // where a drag starts relative to x and y
     IRenderer.RESIZE_TYPE resizeType;   // Type of current resize
     //END Window moving and resizing
     
@@ -361,11 +362,11 @@
     
     IWidget widget;                 // The primary widget in this window.
     
-    int x = -1, y = -1;             // Window position
-    int w,h;                        // Window size (calculated from Widgets)
-    int xw, yh;                     // x+w, y+h (frequent use by clickEvent)
-    int widgetX, widgetY;           // Widget position (= window position plus BORDER_WIDTH)
-    int mw = -1, mh = -1;           // minimal size (negative means requires calculation)
+    wdim x = -1, y = -1;            // Window position
+    wdsize w,h;                     // Window size (calculated from Widgets)
+    wdim xw, yh;                    // x+w, y+h (frequent use by clickEvent)
+    wdim widgetX, widgetY;          // Widget position (= window position plus BORDER_WIDTH)
+    wdim mw = -1, mh = -1;          // minimal size (negative means requires calculation)
     
     BorderDimensions border;        // Total border size (move plus resize)
 }
--- a/mde/gui/widget/layout.d	Sat Jun 14 13:09:03 2008 +0100
+++ b/mde/gui/widget/layout.d	Sat Jun 14 17:15:06 2008 +0100
@@ -83,8 +83,8 @@
             row.dupMin;
         } else {                            // sufficient data
             lenUsed = rows+cols;
-            col.setCheck (data[0..cols]);
-            row.setCheck (data[cols..lenUsed]);
+            col.setCheck (cast(wdim[])data[0..cols]);
+            row.setCheck (cast(wdim[])data[cols..lenUsed]);
         }
         
         
@@ -119,8 +119,7 @@
         foreach (widget; subWidgets)
             ret ~= widget.getMutableData;
         
-        ret ~= col.width ~ row.width;
-        return ret;
+        return ret ~ cast(int[])col.width ~ cast(int[])row.width;
     }
     //END Creation & saving
     
@@ -133,19 +132,19 @@
     }
     
     /* Calculates the minimal size from all rows and columns of widgets. */
-    void getMinimalSize (out int mw, out int mh) {
+    void getMinimalSize (out wdim mw, out wdim mh) {
         mw = this.mw;
         mh = this.mh;
     }
     
-    void setWidth (int nw, int dir) {
+    void setWidth (wdim nw, int dir) {
         if (nw == w) return;
         
         w += col.adjustCellSizes (nw - w, (dir == -1 ? col.lastSizable : col.firstSizable), dir);
         
         // Note: setPosition must be called after!
     }
-    void setHeight (int nh, int dir) {
+    void setHeight (wdim nh, int dir) {
         if (nh == h) return;
         
         h += row.adjustCellSizes (nh - h, (dir == -1 ? row.lastSizable : row.firstSizable), dir);
@@ -153,7 +152,7 @@
         // Note: setPosition must be called after!
     }
     
-    void setPosition (int x, int y) {
+    void setPosition (wdim x, wdim y) {
         this.x = x;
         this.y = y;
         
@@ -164,7 +163,7 @@
     
     
     // Find the relevant widget.
-    IWidget getWidget (int cx, int cy) {
+    IWidget getWidget (wdim cx, wdim cy) {
         debug scope (failure)
                 logger.warn ("getWidget: failure");
         // Find row/column:
@@ -178,7 +177,7 @@
     }
     
     // Resizing columns & rows
-    void clickEvent (ushort cx, ushort cy, ubyte b, bool state) {
+    void clickEvent (wdabs cx, wdabs cy, ubyte b, bool state) {
         debug scope (failure)
                 logger.warn ("clickEvent: failure");
         if (b == 1 && state == true) {
@@ -216,9 +215,9 @@
         
         // Calculate the minimal column and row sizes:
         // set length, making sure the arrays are initialised to zero:
-        col.minWidth = new int[cols];
-        row.minWidth = new int[rows];
-        int ww, wh;     // sub-widget minimal sizes
+        col.minWidth = new wdim[cols];
+        row.minWidth = new wdim[rows];
+        wdim ww, wh;     // sub-widget minimal sizes
         foreach (i,widget; subWidgets) {
             widget.getMinimalSize (ww, wh);
             
@@ -232,8 +231,8 @@
         
         // Calculate the overall minimal size, starting with the spacing:
         mh = window.renderer.layoutSpacing;	// use mh temporarily
-        mw = mh * (cols - 1);
-        mh *= (rows - 1);
+        mw = mh * cast(wdim)(cols - 1);
+        mh *= cast(wdim)(rows - 1);
         
         foreach (x; col.minWidth)		// add the column/row's dimensions
             mw += x;
@@ -275,12 +274,12 @@
     //END Cache calculation functions
     
     
-    void setColWidth (myIt i, int w, int dir) {
+    void setColWidth (myIt i, wdim w, int dir) {
         for (myIt j = 0; j < rows; ++j) {
             subWidgets[i + cols*j].setWidth (w, dir);
         }
     }
-    void setRowHeight (myIt j, int h, int dir) {
+    void setRowHeight (myIt j, wdim h, int dir) {
         for (myIt i = 0; i < cols; ++i) {
             subWidgets[i + cols*j].setHeight (h, dir);
         }
@@ -288,7 +287,7 @@
     
     
     //BEGIN Col/row resizing callback
-    void resizeCallback (ushort cx, ushort cy) {
+    void resizeCallback (wdim cx, wdim cy) {
         col.resize (cx - dragX);
         row.resize (cy - dragY);
         
@@ -301,7 +300,7 @@
                                 y + row.pos[i / cols]);
         window.requestRedraw;
     }
-    bool endCallback (ushort cx, ushort cy, ubyte b, bool state) {
+    bool endCallback (wdabs cx, wdabs cy, ubyte b, bool state) {
         if (b == 1 && state == false) {
             window.gui.removeCallbacks (cast(void*) this);
             return true;	// we've handled the up-click
@@ -311,7 +310,7 @@
     
 protected:
     // Data for resizing cols/rows:
-    int dragX, dragY;	// coords where drag starts
+    wdim dragX, dragY;	// coords where drag starts
     //END Col/row resizing callback
     
     
@@ -328,7 +327,7 @@
      *
      * Most notation corresponds to horizontal layout (columns), simply for easy of naming. */
     struct CellDimensions {
-        int[] pos,	// relative position (cumulative width[i-1] plus spacing)
+        wdim[] pos,	// relative position (cumulative width[i-1] plus spacing)
               width,	// current widths
               minWidth;	// minimal widths (set by genCachedConstructionData)
         bool[] sizable;	// true if col is resizable (set by genCachedConstructionData)
@@ -336,16 +335,16 @@
                lastSizable;	// as above, but last (set by genCachedConstructionData)
         myDiff resizeD,	// resize down from this index (<0 if not resizing)
                resizeU;	// and up from this index
-        int spacing;	// used by genPositions (which cannot access the layout class's data)
+        wdim spacing;	// used by genPositions (which cannot access the layout class's data)
         /* This is a delegate to a enclosing class's function, since:
          * a different implementation is needed for cols or rows
          * we're unable to access enclosing class members directly */
-        void delegate (myIt,int,int) setColWidth;	// set width of a column, with resize direction
+        void delegate (myIt,wdim,int) setColWidth;	// set width of a column, with resize direction
         
         void dupMin () {
             width = minWidth.dup;
         }
-        void setCheck (int[] data) {
+        void setCheck (wdim[] data) {
             // Set to provided data:
             width = data;
             // And check sizes are valid:
@@ -356,10 +355,10 @@
         }
         
         // Generate position infomation and return total width (i.e. widget width/height)
-        int genPositions () {
+        wdim genPositions () {
             pos.length = minWidth.length;
             
-            int x = 0;
+            wdim x = 0;
             foreach (i, w; width) {
                 pos[i] = x;
                 x += w + spacing;
@@ -369,7 +368,7 @@
         
         // Get the row/column a click occured in
         // Returns -i if in space to left of col i, or i if on col i
-        myDiff getCell (int l) {
+        myDiff getCell (wdim l) {
             myDiff i = minWidth.length - 1;	// starting from right...
             while (l < pos[i]) {		// decrement while left of this column
                 debug assert (i > 0, "getCell: l < pos[0] (code error)");
@@ -381,7 +380,7 @@
         }
         
         // Calculate resizeU/resizeD, and return true if unable to resize.
-        bool findResize (int l) {
+        bool findResize (wdim l) {
             resizeU = -getCell (l);		// potential start for upward-resizes
             if (resizeU <= 0) return true;	// not on a space between cells
             resizeD = resizeU - 1;		// potential start for downward-resizes
@@ -418,7 +417,7 @@
         * Note: Check variable used for start is valid before calling! If a non-sizable column's
         *  index is passed, this should get increased (if diff > 0) but not decreased.
         */
-        int adjustCellSizes (int diff, myDiff start, int incr)
+        wdim adjustCellSizes (wdim diff, myDiff start, int incr)
         in {
             // Could occur if adjust isn't called first, but this would be a code error:
             assert (width !is null, "adjustCellSizes: width is null");
@@ -435,7 +434,7 @@
                 setColWidth (i, width[i], incr);
             }
             else if (diff < 0) {	// decrease
-                int rd = diff;		// running diff
+                wdim rd = diff;		// running diff
                 aCSwhile:
                 while (true) {
                     width[i] += rd;	// decrease this cell's size (but may be too much)
@@ -468,7 +467,7 @@
             return diff;
         }
         
-        void resize (int diff) {
+        void resize (wdim diff) {
             if (resizeU <= 0) return;
             
             // do shrinking first (in case we hit the minimum)
@@ -484,7 +483,7 @@
     CellDimensions col, row;
     
     // Index types. Note that in some cases they need to hold negative values.
-    // Int is used for resizing direction (although ptrdiff_t would be more appropriate),
+    // int is used for resizing direction (although ptrdiff_t would be more appropriate),
     // since the value must always be -1 or +1 and int is smaller on X86_64.
     alias size_t myIt;
     alias ptrdiff_t myDiff;
--- a/mde/gui/widget/miscWidgets.d	Sat Jun 14 13:09:03 2008 +0100
+++ b/mde/gui/widget/miscWidgets.d	Sat Jun 14 17:15:06 2008 +0100
@@ -71,7 +71,7 @@
         window.renderer.drawButton (x,y, w,h, pushed);
     }
     
-    void clickEvent (ushort, ushort, ubyte b, bool state) {
+    void clickEvent (wdabs, wdabs, ubyte b, bool state) {
         if (b == 1 && state == true) {
             pushed = true;
             window.requestRedraw;
@@ -80,7 +80,7 @@
         }
     }
     // Called when a mouse motion/click event occurs while (held == true)
-    bool clickWhileHeld (ushort cx, ushort cy, ubyte b, bool state) {
+    bool clickWhileHeld (wdabs cx, wdabs cy, ubyte b, bool state) {
         if (b == 1 && state == false) {
             if (cx >= x && cx < x+w && cy >= y && cy < y+h) // button event
                 Stdout ("Button clicked!").newline;
@@ -93,7 +93,7 @@
         }
         return false;
     }
-    void motionWhileHeld (ushort cx, ushort cy) {
+    void motionWhileHeld (wdabs cx, wdabs cy) {
         bool oldPushed = pushed;
         if (cx >= x && cx < x+w && cy >= y && cy < y+h) pushed = true;
         else pushed = false;
@@ -109,8 +109,8 @@
         if (data.length != 2) throw new WidgetDataException;
         if (font is null) font = FontStyle.get("default");
         font.updateBlock (str, textCache);
-        mw = textCache.w;
-        mh = textCache.h;
+        mw = cast(wdim) textCache.w;
+        mh = cast(wdim) textCache.h;
         colour = Colour (cast(ubyte) (data[1] >> 16u),
                          cast(ubyte) (data[1] >> 8u),
                          cast(ubyte) data[1] );