87 lines
2.7 KiB
Lua
Executable File
87 lines
2.7 KiB
Lua
Executable File
setfenv(1, OctoAuxCompat) module 'aux'
|
|
|
|
-- 70334 port: aux lives inside the client's own AuctionHouseFrame (portrait frame, title, money bar and close
|
|
-- button stay native). The native Buy/Sell/Auctions content is hidden while aux is shown; aux's tabs take the
|
|
-- native tabs' place under the frame.
|
|
|
|
local T = require 'T'
|
|
local gui = require 'aux.gui'
|
|
|
|
function handle.LOAD()
|
|
for _, v in ipairs(tab_info) do
|
|
tabs:create_tab(v.name)
|
|
end
|
|
end
|
|
|
|
local NATIVE_CHROME = {NineSlice = true, PortraitContainer = true, CloseButton = true, TitleContainer = true, Bg = true,
|
|
TopTileStreaks = true, MoneyFrameInset = true, MoneyFrameBorder = true}
|
|
|
|
local function native_content(host)
|
|
local list = {}
|
|
for key, child in pairs(host) do
|
|
if type(child) == 'table' and type(child.GetObjectType) == 'function' and child ~= frame and not NATIVE_CHROME[key]
|
|
and child.Hide and child.GetParent and child:GetParent() == host then
|
|
list[child] = true
|
|
end
|
|
end
|
|
for _, tab in ipairs(host.Tabs or T.empty) do list[tab] = true end
|
|
return list
|
|
end
|
|
|
|
function M.embed()
|
|
local host = _G.AuctionHouseFrame
|
|
if not host then return end
|
|
if frame:GetParent() ~= host then
|
|
frame:SetParent(host)
|
|
frame:ClearAllPoints()
|
|
frame:SetPoint('TOPLEFT', host, 'TOPLEFT', 8, -60)
|
|
frame:SetPoint('BOTTOMRIGHT', host, 'BOTTOMRIGHT', -6, 28)
|
|
host:HookScript('OnShow', function() if frame:IsShown() then embed() end end)
|
|
end
|
|
frame:SetFrameLevel(host:GetFrameLevel() + 20)
|
|
for child in pairs(native_content(host)) do
|
|
if child:IsShown() then child:Hide() end
|
|
end
|
|
local first = tabs._tabs[1]
|
|
if first then
|
|
first:ClearAllPoints()
|
|
first:SetPoint('BOTTOMLEFT', host, 'BOTTOMLEFT', 20, -28)
|
|
end
|
|
end
|
|
|
|
function M.close()
|
|
local host = _G.AuctionHouseFrame
|
|
if host and host:IsShown() then HideUIPanel(host) else frame:Hide() end
|
|
end
|
|
|
|
function handle.INIT_UI()
|
|
do
|
|
local frame = CreateFrame('Frame', 'aux_frame', UIParent)
|
|
gui.set_size(frame, 768, 447)
|
|
frame:SetPoint('LEFT', 100, 0)
|
|
frame:EnableMouse(true)
|
|
frame:SetScript('OnHide', function()
|
|
CloseAuctionHouse()
|
|
end)
|
|
frame.content = CreateFrame('Frame', nil, frame)
|
|
frame.content:SetPoint('TOPLEFT', 4, -80)
|
|
frame.content:SetPoint('BOTTOMRIGHT', -4, 35)
|
|
frame:Hide()
|
|
M.frame = frame
|
|
end
|
|
do
|
|
tabs = gui.tabs(frame, 'DOWN')
|
|
tabs._on_select = on_tab_click
|
|
function M.set_tab(id) tabs:select(id) end
|
|
end
|
|
do
|
|
local btn = gui.button(frame)
|
|
btn:SetPoint('BOTTOMRIGHT', -5, 5)
|
|
gui.set_size(btn, 60, 24)
|
|
btn:SetText(CLOSE or 'Close')
|
|
btn:SetScript('OnClick', function() close() end)
|
|
btn:SetFrameLevel(btn:GetFrameLevel() + 2)
|
|
close_button = btn
|
|
end
|
|
end
|