29 lines
698 B
C++
29 lines
698 B
C++
#include "gui.hpp"
|
|
|
|
LuaDefineType(Gui);
|
|
|
|
void Gui::menu_item(const std::string &action, const std::string &label) {
|
|
GuiElt elt;
|
|
elt.type_ = GuiElt::TYPE_MENU_ITEM;
|
|
elt.action_ = action;
|
|
elt.label_ = label;
|
|
elts_.push_back(elt);
|
|
}
|
|
|
|
LuaDefine(gui_create, "c") {
|
|
LuaRet lgui;
|
|
LuaStack LS(L, lgui);
|
|
LS.newpointer<Gui>(lgui, new Gui, true);
|
|
return LS.result();
|
|
}
|
|
|
|
LuaDefine(gui_menu_item, "c") {
|
|
LuaArg lgui, laction, llabel;
|
|
LuaStack LS(L, lgui, laction, llabel);
|
|
Gui *gui = LS.ckuserdata<Gui>(lgui);
|
|
std::string action = LS.ckstring(laction);
|
|
std::string label = LS.ckstring(llabel);
|
|
gui->menu_item(action, label);
|
|
return LS.result();
|
|
}
|