diff mde/util.d @ 95:2a364c7d82c9

Boolean options can be adjusted from the gui now (using a very basic widget). Also some bug-fixes. Fixed a minor bug where layouts with the same id but without shared alignments would be messed up. Tracked down the "nothing trawn until a resize" bug (see jobs.txt). If widgets throw during creation they're now replaced by debug widgets. Function pointers are converted to delegates using a safer method.
author Diggory Hardy <diggory.hardy@gmail.com>
date Thu, 06 Nov 2008 11:07:18 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mde/util.d	Thu Nov 06 11:07:18 2008 +0000
@@ -0,0 +1,15 @@
+module mde.util;
+
+/// Not my code: http://www.dsource.org/projects/tango/ticket/1174#comment:7
+R delegate(T) toDg(R, T...)(R function(T) fp) {
+    if (!fp) return null;
+    struct dg {
+        R opCall(T t) {
+            return (cast(R function(T)) this) (t);
+        }
+    }
+    R delegate(T) t;
+    t.ptr = fp;
+    t.funcptr = &dg.opCall;
+    return t;
+}