#include <ProgressBar.H>
Inherits IS3D::DrawObj.
Public Member Functions | |
ProgressBar (const std::string &title) | |
virtual | ~ProgressBar () |
void | setValue (float v) |
Set the percentage done value, should range from 0 to 100. | |
float | getValue () |
template<class T> | |
void | setProgressUpdateCallback (T *thisPtr, float(T::*method)()) |
void | draw () |
Override this function and place your G3D draw calls inside it. |
There are 2 ways to update the value displayed on the progressbar:
1. Call ProgressBar::setValue();
2. Register a callback function with the ProgressBar. The function should return a float (the value for the bar). ProgressBar::draw() will automatically call your callback function to update the value whenever it is drawn.
Method 2 is recommended if you are doing your time-expensive operation in a separate thread. The callback is a pretty easy way to communicate between your main graphics program and the extra thread. You should use a mutex to guard any variables that could be accessed by both threads inside your callback function. See IS3D::VRMLParser for an example of a ProgressBar used with threads.
IS3D::ProgressBar::ProgressBar | ( | const std::string & | title | ) |
virtual IS3D::ProgressBar::~ProgressBar | ( | ) | [virtual] |
void IS3D::ProgressBar::setValue | ( | float | v | ) | [inline] |
Set the percentage done value, should range from 0 to 100.
float IS3D::ProgressBar::getValue | ( | ) | [inline] |
void IS3D::ProgressBar::setProgressUpdateCallback | ( | T * | thisPtr, | |
float(T::*)() | method | |||
) | [inline] |
void IS3D::ProgressBar::draw | ( | ) | [virtual] |