3895ace12a
ramp-0 is used for everything <= base-temperature and ramp-N is used for everything >= warn-temperature * [Temperature, Ramp] fix wrong icon for temperatures near base and warn temps * [Temperature, Ramp] fix wrong icon for temperatures near base and warn temps * Fix minor error * explicitly check percentage in get_by_percentage_with_borders * Fixed silly error
32 lines
739 B
C++
32 lines
739 B
C++
#pragma once
|
|
|
|
#include "common.hpp"
|
|
#include "components/config.hpp"
|
|
#include "drawtypes/label.hpp"
|
|
#include "utils/mixins.hpp"
|
|
|
|
POLYBAR_NS
|
|
|
|
namespace drawtypes {
|
|
class ramp : public non_copyable_mixin<ramp> {
|
|
public:
|
|
explicit ramp() = default;
|
|
explicit ramp(vector<label_t>&& icons) : m_icons(forward<decltype(icons)>(icons)) {}
|
|
|
|
void add(label_t&& icon);
|
|
label_t get(size_t index);
|
|
label_t get_by_percentage(float percentage);
|
|
label_t get_by_percentage_with_borders(float percentage);
|
|
operator bool();
|
|
|
|
protected:
|
|
vector<label_t> m_icons;
|
|
};
|
|
|
|
using ramp_t = shared_ptr<ramp>;
|
|
|
|
ramp_t load_ramp(const config& conf, const string& section, string name, bool required = true);
|
|
}
|
|
|
|
POLYBAR_NS_END
|