You're pretty close. The quick fix is to make sure your callback takes a pointer and you pass this
:
bool (*callback)(Opencv_Button*, void*);
void setCallback(bool(*)(Opencv_Button*, void*), void*);
And call with:
callback(this, callback_param);
However, you'd likely be better off using references. You can have your function take a reference to Opencv_Button
:
bool (*callback)(Opencv_Button&, void*);
void setCallback(bool(*)(Opencv_Button&, void*), void*);
Then call it with:
callback(*this, callback_param);
And your buttonCallback
will look like this:
bool buttonCallback(Opencv_Button& but, void* param) {
but.val("I was clicked!!!");
}