some listing refactoring

This commit is contained in:
Simon Hirsig
2015-10-30 13:19:50 +01:00
parent c17a1508c6
commit 68b9b3e486
3 changed files with 19 additions and 5 deletions
+7 -2
View File
@@ -153,8 +153,13 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_cell_click,
row:SetPoint('TOPRIGHT', labels[getn(columns)], 'BOTTOMRIGHT', 0, -((row_index-1) * 14))
row:RegisterForClicks("LeftButtonDown", "RightButtonDown")
row:SetHeight(14)
row.cells = {}
local row_index = row_index
row:SetScript("OnClick", function() if sheet.on_row_click then sheet.on_row_click(sheet, row_index) end end)
row:SetScript("OnEnter", function() if sheet.on_row_enter then sheet.on_row_enter(sheet, row_index) end end)
row:SetScript("OnLeave", function() if sheet.on_row_leave then sheet.on_row_leave(sheet, row_index) end end)
row.cells = {}
for i = 1,getn(columns) do
local cell = CreateFrame('Button', nil, content)
cell:SetPoint('TOPLEFT', labels[i], 'BOTTOMLEFT', 0, -((row_index-1) * 14))
@@ -163,7 +168,7 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_cell_click,
cell:SetHeight(14)
local row_index, column_index = row_index, i
local column_index = i
cell:SetScript("OnClick", function() if sheet.on_cell_click then sheet.on_cell_click(sheet, row_index, column_index) end end)
cell:SetScript("OnEnter", function() if sheet.on_cell_enter then sheet.on_cell_enter(sheet, row_index, column_index) end end)
cell:SetScript("OnLeave", function() if sheet.on_cell_leave then sheet.on_cell_leave(sheet, row_index, column_index) end end)
+3 -3
View File
@@ -13,16 +13,16 @@ local set_auction, update_auction_listing, update_inventory_listing, record_auct
local LIVE, HISTORICAL, FIXED = 1, 2, 3
Aux.sell.inventory_listing_config = {
on_cell_click = function (sheet, row_index, column_index)
on_row_click = function (sheet, row_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
set_auction(sheet.data[data_index])
end,
on_cell_enter = function (sheet, row_index, column_index)
on_row_enter = function (sheet, row_index)
sheet.rows[row_index].highlight:SetAlpha(.5)
end,
on_cell_leave = function (sheet, row_index, column_index)
on_row_leave = function (sheet, row_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
if not (current_auction and sheet.data[data_index] == current_auction) then
sheet.rows[row_index].highlight:SetAlpha(0)
+9
View File
@@ -278,6 +278,15 @@ Aux.buy.modes = {
on_cell_leave = function (sheet, row_index, column_index)
sheet.rows[row_index].highlight:SetAlpha(0)
end,
row_setter = function(row, datum)
if current_auction and datum == current_auction then
row.highlight:SetAlpha(.5)
else
row.highlight:SetAlpha(0)
end
end,
columns = {
{
title = 'Qty',