2019-03-22 02:49:14 +01:00
|
|
|
#pragma once
|
|
|
|
|
2019-03-28 20:15:13 +01:00
|
|
|
#include <LibGUI/GFrame.h>
|
2019-03-22 02:49:14 +01:00
|
|
|
|
2019-03-28 20:15:13 +01:00
|
|
|
class GProgressBar : public GFrame {
|
2019-03-22 02:49:14 +01:00
|
|
|
public:
|
|
|
|
explicit GProgressBar(GWidget* parent);
|
|
|
|
virtual ~GProgressBar() override;
|
|
|
|
|
|
|
|
void set_range(int min, int max);
|
2019-04-19 01:05:59 +02:00
|
|
|
void set_min(int min) { set_range(min, max()); }
|
|
|
|
void set_max(int max) { set_range(min(), max); }
|
2019-03-22 02:49:14 +01:00
|
|
|
void set_value(int);
|
|
|
|
|
|
|
|
int value() const { return m_value; }
|
2019-04-12 15:17:53 +02:00
|
|
|
int min() const { return m_min; }
|
|
|
|
int max() const { return m_max; }
|
2019-03-22 02:49:14 +01:00
|
|
|
|
2019-03-25 04:25:25 +01:00
|
|
|
String caption() const { return m_caption; }
|
|
|
|
void set_caption(const String& caption) { m_caption = caption; }
|
|
|
|
|
2019-05-28 11:53:16 +02:00
|
|
|
enum Format
|
|
|
|
{
|
|
|
|
NoText,
|
|
|
|
Percentage,
|
|
|
|
ValueSlashMax
|
|
|
|
};
|
2019-03-25 04:25:25 +01:00
|
|
|
Format format() const { return m_format; }
|
|
|
|
void set_format(Format format) { m_format = format; }
|
|
|
|
|
2019-03-22 02:49:14 +01:00
|
|
|
protected:
|
|
|
|
virtual void paint_event(GPaintEvent&) override;
|
|
|
|
|
|
|
|
private:
|
2019-03-25 04:25:25 +01:00
|
|
|
Format m_format { Percentage };
|
2019-03-22 02:49:14 +01:00
|
|
|
int m_min { 0 };
|
|
|
|
int m_max { 100 };
|
|
|
|
int m_value { 0 };
|
2019-03-25 04:25:25 +01:00
|
|
|
String m_caption;
|
2019-03-22 02:49:14 +01:00
|
|
|
};
|