Files
factorio-scenario-ExpCluster/expcore/gui/styles/expstyle/footer.lua
2019-09-28 16:17:17 +01:00

54 lines
1.3 KiB
Lua

--[[-- Core Module - ExpStyle
@module ExpStyle
]]
local Gui = require 'expcore.gui' -- @dep expcore.gui
Gui.require_concept 'frame' -- @dep gui.concept.table
local right_align =
Gui.new_concept('alignment')
--[[-- A frame that acts as a footer to a section of content
@see Gui.frame
@element footer
@tparam string tooltip the tooltip to show on the title
@usage-- Concept Structure
-- Root
--> [footer] - the footer frame
-->> footer_caption - the lable with the title in it
-->> footer_content - the area to contain butons
Gui.new_concept('footer')
:set_title('Example Footer')
]]
Gui.new_concept('frame')
:save_as('footer')
:new_property('tooltip')
-- Draw
:define_draw(function(properties,parent,element)
-- Update the table style
Gui.set_padding(element,2,2,4,4)
element.style = 'subfooter_frame'
element.caption = ''
local style = element.style
style.horizontally_stretchable = true
style.use_header_filler = false
-- Add the caption to the frame
if properties.title then
element.add{
type = 'label',
name = 'footer_caption',
caption = properties.title,
tooltip = properties.tooltip
}
end
-- Add the right align area
local align = right_align:draw(element,'footer_content')
return align
end)