Eduardo Bart 13 years ago
parent 9e90ae0ee4
commit f290b4f89c

@ -1,11 +1,9 @@
function messageBox(title, text) function messageBox(title, text)
local messageBoxWindow = UI.load("modules/messagebox/messagebox.yml") local msgbox = UI.load("modules/messagebox/messagebox.yml")
local messageBoxLabel = messageBoxWindow:getChildById("messageBoxLabel") local label = msgbox:getChildById("messageBoxLabel")
local messageBoxOkButton = messageBoxWindow:getChildById("messageBoxOkButton") local okButton = msgbox:getChildById("messageBoxOkButton")
messageBoxWindow.locked = true msgbox.locked = true
messageBoxWindow.title = title msgbox.title = title
messageBoxLabel.text = text label.text = text
--messageBoxWindow:setSize(messageBoxLabel:getSize() + Size{20, 20}) okButton.onClick = function() msgbox:destroy() end
messageBoxWindow.onDestroy = function() self.locked = false end
messageBoxOkButton.onClick = function() messageBoxWindow:destroy() end
end end

@ -127,7 +127,7 @@ int lua_UIElement_setOnLoad()
g_lua.insert(-2); g_lua.insert(-2);
if(UIElementPtr element = boost::dynamic_pointer_cast<UIElement>(g_lua.popClassInstance())) { if(UIElementPtr element = boost::dynamic_pointer_cast<UIElement>(g_lua.popClassInstance())) {
int funcRef = g_lua.popFunction(); int funcRef = g_lua.popFunction();
element->associateLuaRef(__FUNCTION__, funcRef); element->associateLuaRef("onLoad", funcRef);
element->setOnLoad(g_lua.createScriptableSelfFuncCallback(funcRef)); element->setOnLoad(g_lua.createScriptableSelfFuncCallback(funcRef));
} else } else
g_lua.pop(); g_lua.pop();
@ -139,7 +139,7 @@ int lua_UIElement_setOnDestroy()
g_lua.insert(-2); g_lua.insert(-2);
if(UIElementPtr element = boost::dynamic_pointer_cast<UIElement>(g_lua.popClassInstance())) { if(UIElementPtr element = boost::dynamic_pointer_cast<UIElement>(g_lua.popClassInstance())) {
int funcRef = g_lua.popFunction(); int funcRef = g_lua.popFunction();
element->associateLuaRef(__FUNCTION__, funcRef); element->associateLuaRef("onDestroy", funcRef);
element->setOnDestroy(g_lua.createScriptableSelfFuncCallback(funcRef)); element->setOnDestroy(g_lua.createScriptableSelfFuncCallback(funcRef));
} }
else else
@ -223,7 +223,7 @@ int lua_UIButton_setOnClick()
g_lua.insert(-2); g_lua.insert(-2);
if(UIButtonPtr button = boost::dynamic_pointer_cast<UIButton>(g_lua.popClassInstance())) { if(UIButtonPtr button = boost::dynamic_pointer_cast<UIButton>(g_lua.popClassInstance())) {
int funcRef = g_lua.popFunction(); int funcRef = g_lua.popFunction();
button->associateLuaRef(__FUNCTION__, funcRef); button->associateLuaRef("onClick", funcRef);
button->setOnClick(g_lua.createScriptableSelfFuncCallback(funcRef)); button->setOnClick(g_lua.createScriptableSelfFuncCallback(funcRef));
} else } else
g_lua.pop(); g_lua.pop();

Loading…
Cancel
Save