// -*- 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