summaryrefslogtreecommitdiff
path: root/src/gui_menu.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui_menu.hh')
-rw-r--r--src/gui_menu.hh42
1 files changed, 42 insertions, 0 deletions
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 <string>
+
+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