diff --git a/gui/auction_listing.lua b/gui/auction_listing.lua index e03fd41..d2b6b1e 100644 --- a/gui/auction_listing.lua +++ b/gui/auction_listing.lua @@ -73,6 +73,7 @@ function item_column_fill(cell, record, _, _, _, indented) end M.search_config = { + rows = 16, { title = 'Item', width = .35, @@ -243,6 +244,7 @@ M.search_config = { } M.auctions_config = { + rows = 20, { title = 'Item', width = .35, @@ -378,6 +380,7 @@ M.auctions_config = { } M.bids_config = { + rows = 20, { title = 'Item', width = .35, @@ -691,12 +694,6 @@ local methods = { end end --- -- if there's only one item in the result, expand it TODO --- if getn(self.rowInfo) == 1 and self.expanded[self.rowInfo[1].expandKey] == nil then --- self.expanded[self.rowInfo[1].expandKey] = true --- self.rowInfo.numDisplayRows = getn(self.rowInfo[1].children) --- end - for i = 1, getn(self.rowInfo) do local info = self.rowInfo[i] local totalAuctions, totalPlayerAuctions = 0, 0 @@ -802,7 +799,7 @@ local methods = { end row.data = {record=record, expandable=expandable, indented=indented, numAuctions=numAuctions, expandKey=expandKey} - for i, column_config in self.config do + for i, column_config in ipairs(self.config) do column_config.fill(row.cells[i], record, displayNumAuctions, numPlayerAuctions, expandable, indented) end end, @@ -917,8 +914,7 @@ local methods = { function M.new(parent, config) local rt = CreateFrame('Frame', nil, parent) rt.config = config - local numRows = 16 - rt.ROW_HEIGHT = (parent:GetHeight() - HEAD_HEIGHT - HEAD_SPACE) / numRows + rt.ROW_HEIGHT = (parent:GetHeight() - HEAD_HEIGHT - HEAD_SPACE) / config.rows rt.expanded = T rt.handlers = T rt.sorts = T @@ -948,7 +944,7 @@ function M.new(parent, config) end) scrollFrame:SetAllPoints(contentFrame) rt.scrollFrame = scrollFrame - FauxScrollFrame_Update(rt.scrollFrame, 0, numRows, rt.ROW_HEIGHT) + FauxScrollFrame_Update(rt.scrollFrame, 0, config.rows, rt.ROW_HEIGHT) local scrollBar = _G[scrollFrame:GetName() .. 'ScrollBar'] scrollBar:ClearAllPoints() @@ -1006,15 +1002,15 @@ function M.new(parent, config) end rt.rows = T - for i = 1, numRows do + for i = 1, config.rows do local row = CreateFrame('Frame', nil, rt.contentFrame) row:SetHeight(rt.ROW_HEIGHT) if i == 1 then - row:SetPoint('TOPLEFT', 0, -(HEAD_HEIGHT + HEAD_SPACE)) - row:SetPoint('TOPRIGHT', 0, -(HEAD_HEIGHT + HEAD_SPACE)) + row:SetPoint('TOPLEFT', 0, -(HEAD_HEIGHT + HEAD_SPACE)) + row:SetPoint('TOPRIGHT', 0, -(HEAD_HEIGHT + HEAD_SPACE)) else - row:SetPoint('TOPLEFT', rt.rows[i-1], 'BOTTOMLEFT') - row:SetPoint('TOPRIGHT', rt.rows[i-1], 'BOTTOMRIGHT') + row:SetPoint('TOPLEFT', 0, -(HEAD_HEIGHT + HEAD_SPACE + (i - 1) * rt.ROW_HEIGHT)) + row:SetPoint('TOPRIGHT', 0, -(HEAD_HEIGHT + HEAD_SPACE + (i - 1) * rt.ROW_HEIGHT)) end local highlight = row:CreateTexture() highlight:SetAllPoints() @@ -1045,7 +1041,7 @@ function M.new(parent, config) if j == 1 then cell:SetPoint('TOPLEFT', 0, 0) else - cell:SetPoint('TOPLEFT', row.cells[j-1], 'TOPRIGHT') + cell:SetPoint('TOPLEFT', row.cells[j - 1], 'TOPRIGHT') end if mod(j, 2) == 1 then diff --git a/gui/listing.lua b/gui/listing.lua index 271a040..a531e30 100644 --- a/gui/listing.lua +++ b/gui/listing.lua @@ -58,11 +58,6 @@ local methods = { else self.headHeight = 0 end - self.numRows = max(floor((self:GetParent():GetHeight() - self.headHeight - HEAD_SPACE) / ROW_HEIGHT), 0) - - self.scrollBar:ClearAllPoints() - self.scrollBar:SetPoint('BOTTOMRIGHT', self, -1, 1) - self.scrollBar:SetPoint('TOPRIGHT', self, -1, -self.headHeight - HEAD_SPACE - 1) if getn(self.rowData or empty) > self.numRows then self.contentFrame:SetPoint('BOTTOMRIGHT', -15, 0) @@ -270,14 +265,14 @@ local methods = { end end, - SetHandler = function(st, event, handler) - st.handlers[event] = handler + SetHandler = function(self, event, handler) + self.handlers[event] = handler end, - SetColInfo = function(st, colInfo) + SetColInfo = function(self, colInfo) colInfo = colInfo or DEFAULT_COL_INFO - st.colInfo = colInfo - st:Update() + self.colInfo = colInfo + self:Update() end, } @@ -285,6 +280,8 @@ function M.new(parent) local st = CreateFrame('Frame', gui.unique_name, parent) st:SetAllPoints() + st.numRows = max(floor((parent:GetHeight() - HEAD_HEIGHT - HEAD_SPACE) / ROW_HEIGHT), 0) + local contentFrame = CreateFrame('Frame', nil, st) contentFrame:SetPoint('TOPLEFT', 0, 0) contentFrame:SetPoint('BOTTOMRIGHT', 0, 0) @@ -298,7 +295,6 @@ function M.new(parent) st.scrollFrame = scrollFrame local scroll_bar = _G[scrollFrame:GetName() .. 'ScrollBar'] - st.scrollBar = scroll_bar scroll_bar:ClearAllPoints() scroll_bar:SetPoint('TOPRIGHT', st, -4, -HEAD_HEIGHT) scroll_bar:SetPoint('BOTTOMRIGHT', st, -4, 4)