mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-29 12:16:37 +09:00
Cleaner Code
This commit is contained in:
@@ -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)
|
||||
Reference in New Issue
Block a user