Mercurial > projects > dwt-linux
view doc/doc-callbacks.txt @ 264:bfafc891369e
Fix: compile error
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 06 Jul 2008 15:34:08 +0200 |
parents | 3a7f56c31c6c |
children |
line wrap: on
line source
Callbacks gtk-Java and gtk-D ============================ SWT uses a Mechanism to make callback possible from C -> Java. This mechanism is implemented in swt/internal/Callback.java and the C libs. It can convert a delegate call into a simple function pointer. This works by generating a whole lot of function wrappers. All with int argument types, varying in argument count. The Callback class implements a registry for the available functions and redirect the C call to Java using reflection. In the D port, dwt.widgets.Display has the struct CallbackData. It wraps the instance pointer to the display instance. If a callback uses other userdata, it is wrapped also into the struct. Caution by g_signal_handlers_[un]block_matches: In Java sometime integer constants are passed to select a callback for enabling/disabling. In D, the Widget class has getter function to get a pointer to the CallbackData that was used instead of the integer when registering the callback.