diff options
author | scuri <scuri> | 2008-10-17 06:10:15 +0000 |
---|---|---|
committer | scuri <scuri> | 2008-10-17 06:10:15 +0000 |
commit | 5a422aba704c375a307a902bafe658342e209906 (patch) | |
tree | 5005011e086bb863d8fb587ad3319bbec59b2447 /include/im_counter.h |
First commit - moving from LuaForge to SourceForge
Diffstat (limited to 'include/im_counter.h')
-rw-r--r-- | include/im_counter.h | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/include/im_counter.h b/include/im_counter.h new file mode 100644 index 0000000..82714f5 --- /dev/null +++ b/include/im_counter.h @@ -0,0 +1,69 @@ +/** \file + * \brief Processing Counter + * + * See Copyright Notice in im_lib.h + */ + +#ifndef __IM_COUNTER_H +#define __IM_COUNTER_H + +#if defined(__cplusplus) +extern "C" { +#endif + + +/** \defgroup counter Counter + * \par + * Used to notify the application that a step in the loading, saving or processing operation has been performed. + * \par + * See \ref im_counter.h + * \ingroup util */ + +/** Counter callback, informs the progress of the operation to the client. \n + * Text contains a constant string that is NULL during normal counting, a title in the begining of a sequence + * and a message in the begining of a count. + * Counter id identifies diferrent counters. \n + * Progress in a count reports a value from 0 to 1000. If -1 indicates the start of a sequence of operations, 1001 ends the sequence. \n + * If returns 0 the client should abort the operation. \n + * If the counter is aborted, the callback will be called one last time at 1001. + * \ingroup counter */ +typedef int (*imCounterCallback)(int counter, void* user_data, const char* text, int progress); + +/** Changes the counter callback. Returns old callback. \n + * User data is changed only if not NULL. + * \ingroup counter */ +imCounterCallback imCounterSetCallback(void* user_data, imCounterCallback counter_func); + +/** Begins a new count, or a partial-count in a sequence. \n + * Calls the callback with "-1" and text=title, if it is at the top level. \n + * This is to be used by the operations. Returns a counter Id. + * \ingroup counter */ +int imCounterBegin(const char* title); + +/** Ends a count, or a partial-count in a sequence. \n + * Calls the callback with "1001", text=null, and releases the counter if it is at top level count. \n + * \ingroup counter */ +void imCounterEnd(int counter); + +/** Increments a count. Must set the total first. \n + * Calls the callback, text=message if it is the first increment for the count. \n + * Returns 0 if the callback aborted, 1 if returns normally. + * \ingroup counter */ +int imCounterInc(int counter); + +/** Set a specific count. Must set the total first. \n + * Calls the callback, text=message if it is the first increment for the count. \n + * Returns 0 if the callback aborted, 1 if returns normally. + * \ingroup counter */ +int imCounterIncTo(int counter, int count); + +/** Sets the total increments of a count. + * \ingroup counter */ +void imCounterTotal(int counter, int total, const char* message); + + +#if defined(__cplusplus) +} +#endif + +#endif |