1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-11 13:50:56 -05:00
polybar/include/drawtypes/progressbar.hpp
patrick96 587dc6c84d bar: Make module separator a label
Some people use text modules instead of the `separator` key in the bar
section to better configure the separator (colors, fonts).
Since we disallowed the same module being used multiple times in #1534,
this will now print an error message.

This should help with this a bit.

Ref #1913
2019-10-27 16:02:33 +01:00

45 lines
1.1 KiB
C++

#pragma once
#include "common.hpp"
#include "components/builder.hpp"
#include "components/config.hpp"
#include "components/types.hpp"
#include "utils/mixins.hpp"
POLYBAR_NS
namespace drawtypes {
class progressbar : public non_copyable_mixin<progressbar> {
public:
explicit progressbar(const bar_settings& bar, int width, string format);
void set_fill(label_t&& fill);
void set_empty(label_t&& empty);
void set_indicator(label_t&& indicator);
void set_gradient(bool mode);
void set_colors(vector<string>&& colors);
string output(float percentage);
protected:
void fill(unsigned int perc, unsigned int fill_width);
private:
unique_ptr<builder> m_builder;
vector<string> m_colors;
string m_format;
unsigned int m_width;
unsigned int m_colorstep = 1;
bool m_gradient = false;
label_t m_fill;
label_t m_empty;
label_t m_indicator;
};
using progressbar_t = shared_ptr<progressbar>;
progressbar_t load_progressbar(const bar_settings& bar, const config& conf, const string& section, string name);
}
POLYBAR_NS_END