27 lines
719 B
C++
27 lines
719 B
C++
#pragma once
|
|
|
|
#include <filesystem>
|
|
#include <gtkmm/box.h>
|
|
#include <gtkmm/label.h>
|
|
#include <sigc++/connection.h>
|
|
|
|
class BatteryWidget : public Gtk::Box {
|
|
public:
|
|
BatteryWidget();
|
|
~BatteryWidget();
|
|
|
|
private:
|
|
Gtk::Label iconLabel;
|
|
Gtk::Label label;
|
|
sigc::connection timeoutConn;
|
|
std::filesystem::path batteryPath;
|
|
std::string currentStateClass;
|
|
|
|
void update();
|
|
bool on_timeout();
|
|
void find_battery_path();
|
|
void set_state_class(const std::string &stateClass);
|
|
std::string build_icon(int capacity, bool hasBattery, bool charging, bool full) const;
|
|
std::string build_text(int capacity, const std::string &status, bool hasBattery, bool charging, bool full) const;
|
|
};
|