mirror of
https://github.com/rad4day/Waybar.git
synced 2025-07-13 14:42:29 +02:00
ISSUE#1977. AModule implements module actions call
Signed-off-by: Viktar Lukashonak <myxabeer@gmail.com>
This commit is contained in:
@ -11,16 +11,20 @@ namespace waybar {
|
||||
|
||||
class AModule : public IModule {
|
||||
public:
|
||||
AModule(const Json::Value &, const std::string &, const std::string &, bool enable_click = false,
|
||||
bool enable_scroll = false);
|
||||
virtual ~AModule();
|
||||
virtual auto update() -> void;
|
||||
virtual auto refresh(int) -> void{};
|
||||
virtual operator Gtk::Widget &();
|
||||
virtual auto doAction(const std::string& name) -> void;
|
||||
|
||||
Glib::Dispatcher dp;
|
||||
|
||||
protected:
|
||||
// Don't need to make an object directly
|
||||
// Derived classes are able to use it
|
||||
AModule(const Json::Value &, const std::string &, const std::string &, bool enable_click = false,
|
||||
bool enable_scroll = false);
|
||||
|
||||
enum SCROLL_DIR { NONE, UP, DOWN, LEFT, RIGHT };
|
||||
|
||||
SCROLL_DIR getScrollDir(GdkEventScroll *e);
|
||||
@ -37,6 +41,7 @@ class AModule : public IModule {
|
||||
std::vector<int> pid_;
|
||||
gdouble distance_scrolled_y_;
|
||||
gdouble distance_scrolled_x_;
|
||||
std::map<std::string, std::string> eventActionMap_;
|
||||
static const inline std::map<std::pair<uint, GdkEventType>, std::string> eventMap_{
|
||||
{std::make_pair(1, GdkEventType::GDK_BUTTON_PRESS), "on-click"},
|
||||
{std::make_pair(1, GdkEventType::GDK_2BUTTON_PRESS), "on-double-click"},
|
||||
|
Reference in New Issue
Block a user