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

@@ -74,9 +74,13 @@ end
local attributeNames = {}
for name in pairs(Attribute) do
attributeNames[#attributeNames + 1] = name
if name ~= 'type' then -- type must be handled last
attributeNames[#attributeNames + 1] = name
end
end
attributeNames[#attributeNames + 1] = 'type'
--[[--
Widget pseudo-constructor.
@@ -109,17 +113,6 @@ local function metaCall (Widget, layout, self)
self[property] = value
end
self.type = self.type or 'generic'
self.fontData = Font(self.font, self.size, self.color)
-- layout:addWidget(self)
local decorate = Widget.typeDecorators[self.type]
if decorate then
decorate(self)
end
for k, v in ipairs(self) do
self[k] = v.isWidget and v or metaCall(Widget, self.layout, v)
self[k].parent = self