Documentation |
Programming Guide (ver 0.0.2)FC++ (FLTKCallback++) only extends current fltk callback system. FC++ adds possibility to use any function or member function as fltk callback. Limitation is that this functions can have maximum 2 arguments. Default fltk callbacks (back compatibility)FC++ is backcompatible with default fltk callbacks. So it is still possible to use "normal" callbacks and your current (old) code will compile without problems. void fltk_cllback(Fl_Widget *w, void *p); ... some_widget->callback(fltk_callback); Functions as callbacksWith FC++ you can set any function as callback. This means that following functions can be callbacks: int func_e1(void); float func_e2(int e); string func_e3(vector<int> first, int i); void func_e4(float sime); To set this functions as callbacks you must do: some_widget->callback(&func_e1); some_widget->callback(&func_e2, 3); ... vector You do not have to assign argument values but then default type values will be used. If that type has no default constructor then compile time error will occur. some_widget->callback(&func_e1); some_widget->callback(&func_e2); some_widget->callback(&func_e3); some_widget->callback(&func_e4); Member functions as callbacksWith FC++ you can set any member function as callback. This means that following member functions can be callbacks: class func_class{ public: int func_e1(void); float func_e2(int e); string func_e3(vector<int> first, int i); void func_e4(float sime); }; To set this member functions as callbacks you must do: func_class fc; ... some_widget->callback(&fc, &fc::func_e1); some_widget->callback(&fc, &fc::func_e2, 3); ... vector You do not have to assign argument values but then default type values will be used. If that type has no default constructor then compile time error will occur. some_widget->callback(&fc, &fc::func_e1); some_widget->callback(&fc, &fc::func_e2); some_widget->callback(&fc, &fc::func_e3); some_widget->callback(&fc, &fc::func_e4); |