2016-06-14 23:32:35 -04: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 00:22:44 -05:00
|
|
|
POLYBAR_NS
|
2016-06-14 23:32:35 -04:00
|
|
|
|
|
|
|
namespace drawtypes {
|
2016-12-09 03:02:47 -05:00
|
|
|
// fwd
|
|
|
|
class label;
|
|
|
|
using label_t = shared_ptr<label>;
|
|
|
|
using icon = label;
|
|
|
|
using icon_t = label_t;
|
|
|
|
|
2016-06-14 23:32:35 -04:00
|
|
|
class progressbar : public non_copyable_mixin<progressbar> {
|
|
|
|
public:
|
2016-11-25 07:55:15 -05:00
|
|
|
explicit progressbar(const bar_settings& bar, int width, string format);
|
2016-06-14 23:32:35 -04:00
|
|
|
|
2016-11-02 15:22:45 -04:00
|
|
|
void set_fill(icon_t&& fill);
|
|
|
|
void set_empty(icon_t&& empty);
|
|
|
|
void set_indicator(icon_t&& indicator);
|
|
|
|
void set_gradient(bool mode);
|
|
|
|
void set_colors(vector<string>&& colors);
|
2016-06-14 23:32:35 -04:00
|
|
|
|
2016-11-02 15:22:45 -04:00
|
|
|
string output(float percentage);
|
2016-06-14 23:32:35 -04:00
|
|
|
|
|
|
|
protected:
|
2016-11-02 15:22:45 -04:00
|
|
|
void fill(unsigned int perc, unsigned int fill_width);
|
2016-10-25 01:10:03 -04:00
|
|
|
|
|
|
|
private:
|
2016-06-14 23:32:35 -04:00
|
|
|
unique_ptr<builder> m_builder;
|
|
|
|
vector<string> m_colors;
|
|
|
|
string m_format;
|
|
|
|
unsigned int m_width;
|
2016-10-25 01:10:03 -04:00
|
|
|
unsigned int m_colorstep = 1;
|
2016-06-14 23:32:35 -04:00
|
|
|
bool m_gradient = false;
|
|
|
|
|
|
|
|
icon_t m_fill;
|
|
|
|
icon_t m_empty;
|
|
|
|
icon_t m_indicator;
|
|
|
|
};
|
|
|
|
|
|
|
|
using progressbar_t = shared_ptr<progressbar>;
|
|
|
|
|
2016-11-25 07:55:15 -05:00
|
|
|
progressbar_t load_progressbar(const bar_settings& bar, const config& conf, const string& section, string name);
|
2016-06-14 23:32:35 -04:00
|
|
|
}
|
|
|
|
|
2016-11-19 00:22:44 -05:00
|
|
|
POLYBAR_NS_END
|