parent
63cbe11f7e
commit
55136fe866
@ -1,22 +1,38 @@
|
|||||||
UI = { }
|
UI = { }
|
||||||
UI.root = getRootWidget()
|
UI.root = getRootWidget()
|
||||||
|
|
||||||
function UI.loadAndDisplayLocked(otuiFile)
|
-- public functions
|
||||||
local widget = loadUI(otuiFile, UI.root)
|
function UI.display(arg1, options)
|
||||||
UI.root:lockChild(widget)
|
local widget
|
||||||
return widget
|
local parent
|
||||||
end
|
if options then parent = options.parent end
|
||||||
|
parent = parent or UI.root
|
||||||
|
|
||||||
function UI.loadAndDisplay(otuiFile)
|
-- display otui files
|
||||||
local widget = loadUI(otuiFile, UI.root)
|
if type(arg1) == 'string' then
|
||||||
return widget
|
local otuiFilePath = resolveFileFullPath(arg1, 2)
|
||||||
end
|
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
|
||||||
|
|
||||||
function UI.display(widget)
|
-- apply display options
|
||||||
UI.root:addChild(widget)
|
if widget and options then
|
||||||
end
|
for option,value in pairs(options) do
|
||||||
|
if option == 'locked' and value then
|
||||||
function UI.displayLocked(widget)
|
widget:lock()
|
||||||
UI.root:addChild(widget)
|
elseif option == 'visible' then
|
||||||
UI.root:lockChild(widget)
|
widget:setVisible(value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return widget
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in new issue