Few thoughts, ping Bobef/Frank
Bjoern
nanali at nospam-wanadoo.fr
Sun Mar 9 03:32:39 PDT 2008
Frank Benoit schrieb:
> Yes i think you are right,
> i was trying to get around that for some time :)
>
> Can we make use of tango.core.Signal here ?
I think it is doable.
A win specific snippet follows, hopefully good enough as example.
Bobef :
Signals & Slots are a means of broadcasting an event to multiple listeners.
( So I wonder : does it really make sense ? )
snippet :
import tango.core.Signal;
struct MultiDispatch(Key)
{
alias void delegate() Dg;
void attach( Key k, Dg dg )
{
m_map[k] = dg;
}
void opCall( Key k )
{
auto dg = k in m_map;
if( dg !is null )
(*dg)();
}
private:
Dg[Key] m_map;
}
class MyClass
{
void onClose()
{
}
MultiDispatch!(int) signal;
this()
{
signal.attach( WM_CLOSE, &onClose );
}
}
...
auto c = new MyClass;
c.signal( WM_CLOSE );
The forum thread at :
http://www.dsource.org/projects/tango/forums/topic/221
Frank :
Bobef's HTMLayout implementation/wrapper is similar to Eclipse forms.
(More flexible, but unfortunately Win only.)
HTH Bjoern
More information about the Digitalmars-d-dwt
mailing list