| [ Return to Bugs & Features | Post Text | Post File | Prev | Next ]
STR #214
Application: | FLTK Library |
Status: | 4 - Pending |
Priority: | 1 - Request for Enhancement, e.g. asking for a feature |
Scope: | 3 - Applies to all machines and operating systems |
Subsystem: | Core Library |
Summary: | function objects for callbacks. |
Version: | 1.4-feature |
Created By: | rainer.koecher.ok-automation |
Assigned To: | matt |
Fix Version: | Unassigned |
Update Notification: | |
Trouble Report Files:
[ Post File ]No files
Trouble Report Comments:
[ Post Text ]
|
#1 | rainer.koecher.ok-automation 01:53 Nov 19, 2003 |
| hello,
I did a little work for testing with fltk. The toolkit looks very professional. But I'm missing one feature: I'd like to use function objects for callbacks instead of static member functions of classes. I think if you want to implement a object oriented system it's not good to have static member functions.
Here is a little example of what i'm meaning.
now callbacks work in that way: class Example{ void callback_function_i(FL_Button *bt, void *v) { // do something useful. }
//v would be a pointer to "this" static void callback_function(FL_Button *bt, void *v) { v->callback_function_i(bt, v); } public: Example(){ //initialize the Window } }
i wold like to do this in that way: class callback{ public: void operator()(Fl_Button *bt, void *v) { // do something useful. } }
class Example{ //define a callback object which operator() will be called. callback button_callback; public: Example(){ //initialize the Window } } | |
|
#2 | mike 21:16 Mar 10, 2004 |
| There are some enhancements along these lines available on the bazaar/links page. Currently they require "advanced" C++ features which are not universally available, but they may be added in the future. | |
|
#3 | matt 14:50 Apr 22, 2008 |
| This STR stands as a reminder for signaling and member callbacks | |
|
#4 | matt 16:40 Jan 14, 2023 |
| This can not be solved as long as we insist on C++98. C++11 introduces lambdas with captures that solve this very easily. | |
[ Return to Bugs & Features | Post Text | Post File ]
|
| |