view mde/util.d @ 119:d28aea50c6da

Basic edit cursor placement using the mouse. Moved textContent.d's contents into TextWidget.d.
author Diggory Hardy <diggory.hardy@gmail.com>
date Thu, 01 Jan 2009 14:52:09 +0000
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;
}