mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 19:45:22 +09:00
47 lines
1.1 KiB
Lua
47 lines
1.1 KiB
Lua
local Gui = require 'utils.gui'
|
|
|
|
Gui._prototype = {}
|
|
Gui.inputs = {}
|
|
Gui.structure = {}
|
|
Gui.outputs = {}
|
|
|
|
function Gui._extend_prototype(tbl)
|
|
for k,v in pairs(Gui._prototype) do
|
|
if not tbl[k] then tbl[k] = v end
|
|
end
|
|
return tbl
|
|
end
|
|
|
|
--- Sets the caption for the element config
|
|
function Gui._prototype:set_caption(caption)
|
|
self.caption = caption
|
|
return self
|
|
end
|
|
|
|
--- Sets the tooltip for the element config
|
|
function Gui._prototype:set_tooltip(tooltip)
|
|
self.tooltip = tooltip
|
|
return self
|
|
end
|
|
|
|
function Gui.toggle_enable(element)
|
|
if not element or not element.valid then return end
|
|
if not element.enabled then
|
|
-- this way round so if its nil it will become false
|
|
element.enabled = true
|
|
else
|
|
element.enabled = false
|
|
end
|
|
end
|
|
|
|
function Gui.toggle_visible(element)
|
|
if not element or not element.valid then return end
|
|
if not element.visible then
|
|
-- this way round so if its nil it will become false
|
|
element.visible = true
|
|
else
|
|
element.visible = false
|
|
end
|
|
end
|
|
|
|
return Gui |