ProgressBar


#1

Hi,

is it posible to make some vertical progressBar? I’d like to make a dB Meter and I’d like it to be vertical. Any help? :smiley:

Leskimo


#2

you’ll need to write your own.


#3

Something like this?






class MeterComponent	:	public Component, public ChangeBroadcaster {
private:
GradientBrush* brsGreen;
float value;

public:

	MeterComponent() : Component( T("Slider Field Component") ){
        value = .5f;
        brsGreen =  new GradientBrush(Colour(0,200,0),0,0,Colour(200,200,0),0,100,false);

	}


	~MeterComponentComponent(){
	    delete brsGreen;
		deleteAllChildren ();
	}


    void paint (Graphics& g){
        //background
        g.setColour(Colour(0,0,0));
        g.fillRect(0,0,getWidth(),getHeight());


        g.setBrush(brsGreen);
        g.fillRect(0,int(getHeight() * (1-value)),getWidth(),getHeight());

        //bevel outline for the entire draw area
        g.drawBevel(0, 0, getWidth(), getHeight(), 2, Colour(100,100,100), Colours::white, 0);
    }

    float getValue(){
        return value;
    }

    void setValue(float v){
        value = jmin(jmax(v , .0f) , 1.0f);
    }

};



#4

man, thank you so much!

Leskimo


#5

No problem. I just noticed that the ", public ChangeBroadcaster " in the class definition can be removed.
It’s there because I just stipped down a sort of slider class I wrote.


#6

Minty fresh in the Components section is my VU meter component. Not only can it do vertical and horizontal VU meters (both smooth and segmented), but also does analog style meters! It has sample and hold and decay, plus skewing for logarithmic display.

The analog meter still needs a little more polishing, but it’s completely useable right now, as is. Future things to improve include background images, performance enhancements (it does too much redrawing for my tastes), and settable analog meter wiper points.

  • kbj

#7