| 1 | // ================================================================ // |
|---|
| 2 | // // |
|---|
| 3 | // File : arb_handlers.h // |
|---|
| 4 | // Purpose : // |
|---|
| 5 | // // |
|---|
| 6 | // Coded by Ralf Westram (coder@reallysoft.de) in November 2010 // |
|---|
| 7 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 8 | // http://www.arb-home.de/ // |
|---|
| 9 | // // |
|---|
| 10 | // ================================================================ // |
|---|
| 11 | |
|---|
| 12 | #ifndef ARB_HANDLERS_H |
|---|
| 13 | #define ARB_HANDLERS_H |
|---|
| 14 | |
|---|
| 15 | #ifndef ARB_CORE_H |
|---|
| 16 | #include <arb_core.h> |
|---|
| 17 | #endif |
|---|
| 18 | #ifndef ATTRIBUTES_H |
|---|
| 19 | #include <attributes.h> |
|---|
| 20 | #endif |
|---|
| 21 | |
|---|
| 22 | enum arb_status_type { |
|---|
| 23 | AST_FORWARD, // gauge may only increment (not decrement) |
|---|
| 24 | AST_RANDOM, // random gauge allowed |
|---|
| 25 | }; |
|---|
| 26 | |
|---|
| 27 | struct arb_status_implementation { |
|---|
| 28 | arb_status_type type; |
|---|
| 29 | void (*openstatus)(const char *title); // opens the status window and sets title |
|---|
| 30 | void (*closestatus)(); // close the status window |
|---|
| 31 | void (*set_title)(const char *title); // set the title |
|---|
| 32 | void (*set_subtitle)(const char *title); // set the subtitle |
|---|
| 33 | void (*set_gauge)(double gauge); // set the gauge (=percent) |
|---|
| 34 | bool (*user_abort)(); // return true on user abort |
|---|
| 35 | }; |
|---|
| 36 | |
|---|
| 37 | struct arb_handlers { |
|---|
| 38 | gb_error_handler_type show_error; |
|---|
| 39 | gb_warning_func_type show_warning; |
|---|
| 40 | gb_information_func_type show_message; |
|---|
| 41 | arb_status_implementation status; |
|---|
| 42 | }; |
|---|
| 43 | |
|---|
| 44 | extern arb_handlers *active_arb_handlers; |
|---|
| 45 | |
|---|
| 46 | void ARB_install_handlers(arb_handlers& handlers); |
|---|
| 47 | void ARB_redirect_handlers_to(FILE *use_as_stderr, FILE *use_as_stdout); |
|---|
| 48 | |
|---|
| 49 | #else |
|---|
| 50 | #error arb_handlers.h included twice |
|---|
| 51 | #endif // ARB_HANDLERS_H |
|---|