Files
coa-mapster/Mapster/Libs/AceGUI-3.0/widgets/AceGUIWidget-InteractiveLabel.lua
florian.berthold 4a65f00aca
release / release (push) Successful in 3s
vendor: Libs/ from coa-ace3 + LibBabble-Zone / LibWindow; pin TOC version
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.
2026-05-25 13:11:21 +02:00

95 lines
2.5 KiB
Lua

--[[-----------------------------------------------------------------------------
InteractiveLabel Widget
-------------------------------------------------------------------------------]]
local Type, Version = "InteractiveLabel", 21
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 select, pairs = select, pairs
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function Control_OnEnter(frame)
frame.obj:Fire("OnEnter")
end
local function Control_OnLeave(frame)
frame.obj:Fire("OnLeave")
end
local function Label_OnClick(frame, button)
frame.obj:Fire("OnClick", button)
AceGUI:ClearFocus()
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:LabelOnAcquire()
self:SetHighlight()
self:SetHighlightTexCoord()
self:SetDisabled(false)
end,
-- ["OnRelease"] = nil,
["SetHighlight"] = function(self, ...)
self.highlight:SetTexture(...)
end,
["SetHighlightTexCoord"] = function(self, ...)
local c = select("#", ...)
if c == 4 or c == 8 then
self.highlight:SetTexCoord(...)
else
self.highlight:SetTexCoord(0, 1, 0, 1)
end
end,
["SetDisabled"] = function(self,disabled)
self.disabled = disabled
if disabled then
self.frame:EnableMouse(false)
self.label:SetTextColor(0.5, 0.5, 0.5)
else
self.frame:EnableMouse(true)
self.label:SetTextColor(1, 1, 1)
end
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
-- create a Label type that we will hijack
local label = AceGUI:Create("Label")
local frame = label.frame
frame:EnableMouse(true)
frame:SetScript("OnEnter", Control_OnEnter)
frame:SetScript("OnLeave", Control_OnLeave)
frame:SetScript("OnMouseDown", Label_OnClick)
local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
highlight:SetTexture(nil)
highlight:SetAllPoints()
highlight:SetBlendMode("ADD")
label.highlight = highlight
label.type = Type
label.LabelOnAcquire = label.OnAcquire
for method, func in pairs(methods) do
label[method] = func
end
return label
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)