consistent table header style
This commit is contained in:
@@ -1023,7 +1023,7 @@ function M.CreateAuctionResultsTable(parent, config)
|
|||||||
if i == 1 then
|
if i == 1 then
|
||||||
cell:SetPoint('TOPLEFT', 0, 0)
|
cell:SetPoint('TOPLEFT', 0, 0)
|
||||||
else
|
else
|
||||||
cell:SetPoint('TOPLEFT', rt.headCells[i-1], 'TOPRIGHT')
|
cell:SetPoint('TOPLEFT', rt.headCells[i - 1], 'TOPRIGHT')
|
||||||
end
|
end
|
||||||
cell.info = column_config
|
cell.info = column_config
|
||||||
cell.rt = rt
|
cell.rt = rt
|
||||||
@@ -1034,7 +1034,6 @@ function M.CreateAuctionResultsTable(parent, config)
|
|||||||
|
|
||||||
local text = cell:CreateFontString()
|
local text = cell:CreateFontString()
|
||||||
text:SetJustifyH('CENTER')
|
text:SetJustifyH('CENTER')
|
||||||
text:SetJustifyV('CENTER')
|
|
||||||
text:SetFont(gui.font, 12)
|
text:SetFont(gui.font, 12)
|
||||||
text:SetTextColor(color.label.enabled())
|
text:SetTextColor(color.label.enabled())
|
||||||
cell:SetFontString(text)
|
cell:SetFontString(text)
|
||||||
|
|||||||
+15
-35
@@ -9,7 +9,7 @@ local ST_COUNT = 0
|
|||||||
|
|
||||||
local ST_ROW_HEIGHT = 15
|
local ST_ROW_HEIGHT = 15
|
||||||
local ST_ROW_TEXT_SIZE = 14
|
local ST_ROW_TEXT_SIZE = 14
|
||||||
local ST_HEAD_HEIGHT = 26.3
|
local ST_HEAD_HEIGHT = 27
|
||||||
local ST_HEAD_SPACE = 2
|
local ST_HEAD_SPACE = 2
|
||||||
local DEFAULT_COL_INFO = {{width=1}}
|
local DEFAULT_COL_INFO = {{width=1}}
|
||||||
|
|
||||||
@@ -143,10 +143,9 @@ local methods = {
|
|||||||
|
|
||||||
Redraw = function(st)
|
Redraw = function(st)
|
||||||
local width = st:GetWidth() - 14
|
local width = st:GetWidth() - 14
|
||||||
local height = st:GetHeight()
|
|
||||||
|
|
||||||
if getn(st.colInfo) > 1 or st.colInfo[1].name then
|
if getn(st.colInfo) > 1 or st.colInfo[1].name then
|
||||||
st.sizes.headHeight = st.sizes.headFontSize and (st.sizes.headFontSize + 4) or ST_HEAD_HEIGHT
|
st.sizes.headHeight = ST_HEAD_HEIGHT
|
||||||
else
|
else
|
||||||
st.sizes.headHeight = 0
|
st.sizes.headHeight = 0
|
||||||
end
|
end
|
||||||
@@ -156,15 +155,6 @@ local methods = {
|
|||||||
st.scrollBar:SetPoint('BOTTOMRIGHT', st, -1, 1)
|
st.scrollBar:SetPoint('BOTTOMRIGHT', st, -1, 1)
|
||||||
st.scrollBar:SetPoint('TOPRIGHT', st, -1, -st.sizes.headHeight - ST_HEAD_SPACE - 1)
|
st.scrollBar:SetPoint('TOPRIGHT', st, -1, -st.sizes.headHeight - ST_HEAD_SPACE - 1)
|
||||||
|
|
||||||
if st.sizes.headHeight > 0 then
|
|
||||||
st.headLine:Show()
|
|
||||||
st.headLine:ClearAllPoints()
|
|
||||||
st.headLine:SetPoint('TOPLEFT', 2, -st.sizes.headHeight)
|
|
||||||
st.headLine:SetPoint('TOPRIGHT', -2, -st.sizes.headHeight)
|
|
||||||
else
|
|
||||||
st.headLine:Hide()
|
|
||||||
end
|
|
||||||
|
|
||||||
if st.rows and st.rows[1] then
|
if st.rows and st.rows[1] then
|
||||||
st.rows[1]:SetPoint('TOPLEFT', 0, -(st.sizes.headHeight + ST_HEAD_SPACE))
|
st.rows[1]:SetPoint('TOPLEFT', 0, -(st.sizes.headHeight + ST_HEAD_SPACE))
|
||||||
st.rows[1]:SetPoint('TOPRIGHT', 0, -(st.sizes.headHeight + ST_HEAD_SPACE))
|
st.rows[1]:SetPoint('TOPRIGHT', 0, -(st.sizes.headHeight + ST_HEAD_SPACE))
|
||||||
@@ -179,7 +169,7 @@ local methods = {
|
|||||||
col:Show()
|
col:Show()
|
||||||
col:SetWidth(st.colInfo[i].width * width)
|
col:SetWidth(st.colInfo[i].width * width)
|
||||||
col:SetHeight(st.sizes.headHeight)
|
col:SetHeight(st.sizes.headHeight)
|
||||||
col.text:SetText(st.colInfo[i].name or "")
|
col.text:SetText(st.colInfo[i].name or '')
|
||||||
col.text:SetJustifyH(st.colInfo[i].headAlign or 'CENTER')
|
col.text:SetJustifyH(st.colInfo[i].headAlign or 'CENTER')
|
||||||
else
|
else
|
||||||
col:Hide()
|
col:Hide()
|
||||||
@@ -218,21 +208,25 @@ local methods = {
|
|||||||
local colNum = getn(st.headCols) + 1
|
local colNum = getn(st.headCols) + 1
|
||||||
local col = CreateFrame('Frame', st:GetName() .. 'HeadCol' .. colNum, st.contentFrame)
|
local col = CreateFrame('Frame', st:GetName() .. 'HeadCol' .. colNum, st.contentFrame)
|
||||||
if colNum == 1 then
|
if colNum == 1 then
|
||||||
col:SetPoint('TOPLEFT', 0, -1)
|
col:SetPoint('TOPLEFT', 0, 0)
|
||||||
else
|
else
|
||||||
col:SetPoint('TOPLEFT', st.headCols[colNum - 1], 'TOPRIGHT')
|
col:SetPoint('TOPLEFT', st.headCols[colNum - 1], 'TOPRIGHT')
|
||||||
end
|
end
|
||||||
col.st = st
|
col.st = st
|
||||||
col.colNum = colNum
|
col.colNum = colNum
|
||||||
|
|
||||||
local text = col:CreateFontString()
|
local text = col:CreateFontString()
|
||||||
text:SetAllPoints()
|
text:SetAllPoints()
|
||||||
text:SetJustifyV('CENTER')
|
text:SetFont(gui.font, 12)
|
||||||
text:SetFont(gui.font, 16)
|
text:SetTextColor(color.label.enabled())
|
||||||
text:SetTextColor(color.text.enabled())
|
|
||||||
text:SetAllPoints()
|
|
||||||
col.text = text
|
col.text = text
|
||||||
|
|
||||||
|
local tex = col:CreateTexture()
|
||||||
|
tex:SetAllPoints()
|
||||||
|
tex:SetTexture([[Interface\AddOns\aux-AddOn\WorldStateFinalScore-Highlight]])
|
||||||
|
tex:SetTexCoord(.017, 1, .083, .909)
|
||||||
|
tex:SetAlpha(.5)
|
||||||
|
|
||||||
tinsert(st.headCols, col)
|
tinsert(st.headCols, col)
|
||||||
|
|
||||||
-- add new cells to the rows
|
-- add new cells to the rows
|
||||||
@@ -298,18 +292,6 @@ local methods = {
|
|||||||
st.handlers[event] = handler
|
st.handlers[event] = handler
|
||||||
end,
|
end,
|
||||||
|
|
||||||
SetHeadFontSize = function(st, size)
|
|
||||||
st.sizes.headFontSize = size
|
|
||||||
for _, col in st.headCols do
|
|
||||||
if st.sizes.headFontSize then
|
|
||||||
col.text:SetFont(gui.font, st.sizes.headFontSize)
|
|
||||||
else
|
|
||||||
col.text:SetFont(gui.font, gui.font_size.medium)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
st:Redraw()
|
|
||||||
end,
|
|
||||||
|
|
||||||
SetColInfo = function(st, colInfo)
|
SetColInfo = function(st, colInfo)
|
||||||
colInfo = colInfo or DEFAULT_COL_INFO
|
colInfo = colInfo or DEFAULT_COL_INFO
|
||||||
st.colInfo = colInfo
|
st.colInfo = colInfo
|
||||||
@@ -328,7 +310,7 @@ function M.CreateScrollingTable(parent)
|
|||||||
st.contentFrame = contentFrame
|
st.contentFrame = contentFrame
|
||||||
|
|
||||||
local scrollFrame = CreateFrame('ScrollFrame', st:GetName() .. 'ScrollFrame', st, 'FauxScrollFrameTemplate')
|
local scrollFrame = CreateFrame('ScrollFrame', st:GetName() .. 'ScrollFrame', st, 'FauxScrollFrameTemplate')
|
||||||
scrollFrame:SetScript('OnVerticalScroll', function(self, offset)
|
scrollFrame:SetScript('OnVerticalScroll', function()
|
||||||
FauxScrollFrame_OnVerticalScroll(ST_ROW_HEIGHT, function() st:RefreshRows() end)
|
FauxScrollFrame_OnVerticalScroll(ST_ROW_HEIGHT, function() st:RefreshRows() end)
|
||||||
end)
|
end)
|
||||||
scrollFrame:SetAllPoints(contentFrame)
|
scrollFrame:SetAllPoints(contentFrame)
|
||||||
@@ -345,8 +327,6 @@ function M.CreateScrollingTable(parent)
|
|||||||
_G[scrollBar:GetName() .. 'ScrollUpButton']:Hide()
|
_G[scrollBar:GetName() .. 'ScrollUpButton']:Hide()
|
||||||
_G[scrollBar:GetName() .. 'ScrollDownButton']:Hide()
|
_G[scrollBar:GetName() .. 'ScrollDownButton']:Hide()
|
||||||
|
|
||||||
st.headLine = gui.horizontal_line(st, 0)
|
|
||||||
|
|
||||||
for name, func in methods do
|
for name, func in methods do
|
||||||
st[name] = func
|
st[name] = func
|
||||||
end
|
end
|
||||||
|
|||||||
+10
-10
@@ -69,11 +69,11 @@ inventory_listing = item_listing.create(
|
|||||||
|
|
||||||
bid_listing = listing.CreateScrollingTable(frame.bid_listing)
|
bid_listing = listing.CreateScrollingTable(frame.bid_listing)
|
||||||
bid_listing:SetColInfo{
|
bid_listing:SetColInfo{
|
||||||
{name='#', width=.15, align='CENTER'},
|
{name='Auctions', width=.17, align='CENTER'},
|
||||||
{name='Left', width=.11, align='CENTER'},
|
{name='Time Left', width=.11, align='CENTER'},
|
||||||
{name='Qty', width=.11, align='CENTER'},
|
{name='Stack Size', width=.11, align='CENTER'},
|
||||||
{name='Bid/ea', width=.4, align='RIGHT'},
|
{name='Auction Bid|n (per item)', width=.4, align='RIGHT'},
|
||||||
{name='Pct', width=.23, align='CENTER'},
|
{name='% Hist. Value', width=.21, align='CENTER'},
|
||||||
}
|
}
|
||||||
bid_listing:DisableSelection(true)
|
bid_listing:DisableSelection(true)
|
||||||
bid_listing:SetHandler('OnClick', function(table, row_data, column, button)
|
bid_listing:SetHandler('OnClick', function(table, row_data, column, button)
|
||||||
@@ -82,11 +82,11 @@ end)
|
|||||||
|
|
||||||
buyout_listing = listing.CreateScrollingTable(frame.buyout_listing)
|
buyout_listing = listing.CreateScrollingTable(frame.buyout_listing)
|
||||||
buyout_listing:SetColInfo{
|
buyout_listing:SetColInfo{
|
||||||
{name='#', width=.15, align='CENTER'},
|
{name='Auctions', width=.17, align='CENTER'},
|
||||||
{name='Left', width=.11, align='CENTER'},
|
{name='Time Left', width=.11, align='CENTER'},
|
||||||
{name='Qty', width=.11, align='CENTER'},
|
{name='Stack Size', width=.12, align='CENTER'},
|
||||||
{name='Buy/ea', width=.4, align='RIGHT'},
|
{name='Auction Buyout|n (per item)', width=.4, align='RIGHT'},
|
||||||
{name='Pct', width=.23, align='CENTER'},
|
{name='% Hist. Value', width=.20, align='CENTER'},
|
||||||
}
|
}
|
||||||
buyout_listing:DisableSelection(true)
|
buyout_listing:DisableSelection(true)
|
||||||
buyout_listing:SetHandler('OnClick', function(table, row_data, column, button)
|
buyout_listing:SetHandler('OnClick', function(table, row_data, column, button)
|
||||||
|
|||||||
@@ -535,7 +535,7 @@ for _ = 1, 5 do
|
|||||||
end
|
end
|
||||||
|
|
||||||
favorite_searches_listing = listing.CreateScrollingTable(frame.saved.favorite)
|
favorite_searches_listing = listing.CreateScrollingTable(frame.saved.favorite)
|
||||||
favorite_searches_listing:SetColInfo{{name='Auto', width=.1, align='CENTER'}, {name='Favorite Searches', width=.9}}
|
favorite_searches_listing:SetColInfo{{name='Auto Buy', width=.07, align='CENTER'}, {name='Favorite Searches', width=.93}}
|
||||||
|
|
||||||
recent_searches_listing = listing.CreateScrollingTable(frame.saved.recent)
|
recent_searches_listing = listing.CreateScrollingTable(frame.saved.recent)
|
||||||
recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}}
|
recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}}
|
||||||
|
|||||||
Reference in New Issue
Block a user