generated from Exiles/coa-template
4a65f00aca
release / release (push) Successful in 3s
Upstream Mapster relies on the CurseForge packager to fetch its libs at release time; the raw repo has no Libs/ folder, so the freshly- imported addon failed to load (LibStub missing). - Vendored canonical Ace3 from coa-ace3 (11 libs Mapster's TOC loads: LibStub, CallbackHandler-1.0, AceAddon-3.0, AceEvent-3.0, AceHook-3.0, AceDB-3.0, AceDBOptions-3.0, AceLocale-3.0, AceGUI-3.0, AceConsole-3.0, AceConfig-3.0). This brings the CoA-compat FileDataID / BlizOptionsGroup parent-guard / Settings.* fallback / AceDB falsy-defaults patches. - LibBabble-Zone-3.0 and LibWindow-1.1 vendored from the working PTR install (not part of Ace3). - TOC: replaced @project-version@ CurseForge placeholder with the real release string 1.3.9-coa.2 so the in-game About panel reads correctly. Mapster source itself was clean against the PORTING.md checklist (no FDID calls, no retail-only globals, no Minimap mask trap, no CLEU arg mismatch) — expected, since 1.3.9 was the WotLK-era release.
79 lines
2.2 KiB
Lua
79 lines
2.2 KiB
Lua
--[[-----------------------------------------------------------------------------
|
|
Heading Widget
|
|
-------------------------------------------------------------------------------]]
|
|
local Type, Version = "Heading", 20
|
|
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
|
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
|
|
|
-- Lua APIs
|
|
local pairs = pairs
|
|
|
|
-- WoW APIs
|
|
local CreateFrame, UIParent = CreateFrame, UIParent
|
|
|
|
--[[-----------------------------------------------------------------------------
|
|
Methods
|
|
-------------------------------------------------------------------------------]]
|
|
local methods = {
|
|
["OnAcquire"] = function(self)
|
|
self:SetText()
|
|
self:SetFullWidth()
|
|
self:SetHeight(18)
|
|
end,
|
|
|
|
-- ["OnRelease"] = nil,
|
|
|
|
["SetText"] = function(self, text)
|
|
self.label:SetText(text or "")
|
|
if text and text ~= "" then
|
|
self.left:SetPoint("RIGHT", self.label, "LEFT", -5, 0)
|
|
self.right:Show()
|
|
else
|
|
self.left:SetPoint("RIGHT", -3, 0)
|
|
self.right:Hide()
|
|
end
|
|
end
|
|
}
|
|
|
|
--[[-----------------------------------------------------------------------------
|
|
Constructor
|
|
-------------------------------------------------------------------------------]]
|
|
local function Constructor()
|
|
local frame = CreateFrame("Frame", nil, UIParent)
|
|
frame:Hide()
|
|
|
|
local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
|
|
label:SetPoint("TOP")
|
|
label:SetPoint("BOTTOM")
|
|
label:SetJustifyH("CENTER")
|
|
|
|
local left = frame:CreateTexture(nil, "BACKGROUND")
|
|
left:SetHeight(8)
|
|
left:SetPoint("LEFT", 3, 0)
|
|
left:SetPoint("RIGHT", label, "LEFT", -5, 0)
|
|
left:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
|
|
left:SetTexCoord(0.81, 0.94, 0.5, 1)
|
|
|
|
local right = frame:CreateTexture(nil, "BACKGROUND")
|
|
right:SetHeight(8)
|
|
right:SetPoint("RIGHT", -3, 0)
|
|
right:SetPoint("LEFT", label, "RIGHT", 5, 0)
|
|
right:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
|
|
right:SetTexCoord(0.81, 0.94, 0.5, 1)
|
|
|
|
local widget = {
|
|
label = label,
|
|
left = left,
|
|
right = right,
|
|
frame = frame,
|
|
type = Type
|
|
}
|
|
for method, func in pairs(methods) do
|
|
widget[method] = func
|
|
end
|
|
|
|
return AceGUI:RegisterAsWidget(widget)
|
|
end
|
|
|
|
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|