Clarisse 5.0 SP8 SDK  5.0.5.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
app_progress_bar_example.cc

This is an example of how to use the AppProgressBar class.

#include <app_base.h>
#include <app_progress_bar.h>
void
my_process(AppBase& app)
{
// create the progress bar
AppProgressBar *progress_bar = app.create_progress_bar("my process", /*keep_in_history*/ true, /*is_abortable*/ true);
unsigned int step, step_count;
// first task: 0% to 20%
progress_bar->begin_task("first task", 0.2f);
step_count = 1000;
progress_bar->set_step_count(step_count);
for (step = 0; step < step_count; step++) {
if (progress_bar->must_abort()) break; // abort if needed
// do stuff
progress_bar->step(step + 1); // the ith step has been processed
}
progress_bar->end_task();
// second task: 20% to 100%
progress_bar->begin_task("second task");
step_count = 4000;
progress_bar->set_step_count(step_count);
for (step = 0; step < step_count; step++) {
if (progress_bar->must_abort()) break; // abort if needed
// do stuff
progress_bar->step(step + 1); // the ith step has been processed
}
progress_bar->end_task();
// release the progress bar
progress_bar->destroy();
}