From cb17c3035bbd80bd8ea6718bae4c57cfb2555653 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Thu, 15 Jun 2017 23:20:00 +0200 Subject: Initial monitor GUI Basic monitor functionality, GTK-3.0 and QT5 backends --- src/gui_menu.hh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/gui_menu.hh (limited to 'src/gui_menu.hh') diff --git a/src/gui_menu.hh b/src/gui_menu.hh new file mode 100644 index 0000000..e2af274 --- /dev/null +++ b/src/gui_menu.hh @@ -0,0 +1,42 @@ +// -*- mode: c++; c-basic-offset: 2; -*- + +#ifndef GUI_MENU_HH +#define GUI_MENU_HH + +#include + +class GuiMenu { +public: + class Listener { + public: + virtual ~Listener() {} + + virtual void item_activated(std::string const& id) = 0; + + protected: + Listener() {} + }; + + virtual ~GuiMenu() {} + + static GuiMenu* create(); + + virtual void add_item(std::string const& id, std::string const& label) = 0; + // The returned menu lives as long as the root-menu, do not free + // the pointer yourself + virtual GuiMenu* add_menu(std::string const& label) = 0; + virtual void add_separator() = 0; + + // Call to enable/disable menu item, searches sub menues if no such + // item is found in this menu. Returns true if an item was found. + virtual bool enable_item(std::string const& id, bool enable = true) = 0; + + virtual void add_listener(Listener* listener) = 0; + virtual void remove_listener(Listener* listener) = 0; + +protected: + GuiMenu() {} + GuiMenu(GuiMenu const&) = delete; +}; + +#endif // GUI_MENU_HH -- cgit v1.2.3-70-g09d2