2011-08-26 17:06:52 +02:00
|
|
|
UI = { }
|
|
|
|
UI.root = getRootWidget()
|
|
|
|
|
2011-11-17 21:40:31 +01:00
|
|
|
-- public functions
|
|
|
|
function UI.display(arg1, options)
|
|
|
|
local widget
|
|
|
|
local parent
|
|
|
|
if options then parent = options.parent end
|
|
|
|
parent = parent or UI.root
|
2011-08-26 17:06:52 +02:00
|
|
|
|
2011-11-17 21:40:31 +01:00
|
|
|
-- display otui files
|
|
|
|
if type(arg1) == 'string' then
|
|
|
|
local otuiFilePath = resolveFileFullPath(arg1, 2)
|
|
|
|
widget = loadUI(otuiFilePath, parent)
|
|
|
|
-- display already loaded widgets
|
|
|
|
else
|
|
|
|
widget = arg1
|
|
|
|
if parent:hasChild(widget) then
|
|
|
|
widget:focus()
|
|
|
|
widget:show()
|
|
|
|
else
|
|
|
|
parent:addChild(widget)
|
|
|
|
widget:show()
|
|
|
|
end
|
|
|
|
end
|
2011-08-26 17:06:52 +02:00
|
|
|
|
2011-11-17 21:40:31 +01:00
|
|
|
-- apply display options
|
|
|
|
if widget and options then
|
|
|
|
for option,value in pairs(options) do
|
|
|
|
if option == 'locked' and value then
|
|
|
|
widget:lock()
|
|
|
|
elseif option == 'visible' then
|
|
|
|
widget:setVisible(value)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return widget
|
2011-08-26 17:06:52 +02:00
|
|
|
end
|