view mde/util.d @ 160:ccd01fde535e

Replaced WidgetManager's click and motion callbacks with a drag event system. This is less flexible, but much closer to what is required (and is simpler and less open to bugs through unintended use).
author Diggory Hardy <diggory.hardy@gmail.com>
date Thu, 21 May 2009 22:15:32 +0200
parents 2a364c7d82c9
children
line wrap: on
line source

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;
}