I am working on an OpenGL menu that contains several buttons. I want to be able to associate an action (a member function (with a fixed signature) of any class!) With a button that starts when the button is clicked. I can do it right now, but only for one type. I want to be able to use any member function of any class for my callback.
Now I am doing this:
#define BUTTONCALLBACK(Func) bind1st( mem_fun( &ClassICanSupport::Func ), this )
Then I can create a button like this:
Button* b = new Button("Bla", BUTTONCALLBACK(functionIWanttoCall));
The callback function has the following signature:
void callback(Button* source);
When I press the button, I can execute the callback function that I passed.
boost:: bind, . , Object, void *, typeid, . , ( ) .
?