Formalize type attribute and support it in styles

This commit is contained in:
airstruck
2015-12-02 15:48:21 -05:00
parent a902385d55
commit f03b5c7bd4
29 changed files with 302 additions and 344 deletions

View File

@@ -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.