Files
factorio-scenario-ExpCluster/expcore/gui/concepts/scroll.lua
Cooldude2606 ce88e0a296 Cleaner Code
2019-09-22 17:08:43 +01:00

47 lines
1.1 KiB
Lua

--[[-- Core Module - Gui
@module Gui
@alias Gui
]]
local Gui = require 'expcore.gui.core'
--[[-- Similar to a flow but includes the ability to show and use scroll bars.
@element scroll
@tparam string horizontal_scroll the horizontal scroll policy for this scroll pane
@tparam string vertical_scroll the vertical scroll policy for this scroll pane
@usage-- Making a basic flow, contains a label with hello world
local basic_scroll =
Gui.new_concept('scroll')
:define_draw(function(properties,parent,element)
element.style.hieght = 50
for i = 1,10 do
element.add{
type = 'label',
caption = i
}
end
end)
]]
Gui.new_concept()
:save_as('scroll')
-- Properties
:new_property('horizontal_scroll')
:new_property('vertical_scroll')
-- Draw
:define_draw(function(properties,parent,element)
-- Draw a scroll pane
element = parent.add{
name = properties.name,
type = 'scroll-pane',
horizontal_scroll_policy = properties.horizontal_scroll,
vertical_scroll_policy = properties.vertical_scroll
}
return element
end)