Typedefs | |
typedef int(* | imCounterCallback )(int counter, void *cb_user_data, const char *text, int progress) |
Functions | |
imCounterCallback | imCounterSetCallback (void *cb_user_data, imCounterCallback counter_func) |
int | imCounterHasCallback (void) |
int | imCounterBegin (const char *title) |
void | imCounterEnd (int counter) |
int | imCounterInc (int counter) |
int | imCounterIncTo (int counter, int count) |
void | imCounterTotal (int counter, int total, const char *message) |
void * | imCounterGetUserData (int counter) |
void | imCounterSetUserData (int counter, void *userdata) |
typedef int(* imCounterCallback)(int counter, void *cb_user_data, const char *text, int progress) |
Counter callback, informs the progress of the operation to the client.
Counter id identifies different counters.
Progress in a count reports a value from 0 to 1000 always, proportional to total value and increment. If -1 indicates that Begin was called, 1001 indicates that End was called.
If returns 0 the client should abort the operation.
Noticed that if the counter is aborted, the callback will still be called one last time at 1001. Text is NULL most of the time, but contains a title in Begin (progress==-1) and a message in the start of a count (progress==0).
imCounterCallback imCounterSetCallback | ( | void * | cb_user_data, | |
imCounterCallback | counter_func | |||
) |
Changes the counter callback. Returns old callback.
User data is changed only if not NULL.
int imCounterHasCallback | ( | void | ) |
Returns true if the counter callback is set. When the callback is NULL the counter is inactive and all functions do nothing.
int imCounterBegin | ( | const char * | title | ) |
Begins a new count.
Calls the callback with "-1" and text=title.
This is to be used by the operations. Returns a new counter Id.
Several counters can coexist at the same time, as part of a sequence with sub-counter or simultaneous counter in multi-thread applications.
void imCounterEnd | ( | int | counter | ) |
Ends a count.
Calls the callback with "1001", text=null, and releases the counter.
int imCounterInc | ( | int | counter | ) |
Increments a count. Must set the total first.
Calls the callback, text=message if it is the first increment for the count.
Returns 0 if the callback aborted, 1 if returns normally.
int imCounterIncTo | ( | int | counter, | |
int | count | |||
) |
Set a specific count. Must set the total first.
Calls the callback, text=message if it is the first increment for the count.
Returns 0 if the callback aborted, 1 if returns normally.
void imCounterTotal | ( | int | counter, | |
int | total, | |||
const char * | message | |||
) |
Sets the total increments of a count.
Must be set at least one time.
Notice that if total is set more than one time counter should simply restart.
void* imCounterGetUserData | ( | int | counter | ) |
Sets an additional user data in the counter. Used to save the lock in multi-threaded configurations.
void imCounterSetUserData | ( | int | counter, | |
void * | userdata | |||
) |
Returns the additional user data in the counter.