| 1 | #ifndef _GLOBALS_H |
| 2 | #define _GLOBALS_H |
| 3 | |
| 4 | // Try to consolidate OS-specific ifdef complicated clauses to this |
| 5 | // header file, so code can use descriptive ifdefs |
| 6 | #if defined(__WIN32) && ! defined(__CYGWIN__) |
| 7 | #define OS_LIKE_WIN32 |
| 8 | #endif |
| 9 | |
| 10 | #if defined(__linux) || defined(unix) |
| 11 | #define OS_LIKE_UNIX |
| 12 | #endif |
| 13 | |
| 14 | |
| 15 | // We use a class static method for callbacks which cast their "void * data" |
| 16 | // argument to an instance of the class, and call the class method. |
| 17 | // So we use these macros to enforce consistent usage of that technique. |
| 18 | // Most places will use CALL_BACK. The CALL_BACK_A is only needed in code |
| 19 | // when the object method takes an argument. |
| 20 | // Can't use CALLBACK as single word since under mingw that is already |
| 21 | // defined as something completely different. |
| 22 | #define CALL_BACK_A(classname, cb_name, arg) \ |
| 23 | void \ |
| 24 | classname::cb_name##_cb(Fl_Widget *, void * data) \ |
| 25 | { \ |
| 26 | ((classname *)data)->cb_name(); \ |
| 27 | } \ |
| 28 | void \ |
| 29 | classname::cb_name(arg) |
| 30 | #define CALL_BACK(classname, cb_name) CALL_BACK_A(classname, cb_name, void) |
| 31 | |
| 32 | #endif |