2016-05-31 03:58:58 +00:00
|
|
|
#pragma once
|
2016-05-19 14:41:06 +00:00
|
|
|
|
2016-06-15 03:32:35 +00:00
|
|
|
#include "common.hpp"
|
|
|
|
#include "components/config.hpp"
|
|
|
|
#include "drawtypes/label.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 ramp : public non_copyable_mixin {
|
2016-06-15 03:32:35 +00:00
|
|
|
public:
|
|
|
|
explicit ramp() = default;
|
2018-12-23 21:59:10 +00:00
|
|
|
explicit ramp(vector<label_t>&& icons) : m_icons(forward<decltype(icons)>(icons)) {}
|
2016-06-15 03:32:35 +00:00
|
|
|
|
2018-12-23 21:59:10 +00:00
|
|
|
void add(label_t&& icon);
|
2021-09-22 19:46:20 +00:00
|
|
|
void add(label_t&& icon, unsigned weight);
|
2018-12-23 21:59:10 +00:00
|
|
|
label_t get(size_t index);
|
|
|
|
label_t get_by_percentage(float percentage);
|
2020-12-02 14:55:13 +00:00
|
|
|
label_t get_by_percentage_with_borders(float percentage, float min, float max);
|
|
|
|
label_t get_by_percentage_with_borders(int percentage, int min, int max);
|
2016-11-02 19:22:45 +00:00
|
|
|
operator bool();
|
2016-06-15 03:32:35 +00:00
|
|
|
|
|
|
|
protected:
|
2018-12-23 21:59:10 +00:00
|
|
|
vector<label_t> m_icons;
|
2016-05-19 14:41:06 +00:00
|
|
|
};
|
|
|
|
|
2016-10-25 05:10:03 +00:00
|
|
|
using ramp_t = shared_ptr<ramp>;
|
2016-06-15 03:32:35 +00:00
|
|
|
|
2016-11-25 12:55:15 +00:00
|
|
|
ramp_t load_ramp(const config& conf, const string& section, string name, bool required = true);
|
2022-01-22 19:35:37 +00:00
|
|
|
} // namespace drawtypes
|
2016-06-15 03:32:35 +00:00
|
|
|
|
2016-11-19 05:22:44 +00:00
|
|
|
POLYBAR_NS_END
|