refactoring
This commit is contained in:
@@ -17,21 +17,19 @@ function C(r, g, b, a)
|
|||||||
return setmetatable(T, mt)
|
return setmetatable(T, mt)
|
||||||
end
|
end
|
||||||
|
|
||||||
W = wrapper
|
M.color = immutable-{
|
||||||
|
text = immutable-{enabled = C(255, 254, 250, 1), disabled = C(147, 151, 139, 1)},
|
||||||
M.color = W-{
|
label = immutable-{enabled = C(216, 225, 211, 1), disabled = C(150, 148, 140, 1)},
|
||||||
text = W-{enabled = C(255, 254, 250, 1), disabled = C(147, 151, 139, 1)},
|
|
||||||
label = W-{enabled = C(216, 225, 211, 1), disabled = C(150, 148, 140, 1)},
|
|
||||||
link = C(153, 255, 255, 1),
|
link = C(153, 255, 255, 1),
|
||||||
window = W-{background = C(24, 24, 24, .93), border = C(30, 30, 30, 1)},
|
window = immutable-{background = C(24, 24, 24, .93), border = C(30, 30, 30, 1)},
|
||||||
panel = W-{background = C(24, 24, 24, 1), border = C(255, 255, 255, .03)},
|
panel = immutable-{background = C(24, 24, 24, 1), border = C(255, 255, 255, .03)},
|
||||||
content = W-{background = C(42, 42, 42, 1), border = C(0, 0, 0, 0)},
|
content = immutable-{background = C(42, 42, 42, 1), border = C(0, 0, 0, 0)},
|
||||||
state = W-{enabled = C(70, 140, 70, 1), disabled = C(140, 70, 70, 1)},
|
state = immutable-{enabled = C(70, 140, 70, 1), disabled = C(140, 70, 70, 1)},
|
||||||
|
|
||||||
tooltip = W-{
|
tooltip = immutable-{
|
||||||
value = C(255, 255, 154, 1),
|
value = C(255, 255, 154, 1),
|
||||||
merchant = C(204, 127, 25, 1),
|
merchant = C(204, 127, 25, 1),
|
||||||
disenchant = W-{
|
disenchant = immutable-{
|
||||||
value = C(25, 153, 153, 1),
|
value = C(25, 153, 153, 1),
|
||||||
distribution = C(204, 204, 51, 1),
|
distribution = C(204, 204, 51, 1),
|
||||||
source = C(178, 178, 178, 1),
|
source = C(178, 178, 178, 1),
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ function item_column_fill(cell, record, _, _, _, indented)
|
|||||||
end
|
end
|
||||||
|
|
||||||
M.search_config = {
|
M.search_config = {
|
||||||
rows = 16,
|
|
||||||
{
|
{
|
||||||
title = 'Item',
|
title = 'Item',
|
||||||
width = .35,
|
width = .35,
|
||||||
@@ -244,7 +243,6 @@ M.search_config = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
M.auctions_config = {
|
M.auctions_config = {
|
||||||
rows = 20,
|
|
||||||
{
|
{
|
||||||
title = 'Item',
|
title = 'Item',
|
||||||
width = .35,
|
width = .35,
|
||||||
@@ -380,7 +378,6 @@ M.auctions_config = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
M.bids_config = {
|
M.bids_config = {
|
||||||
rows = 20,
|
|
||||||
{
|
{
|
||||||
title = 'Item',
|
title = 'Item',
|
||||||
width = .35,
|
width = .35,
|
||||||
@@ -799,7 +796,7 @@ local methods = {
|
|||||||
end
|
end
|
||||||
row.data = {record=record, expandable=expandable, indented=indented, numAuctions=numAuctions, expandKey=expandKey}
|
row.data = {record=record, expandable=expandable, indented=indented, numAuctions=numAuctions, expandKey=expandKey}
|
||||||
|
|
||||||
for i, column_config in ipairs(self.config) do
|
for i, column_config in self.config do
|
||||||
column_config.fill(row.cells[i], record, displayNumAuctions, numPlayerAuctions, expandable, indented)
|
column_config.fill(row.cells[i], record, displayNumAuctions, numPlayerAuctions, expandable, indented)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@@ -911,10 +908,10 @@ local methods = {
|
|||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
function M.new(parent, config)
|
function M.new(parent, rows, config)
|
||||||
local rt = CreateFrame('Frame', nil, parent)
|
local rt = CreateFrame('Frame', nil, parent)
|
||||||
rt.config = config
|
rt.config = config
|
||||||
rt.ROW_HEIGHT = (parent:GetHeight() - HEAD_HEIGHT - HEAD_SPACE) / config.rows
|
rt.ROW_HEIGHT = (parent:GetHeight() - HEAD_HEIGHT - HEAD_SPACE) / rows
|
||||||
rt.expanded = T
|
rt.expanded = T
|
||||||
rt.handlers = T
|
rt.handlers = T
|
||||||
rt.sorts = T
|
rt.sorts = T
|
||||||
@@ -944,7 +941,7 @@ function M.new(parent, config)
|
|||||||
end)
|
end)
|
||||||
scrollFrame:SetAllPoints(contentFrame)
|
scrollFrame:SetAllPoints(contentFrame)
|
||||||
rt.scrollFrame = scrollFrame
|
rt.scrollFrame = scrollFrame
|
||||||
FauxScrollFrame_Update(rt.scrollFrame, 0, config.rows, rt.ROW_HEIGHT)
|
FauxScrollFrame_Update(rt.scrollFrame, 0, rows, rt.ROW_HEIGHT)
|
||||||
|
|
||||||
local scrollBar = _G[scrollFrame:GetName() .. 'ScrollBar']
|
local scrollBar = _G[scrollFrame:GetName() .. 'ScrollBar']
|
||||||
scrollBar:ClearAllPoints()
|
scrollBar:ClearAllPoints()
|
||||||
@@ -1002,7 +999,7 @@ function M.new(parent, config)
|
|||||||
end
|
end
|
||||||
|
|
||||||
rt.rows = T
|
rt.rows = T
|
||||||
for i = 1, config.rows do
|
for i = 1, rows do
|
||||||
local row = CreateFrame('Frame', nil, rt.contentFrame)
|
local row = CreateFrame('Frame', nil, rt.contentFrame)
|
||||||
row:SetHeight(rt.ROW_HEIGHT)
|
row:SetHeight(rt.ROW_HEIGHT)
|
||||||
if i == 1 then
|
if i == 1 then
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
|
|||||||
frame.listing:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
|
frame.listing:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
|
||||||
frame.listing:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
|
frame.listing:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
|
||||||
|
|
||||||
listing = auction_listing.new(frame.listing, auction_listing.auctions_config)
|
listing = auction_listing.new(frame.listing, 20, auction_listing.auctions_config)
|
||||||
listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8)
|
listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8)
|
||||||
listing:Reset()
|
listing:Reset()
|
||||||
listing:SetHandler('OnCellClick', function(cell, button)
|
listing:SetHandler('OnCellClick', function(cell, button)
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@ frame.listing:SetPoint('TOP', frame, 'TOP', 0, -8)
|
|||||||
frame.listing:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
|
frame.listing:SetPoint('BOTTOMLEFT', AuxFrame.content, 'BOTTOMLEFT', 0, 0)
|
||||||
frame.listing:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
|
frame.listing:SetPoint('BOTTOMRIGHT', AuxFrame.content, 'BOTTOMRIGHT', 0, 0)
|
||||||
|
|
||||||
listing = auction_listing.new(frame.listing, auction_listing.bids_config)
|
listing = auction_listing.new(frame.listing, 20, auction_listing.bids_config)
|
||||||
listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8)
|
listing:SetSort(1, 2, 3, 4, 5, 6, 7, 8)
|
||||||
listing:Reset()
|
listing:Reset()
|
||||||
listing:SetHandler('OnCellClick', function(cell, button)
|
listing:SetHandler('OnCellClick', function(cell, button)
|
||||||
|
|||||||
@@ -516,7 +516,7 @@ for _ = 1, 5 do
|
|||||||
status_bar:Hide()
|
status_bar:Hide()
|
||||||
tinsert(status_bars, status_bar)
|
tinsert(status_bars, status_bar)
|
||||||
|
|
||||||
local table = auction_listing.new(frame.results, auction_listing.search_config)
|
local table = auction_listing.new(frame.results, 16, auction_listing.search_config)
|
||||||
table:SetHandler('OnCellClick', function(cell, button)
|
table:SetHandler('OnCellClick', function(cell, button)
|
||||||
if IsAltKeyDown() and current_search.table:GetSelection().record == cell.row.data.record then
|
if IsAltKeyDown() and current_search.table:GetSelection().record == cell.row.data.record then
|
||||||
if button == 'LeftButton' then
|
if button == 'LeftButton' then
|
||||||
|
|||||||
Reference in New Issue
Block a user