// // Created by grimmauld on 07.03.24. // #ifndef SWAYMUX_ABSTRACTKEYLISTENER_H #define SWAYMUX_ABSTRACTKEYLISTENER_H #include #include #include class AbstractKeyListener { public: virtual void handleKeyEvent(const QKeyEvent *keyEvent) const = 0; bool testAndInvoke(const QKeyEvent *keyEvent) const { if (canAcceptKey(keyEvent->key())) { handleKeyEvent(keyEvent); return true; } return false; } virtual std::string getDescription() = 0; virtual std::string getKeyText() = 0; [[nodiscard]] virtual bool canAcceptKey(int key) const = 0; }; #endif //SWAYMUX_ABSTRACTKEYLISTENER_H