Rename columnlist:AdjustColumns to columnlist:PositionColumns

This commit is contained in:
Kenny Shields 2014-08-23 16:33:53 -04:00
parent c159ae7828
commit 62f95614f4
2 changed files with 12 additions and 27 deletions

View File

@ -231,31 +231,16 @@ function newobject:mousereleased(x, y, button)
end end
--[[--------------------------------------------------------- --[[---------------------------------------------------------
- func: Adjustchildren() - func: PositionColumns()
- desc: adjusts the width of the object's children - desc: positions the object's columns
--]]--------------------------------------------------------- --]]---------------------------------------------------------
function newobject:AdjustColumns() function newobject:PositionColumns()
local width = self.width
local vbody = self.internals[1]:GetVerticalScrollBody()
if varea then
width = width - vbody.width
end
local children = self.children
local numchildren = #children
local columnwidth = width/numchildren
local x = 0 local x = 0
for k, v in ipairs(children) do for k, v in ipairs(self.children) do
if bar then
v:SetWidth(columnwidth)
else
v:SetWidth(columnwidth)
end
v:SetPos(x, 0) v:SetPos(x, 0)
x = x + columnwidth x = x + v.width
end end
return self return self
@ -275,7 +260,7 @@ function newobject:AddColumn(name)
local height = self.height local height = self.height
loveframes.objects["columnlistheader"]:new(name, self) loveframes.objects["columnlistheader"]:new(name, self)
self:AdjustColumns() self:PositionColumns()
list:SetSize(width, height) list:SetSize(width, height)
list:SetPos(0, 0) list:SetPos(0, 0)
@ -340,7 +325,7 @@ function newobject:SetSize(width, height, r1, r2)
self.height = height self.height = height
end end
self:AdjustColumns() self:PositionColumns()
list:SetSize(width, height) list:SetSize(width, height)
list:SetPos(0, 0) list:SetPos(0, 0)
@ -366,7 +351,7 @@ function newobject:SetWidth(width, relative)
self.width = width self.width = width
end end
self:AdjustColumns() self:PositionColumns()
list:SetSize(width) list:SetSize(width)
list:SetPos(0, 0) list:SetPos(0, 0)
@ -392,7 +377,7 @@ function newobject:SetHeight(height, relative)
self.height = height self.height = height
end end
self:AdjustColumns() self:PositionColumns()
list:SetSize(height) list:SetSize(height)
list:SetPos(0, 0) list:SetPos(0, 0)
@ -744,7 +729,7 @@ function newobject:SizeToChildren(max)
end end
self:SetSize(width, height) self:SetSize(width, height)
self:AdjustColumns() self:PositionColumns()
return self return self
end end

View File

@ -352,7 +352,7 @@ function newobject:AddRow(data)
table.insert(self.children, loveframes.objects["columnlistrow"]:new(self, data)) table.insert(self.children, loveframes.objects["columnlistrow"]:new(self, data))
self:CalculateSize() self:CalculateSize()
self:RedoLayout() self:RedoLayout()
self.parent:AdjustColumns() self.parent:PositionColumns()
end end
@ -411,7 +411,7 @@ function newobject:Clear()
self.children = {} self.children = {}
self:CalculateSize() self:CalculateSize()
self:RedoLayout() self:RedoLayout()
self.parent:AdjustColumns() self.parent:PositionColumns()
self.rowcolorindex = 1 self.rowcolorindex = 1
end end