2019-06-15 12:57:52 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <glibmm/dispatcher.h>
|
|
|
|
#include <glibmm/markup.h>
|
|
|
|
#include <gtkmm/eventbox.h>
|
|
|
|
#include <json/json.h>
|
2020-05-27 07:10:38 +00:00
|
|
|
|
2019-06-15 12:57:52 +00:00
|
|
|
#include "IModule.hpp"
|
|
|
|
|
|
|
|
namespace waybar {
|
|
|
|
|
|
|
|
class AModule : public IModule {
|
|
|
|
public:
|
2020-05-27 07:10:38 +00:00
|
|
|
AModule(const Json::Value &, const std::string &, const std::string &, bool enable_click = false,
|
|
|
|
bool enable_scroll = false);
|
2019-06-15 12:57:52 +00:00
|
|
|
virtual ~AModule();
|
|
|
|
virtual auto update() -> void;
|
|
|
|
virtual operator Gtk::Widget &();
|
|
|
|
|
|
|
|
Glib::Dispatcher dp;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
enum SCROLL_DIR { NONE, UP, DOWN, LEFT, RIGHT };
|
|
|
|
|
|
|
|
SCROLL_DIR getScrollDir(GdkEventScroll *e);
|
|
|
|
bool tooltipEnabled();
|
|
|
|
|
2020-05-27 07:10:38 +00:00
|
|
|
const std::string name_;
|
2019-06-15 12:57:52 +00:00
|
|
|
const Json::Value &config_;
|
|
|
|
Gtk::EventBox event_box_;
|
|
|
|
|
|
|
|
virtual bool handleToggle(GdkEventButton *const &ev);
|
|
|
|
virtual bool handleScroll(GdkEventScroll *);
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<int> pid_;
|
2019-06-16 11:17:34 +00:00
|
|
|
gdouble distance_scrolled_y_;
|
|
|
|
gdouble distance_scrolled_x_;
|
2019-06-15 12:57:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace waybar
|