add GtkMenu to the AModule class

You can configure what key launch the menu with the "menu" element in
the config, the xml file that describes the menu with the "menu-file"
element in the config, and the actions of each buttons with the
"menu-actions" field.
This commit is contained in:
Benjamin Voisin
2024-05-09 17:28:08 +02:00
parent e627879b16
commit 884b909e7d
2 changed files with 35 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include <glibmm/markup.h>
#include <gtkmm/eventbox.h>
#include <json/json.h>
#include <gtkmm.h>
#include "IModule.hpp"
@ -52,6 +53,10 @@ class AModule : public IModule {
std::vector<int> pid_;
gdouble distance_scrolled_y_;
gdouble distance_scrolled_x_;
GObject* menu_;
std::map<std::string, GtkMenuItem*> submenus_;
std::map<std::string, std::string> menuActionsMap_;
static void handleGtkMenuEvent(GtkMenuItem* menuitem, gpointer data);
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"},