summaryrefslogtreecommitdiff
path: root/src/Fl_add_idle.cxx
diff options
context:
space:
mode:
authorFabien Costantini <fabien@onepost.net>2008-09-13 22:33:03 +0000
committerFabien Costantini <fabien@onepost.net>2008-09-13 22:33:03 +0000
commit9bf19e2329a51f68b2f6b9c2d65db87ab3698f76 (patch)
tree4949368ed1aa08e8a6ecda0958788081a97f1a96 /src/Fl_add_idle.cxx
parent4159c97e420fd9cd66024a9b71aa5d143cc1b2db (diff)
WP1 merged from my branch, WP2 reserved, todo list updated.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6231 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
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;