module refactoring
This commit is contained in:
+12
-11
@@ -1,8 +1,9 @@
|
||||
module 'aux.gui.listing'
|
||||
|
||||
include 'T'
|
||||
include 'aux'
|
||||
|
||||
local T = require 'T'
|
||||
|
||||
local gui = require 'aux.gui'
|
||||
|
||||
local ROW_HEIGHT = 15
|
||||
@@ -64,7 +65,7 @@ local methods = {
|
||||
self.headHeight = 0
|
||||
end
|
||||
|
||||
if getn(self.rowData or empty) > self.numRows then
|
||||
if getn(self.rowData or T.empty) > self.numRows then
|
||||
self.contentFrame:SetPoint('BOTTOMRIGHT', -15, 0)
|
||||
else
|
||||
self.contentFrame:SetPoint('BOTTOMRIGHT', 0, 0)
|
||||
@@ -150,10 +151,10 @@ local methods = {
|
||||
end,
|
||||
|
||||
SetData = function(self, rowData)
|
||||
for _, row in pairs(self.rowData or empty) do
|
||||
for _, col in pairs(row.cols) do release(col) end
|
||||
release(row.cols)
|
||||
release(row)
|
||||
for _, row in pairs(self.rowData or T.empty) do
|
||||
for _, col in pairs(row.cols) do T.release(col) end
|
||||
T.release(row.cols)
|
||||
T.release(row)
|
||||
end
|
||||
self.rowData = rowData
|
||||
self.updateSort = true
|
||||
@@ -235,7 +236,7 @@ local methods = {
|
||||
row.highlight = highlight
|
||||
row.st = self
|
||||
|
||||
row.cols = T
|
||||
row.cols = T.acquire()
|
||||
self.rows[rowNum] = row
|
||||
for _ = 1, getn(self.colInfo) do
|
||||
self:AddCell(rowNum)
|
||||
@@ -258,7 +259,7 @@ local methods = {
|
||||
}
|
||||
|
||||
function M.new(parent)
|
||||
local st = CreateFrame('Frame', gui.unique_name, parent)
|
||||
local st = CreateFrame('Frame', gui.unique_name(), parent)
|
||||
st:SetAllPoints()
|
||||
|
||||
st.numRows = max(floor((parent:GetHeight() - HEAD_HEIGHT - HEAD_SPACE) / ROW_HEIGHT), 0)
|
||||
@@ -292,9 +293,9 @@ function M.new(parent)
|
||||
st[name] = func
|
||||
end
|
||||
|
||||
st.headCols = T
|
||||
st.rows = T
|
||||
st.handlers = T
|
||||
st.headCols = T.acquire()
|
||||
st.rows = T.acquire()
|
||||
st.handlers = T.acquire()
|
||||
st.colInfo = DEFAULT_COL_INFO
|
||||
|
||||
return st
|
||||
|
||||
Reference in New Issue
Block a user