95 lines
3.4 KiB
Lua
95 lines
3.4 KiB
Lua
-- Ade Alts: ui_profs
|
|
local AA = AdeAlts
|
|
|
|
-- professions view ----------------------------------------------------
|
|
AA.PS = CreateFrame("Frame", nil, AA.P)
|
|
AA.PS:SetPoint("TOPLEFT", AA.P, "TOPLEFT", 6, -84)
|
|
AA.PS:SetWidth(230)
|
|
AA.PS:SetHeight(300)
|
|
AA.SkinFrame(AA.PS, 0.5)
|
|
AA.PS:Hide()
|
|
AA.PS.title = AA.PS:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
|
AA.PS.title:SetPoint("TOPLEFT", AA.PS, "TOPLEFT", 10, -7)
|
|
AA.PS.title:SetText("Professions")
|
|
AA.PS.empty = AA.PS:CreateFontString(nil, "OVERLAY", "GameFontDisable")
|
|
AA.PS.empty:SetPoint("CENTER", AA.PS, "CENTER", 0, 0)
|
|
AA.PS.empty:SetWidth(200)
|
|
AA.PS.empty:Hide()
|
|
AA.PS.rows = {}
|
|
for i = 1, 8 do
|
|
local r = CreateFrame("Button", nil, AA.PS)
|
|
r:SetHeight(36)
|
|
r:SetPoint("TOPLEFT", AA.PS, "TOPLEFT", 8, -28 - (i - 1) * 36)
|
|
r:SetPoint("TOPRIGHT", AA.PS, "TOPRIGHT", -8, -28 - (i - 1) * 36)
|
|
r.sel = r:CreateTexture(nil, "BACKGROUND")
|
|
r.sel:SetAllPoints(r)
|
|
r.sel:SetTexture(0.2, 0.5, 0.9, 0.35)
|
|
r.sel:Hide()
|
|
r:SetHighlightTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight")
|
|
r.name = r:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
|
r.name:SetPoint("TOPLEFT", r, "TOPLEFT", 6, -4)
|
|
r.rank = r:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
|
r.rank:SetPoint("TOPRIGHT", r, "TOPRIGHT", -6, -4)
|
|
r.rank:SetJustifyH("RIGHT")
|
|
r.sub = r:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
r.sub:SetPoint("TOPLEFT", r.name, "BOTTOMLEFT", 0, -2)
|
|
r:SetScript("OnClick", function()
|
|
AA.profSel = this.prof
|
|
AA.RefreshManager()
|
|
end)
|
|
r:Hide()
|
|
AA.PS.rows[i] = r
|
|
end
|
|
|
|
AA.PR = CreateFrame("Frame", nil, AA.P)
|
|
AA.PR:SetPoint("TOPLEFT", AA.P, "TOPLEFT", 242, -84)
|
|
AA.PR:SetWidth(304)
|
|
AA.PR:SetHeight(300)
|
|
AA.SkinFrame(AA.PR, 0.5)
|
|
AA.PR:Hide()
|
|
AA.PR.title = AA.PR:CreateFontString(nil, "OVERLAY", "GameFontNormal")
|
|
AA.PR.title:SetPoint("TOPLEFT", AA.PR, "TOPLEFT", 10, -7)
|
|
AA.PR.note = AA.PR:CreateFontString(nil, "OVERLAY", "GameFontDisableSmall")
|
|
AA.PR.note:SetPoint("TOPRIGHT", AA.PR, "TOPRIGHT", -10, -9)
|
|
AA.PR.empty = AA.PR:CreateFontString(nil, "OVERLAY", "GameFontDisable")
|
|
AA.PR.empty:SetPoint("CENTER", AA.PR, "CENTER", 0, 0)
|
|
AA.PR.empty:SetWidth(240)
|
|
AA.PR.empty:Hide()
|
|
|
|
AA.recList, AA.recRows = {}, {}
|
|
AA.PR.sf = CreateFrame("ScrollFrame", "AdeAltsRecipeScroll", AA.PR, "FauxScrollFrameTemplate")
|
|
AA.PR.sf:SetPoint("TOPLEFT", AA.PR, "TOPLEFT", 0, -26)
|
|
AA.PR.sf:SetPoint("BOTTOMRIGHT", AA.PR, "BOTTOMRIGHT", -26, 4)
|
|
AA.PR.sf:SetScript("OnVerticalScroll", function() FauxScrollFrame_OnVerticalScroll(AA.RROWH, AA.UpdateRecipes) end)
|
|
AA.PR:EnableMouseWheel(true)
|
|
AA.PR:SetScript("OnMouseWheel", function() AA.ScrollWheel(AA.PR.sf, AA.RROWH) end)
|
|
|
|
function AA.MakeRecRow()
|
|
local r = CreateFrame("Button", nil, AA.PR)
|
|
r:SetHeight(AA.RROWH - 2)
|
|
r.text = r:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
|
|
r.text:SetPoint("LEFT", r, "LEFT", 2, 0)
|
|
r.text:SetJustifyH("LEFT")
|
|
r:EnableMouseWheel(true)
|
|
r:SetScript("OnMouseWheel", function() AA.ScrollWheel(AA.PR.sf, AA.RROWH) end)
|
|
r:Hide()
|
|
table.insert(AA.recRows, r)
|
|
end
|
|
|
|
AA.UpdateRecipes = function()
|
|
FauxScrollFrame_Update(AA.PR.sf, table.getn(AA.recList), AA.RROWS, AA.RROWH)
|
|
local off = FauxScrollFrame_GetOffset(AA.PR.sf)
|
|
for i = 1, table.getn(AA.recRows) do
|
|
local r = AA.recRows[i]
|
|
local name = nil
|
|
if i <= AA.RROWS then name = AA.recList[off + i] end
|
|
if name then
|
|
r.text:SetText(name)
|
|
r:Show()
|
|
else
|
|
r:Hide()
|
|
end
|
|
end
|
|
end
|
|
|