Added Buttons and Toolbar

This commit is contained in:
Cooldude2606
2019-05-06 12:54:41 +01:00
parent 550a2a362c
commit 2119378fad
5 changed files with 288 additions and 0 deletions

44
expcore/Gui/core.lua Normal file
View File

@@ -0,0 +1,44 @@
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
end
--- Sets the caption for the element config
function Gui._prototype:set_caption(caption)
self.caption = caption
end
--- Sets the tooltip for the element config
function Gui._prototype:set_tooltip(tooltip)
self.tooltip = tooltip
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