1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-18 13:55:11 -05:00
polybar/include/drawtypes/bar.hpp
Michael Carlberg 39d3f61497 refactor(core): Clean-up
- use "#pragma once" instead of the regular include guard
- fix errors and warnings reported by cppcheck
2016-06-02 01:32:06 +02:00

42 lines
1.1 KiB
C++

#pragma once
#include <string>
#include <memory>
#include <vector>
#include "drawtypes/icon.hpp"
class Builder;
namespace drawtypes
{
class Bar
{
protected:
std::unique_ptr<Builder> builder;
std::vector<std::string> colors;
bool gradient = false;
unsigned int width;
std::string format;
std::unique_ptr<Icon> fill;
std::unique_ptr<Icon> empty;
std::unique_ptr<Icon> indicator;
public:
Bar(int width, const std::string& fmt, bool lazy_builder_closing = true);
Bar(int width, bool lazy_builder_closing = true)
: Bar(width, "<fill><indicator><empty>", lazy_builder_closing){}
void set_fill(std::unique_ptr<Icon> &&icon);
void set_empty(std::unique_ptr<Icon> &&icon);
void set_indicator(std::unique_ptr<Icon> &&icon);
void set_gradient(bool mode);
void set_colors(std::vector<std::string> &&colors);
std::string get_output(float percentage, bool floor_percentage = false);
};
std::unique_ptr<Bar> get_config_bar(const std::string& config_path, const std::string& bar_name = "bar", bool lazy_builder_closing = true);
}