diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2011-01-25 19:54:09 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2011-01-25 19:54:09 +0000 |
| commit | 7b832a512e9bc39e39802cfc81ac7de7d32017a4 (patch) | |
| tree | addee229f5f20b30bac288ab29c61bc415ace5e7 /FL | |
| parent | ece27e347c12b05feb8aa74ea809120b6f2f2519 (diff) | |
Added Fl::event_dispatch() which can add a function to FLTK that monitors all events before they reach Fl::handle(). STR 2532
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8314 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'FL')
| -rw-r--r-- | FL/Fl.H | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -104,6 +104,9 @@ typedef void (*Fl_Atclose_Handler)(Fl_Window *window, void *data); /** signature of args functions passed as parameters */ typedef int (*Fl_Args_Handler)(int argc, char **argv, int &i); +/** signature of event_dispatch functions passed as parameters */ +typedef int (*Fl_Event_Dispatch)(int event, Fl_Window *w); + /** @} */ /* group callback_functions */ @@ -129,6 +132,7 @@ public: // should be private! static int e_keysym; static char* e_text; static int e_length; + static Fl_Event_Dispatch e_dispatch; static Fl_Widget* belowmouse_; static Fl_Widget* pushed_; static Fl_Widget* focus_; @@ -696,6 +700,14 @@ public: static void focus(Fl_Widget*); static void add_handler(Fl_Event_Handler h); static void remove_handler(Fl_Event_Handler h); + /** Set a new event dispatch function. + The event dispatch function is called after native events are converted to + FLTK events, but before they are handled by FLTK. If the dispatch function + returns a value other than 0, FLTK will not handle the event any further. + \param d new dispatch function, can be NULL */ + static void event_dispatch(Fl_Event_Dispatch d) { e_dispatch = d; } + /** Return the current event dispatch function. */ + static Fl_Event_Dispatch event_dispatch() { return e_dispatch; } /** @} */ /** \defgroup fl_clipboard Selection & Clipboard functions |
