cgvis the IT thing

FLTK Signal Connector Enhancement

Posted on July 9, 2008

For those who don't like FLTK2 signal connecting like me I wrote a simple header file; where you can change code like

button->callback (fltk_callback, this);

static void fltk_callback (fltk::Widget *, void * data){

((YourClass*) data)->executeFunction();

}

to code like:

bind (button, &YourClass::execute_function);

It's only important that you derive your class from

commandable<YourClass>

Note, you won't have any use for this, when already using a real sigslot libary. If you want, you can also add parameters to your functions which are automatically passed. Currently only one is supported, but the source is easy to extend.

You can download here: commandable.h (public domain)

Filed under: Programming No Comments