You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
840 B
39 lines
840 B
13 years ago
|
UI = { }
|
||
|
UI.root = getRootWidget()
|
||
|
|
||
13 years ago
|
-- public functions
|
||
|
function UI.display(arg1, options)
|
||
|
local widget
|
||
|
local parent
|
||
|
if options then parent = options.parent end
|
||
|
parent = parent or UI.root
|
||
13 years ago
|
|
||
13 years ago
|
-- 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
|
||
13 years ago
|
|
||
13 years ago
|
-- 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
|
||
13 years ago
|
end
|