Public Types | Public Member Functions | Protected Member Functions

ProgressBar Class Reference

A progress bar component. More...

Inherits Component, SettableTooltipClient, and Timer.

List of all members.

Public Types

enum  ColourIds { backgroundColourId = 0x1001900, foregroundColourId = 0x1001a00 }
 

A set of colour IDs to use to change the colour of various aspects of the bar.

More...

Public Member Functions

 ProgressBar (double &progress)
 Creates a ProgressBar.
 ~ProgressBar ()
 Destructor.
void setPercentageDisplay (bool shouldDisplayPercentage)
 Turns the percentage display on or off.
void setTextToDisplay (const String &text)
 Gives the progress bar a string to display inside it.

Protected Member Functions

void paint (Graphics &g)
 Components can override this method to draw their content.
void lookAndFeelChanged ()
 Called to let the component react to a change in the look-and-feel setting.
void visibilityChanged ()
 Called when this component's visiblility changes.
void colourChanged ()
 This method is called when a colour is changed by the setColour() method.

Detailed Description

A progress bar component.

To use this, just create one and make it visible. It'll run its own timer to keep an eye on a variable that you give it, and will automatically redraw itself when the variable changes.

For an easy way of running a background task with a dialog box showing its progress, see the ThreadWithProgressWindow class.

See also:
ThreadWithProgressWindow

Member Enumeration Documentation

A set of colour IDs to use to change the colour of various aspects of the bar.

These constants can be used either via the Component::setColour(), or LookAndFeel::setColour() methods.

See also:
Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
Enumerator:
backgroundColourId 

The background colour, behind the bar.

foregroundColourId 

The colour to use to draw the bar itself.

LookAndFeel classes will probably use variations on this colour.


Constructor & Destructor Documentation

ProgressBar::ProgressBar ( double &  progress ) [explicit]

Creates a ProgressBar.

Parameters:
progresspass in a reference to a double that you're going to update with your task's progress. The ProgressBar will monitor the value of this variable and will redraw itself when the value changes. The range is from 0 to 1.0. Obviously you'd better be careful not to delete this variable while the ProgressBar still exists!
ProgressBar::~ProgressBar (  )

Destructor.


Member Function Documentation

void ProgressBar::setPercentageDisplay ( bool  shouldDisplayPercentage )

Turns the percentage display on or off.

By default this is on, and the progress bar will display a text string showing its current percentage.

void ProgressBar::setTextToDisplay ( const String text )

Gives the progress bar a string to display inside it.

If you call this, it will turn off the percentage display.

See also:
setPercentageDisplay
void ProgressBar::paint ( Graphics g ) [protected, virtual]

Components can override this method to draw their content.

The paint() method gets called when a region of a component needs redrawing, either because the component's repaint() method has been called, or because something has happened on the screen that means a section of a window needs to be redrawn.

Any child components will draw themselves over whatever this method draws. If you need to paint over the top of your child components, you can also implement the paintOverChildren() method to do this.

If you want to cause a component to redraw itself, this is done asynchronously - calling the repaint() method marks a region of the component as "dirty", and the paint() method will automatically be called sometime later, by the message thread, to paint any bits that need refreshing. In Juce (and almost all modern UI frameworks), you never redraw something synchronously.

You should never need to call this method directly - to take a snapshot of the component you could use createComponentSnapshot() or paintEntireComponent().

Parameters:
gthe graphics context that must be used to do the drawing operations.
See also:
repaint, paintOverChildren, Graphics

Reimplemented from Component.

void ProgressBar::lookAndFeelChanged (  ) [protected, virtual]

Called to let the component react to a change in the look-and-feel setting.

When the look-and-feel is changed for a component, this will be called in all its child components, recursively.

It can also be triggered manually by the sendLookAndFeelChange() method, in case an application uses a LookAndFeel class that might have changed internally.

See also:
sendLookAndFeelChange, getLookAndFeel

Reimplemented from Component.

void ProgressBar::visibilityChanged (  ) [protected, virtual]

Called when this component's visiblility changes.

See also:
setVisible, isVisible

Reimplemented from Component.

void ProgressBar::colourChanged (  ) [protected, virtual]

This method is called when a colour is changed by the setColour() method.

See also:
setColour, findColour

Reimplemented from Component.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines