summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/Fl.H57
-rw-r--r--src/Fl.cxx4
2 files changed, 41 insertions, 20 deletions
diff --git a/FL/Fl.H b/FL/Fl.H
index 7cb9b94a5..8b9a5883e 100644
--- a/FL/Fl.H
+++ b/FL/Fl.H
@@ -53,19 +53,40 @@ class Fl_Image;
struct Fl_Label;
/** signature of some label drawing functions passed as parameters */
-typedef void (Fl_Label_Draw_F)(const Fl_Label*, int,int,int,int, Fl_Align);
+typedef void (Fl_Label_Draw_F)(const Fl_Label *label, int x, int y, int w, int h, Fl_Align align);
/** signature of some label measurement functions passed as parameters */
-typedef void (Fl_Label_Measure_F)(const Fl_Label*, int&, int&);
+typedef void (Fl_Label_Measure_F)(const Fl_Label *label, int &width, int &height);
/** signature of some box drawing functions passed as parameters */
-typedef void (Fl_Box_Draw_F)(int,int,int,int, Fl_Color);
+typedef void (Fl_Box_Draw_F)(int x, int y, int w, int h, Fl_Color color);
/** signature of some timeout callback functions passed as parameters */
-typedef void (*Fl_Timeout_Handler)(void*);
+typedef void (*Fl_Timeout_Handler)(void *data);
/** signature of some wakeup callback functions passed as parameters */
-typedef void (*Fl_Awake_Handler)(void*);
+typedef void (*Fl_Awake_Handler)(void *data);
+
+/** signature of add_idle callback functions passed as parameters */
+typedef void (*Fl_Idle_Handler)(void *data);
+
+/** signature of set_idle callback functions passed as parameters */
+typedef void (*Fl_Old_Idle_Handler)();
+
+/** signature of add_fd functions passed as parameters */
+typedef void (*Fl_FD_Handler)(int fd, void *data);
+
+/** signature of add_handler functions passed as parameters */
+typedef int (*Fl_Event_Handler)(int event);
+
+/** signature of set_abort functions passed as parameters */
+typedef void (*Fl_Abort_Handler)(const char *format,...);
+
+/** signature of set_atclose functions passed as parameters */
+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);
/**
The Fl is the FLTK global (static) containing
@@ -138,7 +159,7 @@ public:
// argument parsers:
static int arg(int, char**, int&);
- static int args(int, char**, int&, int (*)(int,char**,int&) = 0);
+ static int args(int, char**, int&, Fl_Args_Handler ah = 0);
static void args(int, char**);
/**
Usage string displayed if Fl::args() detects an invalid argument.
@@ -232,7 +253,7 @@ public:
}
\endcode
*/
- static void repeat_timeout(double t, Fl_Timeout_Handler,void* = 0); // platform dependent
+ static void repeat_timeout(double t, Fl_Timeout_Handler, void* = 0); // platform dependent
static int has_timeout(Fl_Timeout_Handler, void* = 0);
static void remove_timeout(Fl_Timeout_Handler, void* = 0);
static void add_check(Fl_Timeout_Handler, void* = 0);
@@ -257,17 +278,17 @@ public:
devices, pipes, sockets, etc.). Due to limitations in Microsoft Windows,
WIN32 applications can only monitor sockets.
*/
- static void add_fd(int fd, int when, void (*cb)(int,void*),void* =0); // platform dependent
- /** See void add_fd(int fd, int when, void (*cb)(int,void*),void* =0) */
- static void add_fd(int fd, void (*cb)(int, void*), void* = 0); // platform dependent
+ static void add_fd(int fd, int when, Fl_FD_Handler cb, void* = 0); // platform dependent
+ /** See void add_fd(int fd, int when, Fl_FD_Handler cb, void* = 0) */
+ static void add_fd(int fd, Fl_FD_Handler cb, void* = 0); // platform dependent
/** Removes a file descriptor handler. */
static void remove_fd(int, int when); // platform dependent
/** Removes a file descriptor handler. */
static void remove_fd(int); // platform dependent
- static void add_idle(void (*cb)(void*), void* data = 0);
- static int has_idle(void (*cb)(void*), void* data = 0);
- static void remove_idle(void (*cb)(void*), void* data = 0);
+ static void add_idle(Fl_Idle_Handler cb, void* data = 0);
+ static int has_idle(Fl_Idle_Handler cb, void* data = 0);
+ static void remove_idle(Fl_Idle_Handler cb, void* data = 0);
/** If true then flush() will do something. */
static int damage() {return damage_;}
static void redraw();
@@ -603,8 +624,8 @@ public:
/** Gets the current Fl::focus() widget. \sa Fl::focus(Fl_Widget*) */
static Fl_Widget* focus() {return focus_;}
static void focus(Fl_Widget*);
- static void add_handler(int (*h)(int));
- static void remove_handler(int (*h)(int));
+ static void add_handler(Fl_Event_Handler h);
+ static void remove_handler(Fl_Event_Handler h);
/** @} */
/** \defgroup fl_clipboard Selection & Clipboard functions
@@ -764,13 +785,13 @@ public:
/** \addtogroup fl_windows
@{ */
/** For back compatibility, sets the void Fl::fatal handler callback */
- static void set_abort(void (*f)(const char*,...)) {fatal = f;}
+ static void set_abort(Fl_Abort_Handler f) {fatal = f;}
static void (*atclose)(Fl_Window*,void*);
static void default_atclose(Fl_Window*,void*);
/** For back compatibility, sets the Fl::atclose handler callback. You
can now simply change the callback for the window instead.
\see Fl_Window::callback(Fl_Callback*) */
- static void set_atclose(void (*f)(Fl_Window*,void*)) {atclose = f;}
+ static void set_atclose(Fl_Atclose_Handler f) {atclose = f;}
/** @} */
/** \addtogroup fl_events
@@ -814,7 +835,7 @@ public:
\deprecated This method is obsolete - use the add_idle() method instead.
*/
- static void set_idle(void (*cb)()) {idle = cb;}
+ static void set_idle(Fl_Old_Idle_Handler cb) {idle = cb;}
/** See Fl_Window* grab() */
static void grab(Fl_Window&win) {grab(&win);}
/** Releases the current grabbed window, equals grab(0).
diff --git a/src/Fl.cxx b/src/Fl.cxx
index fce36c8b4..e829b52f7 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -716,7 +716,7 @@ static handler_link *handlers = 0;
zero from its handle() method. Exactly which ones may change
in future versions, however.
*/
-void Fl::add_handler(int (*ha)(int)) {
+void Fl::add_handler(Fl_Event_Handler ha) {
handler_link *l = new handler_link;
l->handle = ha;
l->next = handlers;
@@ -726,7 +726,7 @@ void Fl::add_handler(int (*ha)(int)) {
/**
Removes a previously added event handler.
*/
-void Fl::remove_handler(int (*ha)(int)) {
+void Fl::remove_handler(Fl_Event_Handler ha) {
handler_link *l, *p;
// Search for the handler in the list...