mirror of
https://github.com/airstruck/luigi.git
synced 2025-12-19 02:16:43 +00:00
Formalize type attribute and support it in styles
This commit is contained in:
@@ -11,8 +11,26 @@ Setting attributes can have side effects. For example, setting
|
||||
to recalculate their size and position.
|
||||
--]]--
|
||||
|
||||
local ROOT = (...):gsub('[^.]*$', '')
|
||||
|
||||
local Attribute = {}
|
||||
|
||||
function Attribute.type (widget, value)
|
||||
local oldType = widget.attributes.type
|
||||
|
||||
widget.attributes.type = value
|
||||
|
||||
if value and not widget.hasType then
|
||||
widget.hasType = true
|
||||
local Widget = require(ROOT .. 'widget')
|
||||
local decorate = Widget.typeDecorators[value]
|
||||
|
||||
if decorate then
|
||||
decorate(widget)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--[[--
|
||||
widget identifier.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user