summaryrefslogtreecommitdiff
path: root/src/Fl_add_idle.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Fl_add_idle.cxx')
-rw-r--r--src/Fl_add_idle.cxx19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Fl_add_idle.cxx b/src/Fl_add_idle.cxx
index 1afc4e987..6d5e4b038 100644
--- a/src/Fl_add_idle.cxx
+++ b/src/Fl_add_idle.cxx
@@ -49,6 +49,23 @@ static void call_idle() {
p->cb(p->data); // this may call add_idle() or remove_idle()!
}
+/**
+ Adds a callback function that is called every time by
+ Fl::wait() and also makes it act as though the timeout is
+ zero (this makes Fl::wait() return immediately, so if it is
+ in a loop it is called repeatedly, and thus the idle fucntion is
+ called repeatedly). The idle function can be used to get background
+ processing done.
+
+ <P>You can have multiple idle callbacks. To remove an idle callback use Fl::remove_idle().
+
+ <P>Fl::wait() and Fl::check() call idle callbacks,
+ but Fl::ready() does not.
+
+ <P>The idle callback can call any FLTK functions, including
+ Fl::wait(), Fl::check(), and Fl::ready().
+ FLTK will not recursively call the idle callback.
+*/
void Fl::add_idle(void (*cb)(void*), void* data) {
idle_cb* p = freelist;
if (p) freelist = p->next;
@@ -66,6 +83,7 @@ void Fl::add_idle(void (*cb)(void*), void* data) {
}
}
+/** Returns true if the specified idle callback is currently installed. */
int Fl::has_idle(void (*cb)(void*), void* data) {
idle_cb* p = first;
if (!p) return 0;
@@ -75,6 +93,7 @@ int Fl::has_idle(void (*cb)(void*), void* data) {
}
}
+/** Removes the specified idle callback, if it is installed. */
void Fl::remove_idle(void (*cb)(void*), void* data) {
idle_cb* p = first;
if (!p) return;