Cleaner Code

This commit is contained in:
Cooldude2606
2019-09-22 17:08:43 +01:00
parent 1f204c6dac
commit ce88e0a296
114 changed files with 951 additions and 583 deletions

View File

@@ -7,17 +7,28 @@ local Gui = require 'expcore.gui.core'
--[[-- A piece of text.
@element frame
@tparam ?string|Concepts.LocalisedString caption the caption that will show in the label
@tparam ?string|Concepts.LocalisedString description the description that will show on the label
@tparam defines.rich_text_setting rich_text how this element handles rich text
@usage-- Making a basic label
local basic_label =
Gui.clone_concept('label','basic_label')
:set_caption('Hello, World!')
]]
Gui.new_concept('label')
:set_caption('Hello, World!')
]]
Gui.new_concept()
:save_as('label')
-- Properties
:new_property('caption')
:new_property('description')
:new_property('rich_text')
-- Draw
:define_draw(function(properties,parent,element)
-- Draw a label
element = parent.add{
name = properties.name,
type = 'label',
@@ -25,5 +36,11 @@ Gui.new_concept('label')
description = properties.description
}
-- Change rich text setting if present
local rich_text = properties.rich_text
if rich_text then
element.style.rich_text_setting = rich_text
end
return element
end)