That'd be a function pointer to your /static/ method.
The typical pattern is:
class MyClass .. {
// NORMAL CALLBACK METHOD
void Button_CB2(Fl_Widget *w) {
..your code here can access other members/methods of the class..
}
// STATIC CALLBACK METHOD
static void Button_CB(Fl_Widget *w, void *data) {
MyClass *o = (MyClass*)data;
o->Button_CB2(w);
}
public:
MyClass(..) {
Fl_Button *b = new Fl_Button(..);
b->callback(Button_CB, (void*)this);
}
};
This seemingly redundant pattern of calling a method that calls
a method
is actually necessary because we need to help C++ get the
context of the class
when no context exists. Note in the
callback()
setup code, we pass both the pointer
to the /
static/
callback method and a pointer to the class.
The static method then
is able to put the two together and invoke the real
(non static) member function
so that it has the class instance context setup, so that it can
access the members
and methods of that class instance.
If that doesn't make sense, just do it anyway ;) Just know that
there is a difference
between static and non-static methods; read up on their
differences in a good C++ book.
Since you're probably new to FLTK, I suggest going to this
fltk videos
page
and watching the "
Beginners
Guide To Programming FLTK", and the
"
Introduction
To Using Fluid" after that.
Those two videos cover callbacks, static members, and will
introduce
other things you may encounter as you ramp up with FLTK. They're
a bit
old, but still relevant.