#ifndef GUI_HPP #define GUI_HPP #include #include #include #include "luastack.hpp" class GuiElt { friend class Gui; public: enum Type { TYPE_MENU_ITEM, }; private: Type type_; std::string action_; std::string label_; GuiElt() {} public: ~GuiElt() {} Type type() const { return type_; } const std::string &action() const { return action_; } const std::string &label() const { return label_; } }; class Gui { public: using EltVec = std::vector; private: EltVec elts_; public: const EltVec &elts() const { return elts_; } void clear() { elts_.clear(); } bool has_action(const std::string &action) const; void menu_item(const std::string &action, const std::string &label); // Put a pointer to a gui into the lua registry. // // All lua commands that manipulate the GUI implicitly // operate on this global gui pointer. // static void store_global_pointer(lua_State *L, Gui *g); static Gui *fetch_global_pointer(lua_State *L); }; using GuiResult = std::map; #endif // GUI_HPP