summaryrefslogtreecommitdiff
path: root/otk_c/timer.h
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2002-12-21 19:54:15 +0000
committerDana Jansens <danakj@orodu.net>2002-12-21 19:54:15 +0000
commit065c6efa774ac144665f340f6c3578ab74e05c7b (patch)
tree80e8d61f5d14db5cf7f66fbe58cfcc126e052751 /otk_c/timer.h
parent4c9bf6c9a1f2fb3531cec2917576f3d2364b4bf3 (diff)
otktimer works. imagecontrol is underway!
Diffstat (limited to 'otk_c/timer.h')
-rw-r--r--otk_c/timer.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/otk_c/timer.h b/otk_c/timer.h
new file mode 100644
index 00000000..8e5399ec
--- /dev/null
+++ b/otk_c/timer.h
@@ -0,0 +1,52 @@
+// -*- mode: C; indent-tabs-mode: nil; c-basic-offset: 2; -*-
+#ifndef __timer_h
+#define __timer_h
+
+#include <X11/Xlib.h>
+#include <Python.h>
+
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else // !TIME_WITH_SYS_TIME
+# ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else // !HAVE_SYS_TIME_H
+# include <time.h>
+# endif // HAVE_SYS_TIME_H
+#endif // TIME_WITH_SYS_TIME
+
+extern PyTypeObject OtkTimer_Type;
+
+//! The data passed to the OtkTimeoutHandler function.
+/*!
+ Note: this is a very useful place to put an object instance, and set the
+ event handler to a static function in the same class.
+*/
+typedef void *OtkTimeoutData;
+//! The type of function which can be set as the callback for an OtkTimer
+//! firing
+typedef void (*OtkTimeoutHandler)(OtkTimeoutData);
+
+typedef struct OtkTimer {
+ PyObject_HEAD
+ OtkTimeoutHandler handler;
+ OtkTimeoutData data;
+ Bool recur;
+ long timeout;
+
+ // don't edit these
+ Bool timing;
+ struct timeval start;
+ struct timeval end;
+} OtkTimer;
+
+PyObject *OtkTimer_New(OtkTimeoutHandler handler, OtkTimeoutData data);
+
+//! Causes the timer to begin
+void OtkTimer_Start(OtkTimer *self);
+
+//! Causes the timer to stop
+void OtkTimer_Stop(OtkTimer *self);
+
+#endif // __timer_h