2011-05-31 03:55:34 +02:00
|
|
|
MessageBox = {}
|
|
|
|
MessageBox.__index = MessageBox
|
|
|
|
|
|
|
|
function MessageBox.create(title, text)
|
|
|
|
local msgBox = {}
|
|
|
|
setmetatable(msgBox, MessageBox)
|
|
|
|
|
|
|
|
local window = UI.load("messagebox.yml")
|
|
|
|
window.locked = true
|
|
|
|
window.title = title
|
|
|
|
window:child("textLabel").text = text
|
|
|
|
window:child("okButton").onClick = function()
|
|
|
|
self.parent:destroy()
|
|
|
|
end
|
|
|
|
window.onDestroy = function()
|
|
|
|
if msgBox.onDestroy then
|
|
|
|
msgBox.onDestroy()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
msgBox.window = window
|
|
|
|
return msgBox
|
|
|
|
end
|
|
|
|
|
|
|
|
function MessageBox:destroy()
|
|
|
|
if self.window then
|
|
|
|
self.window:destroy()
|
|
|
|
self.window = nil
|
|
|
|
end
|
2011-05-03 00:48:41 +02:00
|
|
|
end
|
|
|
|
|
2011-04-23 22:04:49 +02:00
|
|
|
function messageBox(title, text)
|
2011-05-31 03:55:34 +02:00
|
|
|
return MessageBox.create(title, text)
|
2011-05-01 20:47:35 +02:00
|
|
|
end
|