IS3D::ProgressBar Class Reference

#include <ProgressBar.H>

Inherits IS3D::DrawObj.

List of all members.

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.


Detailed Description

Draws a progress bar on the screen. Useful for keeping the user updated on the progress of long operations that you want to perform in the background.

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.


Constructor & Destructor Documentation

IS3D::ProgressBar::ProgressBar ( const std::string &  title  ) 

virtual IS3D::ProgressBar::~ProgressBar (  )  [virtual]


Member Function Documentation

void IS3D::ProgressBar::setValue ( float  v  )  [inline]

Set the percentage done value, should range from 0 to 100.

float IS3D::ProgressBar::getValue (  )  [inline]

template<class T>
void IS3D::ProgressBar::setProgressUpdateCallback ( T *  thisPtr,
float(T::*)()  method 
) [inline]

void IS3D::ProgressBar::draw (  )  [virtual]

Override this function and place your G3D draw calls inside it.

Implements IS3D::DrawObj.


The documentation for this class was generated from the following file:

Generated on Wed Jan 26 06:31:20 2011 for IS3D by  doxygen 1.5.6