Kvaz1r is correct, all you need is a simple std::function<void()> to store the callback function.
Without adding extra code around it, you can only store free functions that have no arguments, but even in complex cases std::function<void()> is what you store it in eventually (unless you e.g. always have the widget as argument in which case you put that type between the brackets). If you strip away all the complex signal handling code in TGUI then you find a simple map that stores all the callback functions and their unique id.
std::map<unsigned int, std::function<void()>> m_handlers;