2016-06-15 03:32:35 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common.hpp"
|
|
|
|
#include "components/builder.hpp"
|
|
|
|
#include "components/config.hpp"
|
|
|
|
#include "components/types.hpp"
|
|
|
|
#include "utils/mixins.hpp"
|
|
|
|
|
2016-11-19 05:22:44 +00:00
|
|
|
POLYBAR_NS
|
2016-06-15 03:32:35 +00:00
|
|
|
|
|
|
|
namespace drawtypes {
|
2022-01-22 19:35:37 +00:00
|
|
|
class progressbar : public non_copyable_mixin {
|
2016-06-15 03:32:35 +00:00
|
|
|
public:
|
2016-11-25 12:55:15 +00:00
|
|
|
explicit progressbar(const bar_settings& bar, int width, string format);
|
2016-06-15 03:32:35 +00:00
|
|
|
|
2018-12-23 21:59:10 +00:00
|
|
|
void set_fill(label_t&& fill);
|
|
|
|
void set_empty(label_t&& empty);
|
|
|
|
void set_indicator(label_t&& indicator);
|
2016-11-02 19:22:45 +00:00
|
|
|
void set_gradient(bool mode);
|
2019-10-27 21:41:18 +00:00
|
|
|
void set_colors(vector<rgba>&& colors);
|
2016-06-15 03:32:35 +00:00
|
|
|
|
2016-11-02 19:22:45 +00:00
|
|
|
string output(float percentage);
|
2016-06-15 03:32:35 +00:00
|
|
|
|
|
|
|
protected:
|
2016-11-02 19:22:45 +00:00
|
|
|
void fill(unsigned int perc, unsigned int fill_width);
|
2016-10-25 05:10:03 +00:00
|
|
|
|
|
|
|
private:
|
2016-06-15 03:32:35 +00:00
|
|
|
unique_ptr<builder> m_builder;
|
2019-10-27 21:41:18 +00:00
|
|
|
vector<rgba> m_colors;
|
2016-06-15 03:32:35 +00:00
|
|
|
string m_format;
|
|
|
|
unsigned int m_width;
|
2016-10-25 05:10:03 +00:00
|
|
|
unsigned int m_colorstep = 1;
|
2016-06-15 03:32:35 +00:00
|
|
|
bool m_gradient = false;
|
|
|
|
|
2018-12-23 21:59:10 +00:00
|
|
|
label_t m_fill;
|
|
|
|
label_t m_empty;
|
|
|
|
label_t m_indicator;
|
2016-06-15 03:32:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
using progressbar_t = shared_ptr<progressbar>;
|
|
|
|
|
2016-11-25 12:55:15 +00:00
|
|
|
progressbar_t load_progressbar(const bar_settings& bar, const config& conf, const string& section, string name);
|
2019-10-27 21:41:18 +00:00
|
|
|
} // namespace drawtypes
|
2016-06-15 03:32:35 +00:00
|
|
|
|
2016-11-19 05:22:44 +00:00
|
|
|
POLYBAR_NS_END
|