Files
coa-ace3/AceGUI-3.0/widgets/AceGUIContainer-BlizOptionsGroup.lua
T
florian.berthold 3ec2009f54 fix(compat): guard retail-only InterfaceOptions globals and Settings.* API
AceGUI-3.0/widgets/AceGUIContainer-BlizOptionsGroup.lua: the Constructor
parented its frame to the global InterfaceOptionsFramePanelContainer, which
is nil at AceGUI widget-construction time on the CoA reworked FrameXML.
Guard with 'local _parent = InterfaceOptionsFramePanelContainer or UIParent'
and pass _parent to CreateFrame so addons that register a Blizzard Interface
Options panel don't error out during load.

AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua: :AddToBlizOptions
used the Dragonflight+ Settings.* API (GetCategory, RegisterCanvasLayoutCategory,
RegisterCanvasLayoutSubcategory, RegisterAddOnCategory). The Settings table
doesn't exist on the 3.3.5-based CoA client, so every AceConfig-driven options
panel errored the moment it was registered. Wrap the whole Settings.* block in
'if Settings and Settings.GetCategory then ... else ... end' and fall back to
the WotLK-era InterfaceOptions_AddCategory(group.frame) after stamping the
category name via group:SetName(name or appName, parent).

Both retail and CoA paths now work; behaviour on retail is unchanged. luac -p
passes on both files. README CoA-compat patches table updated (entries 2 and 3).

This bundle is the source-of-truth for the Exiles/coa-* forks; the propagation
to bartender / quartz / shadowedunitframes / ai-voiceover / etc. bundled Ace
copies is handled separately.
2026-05-24 17:38:30 +02:00

148 lines
4.0 KiB
Lua

--[[-----------------------------------------------------------------------------
BlizOptionsGroup Container
Simple container widget for the integration of AceGUI into the Blizzard Interface Options
-------------------------------------------------------------------------------]]
local Type, Version = "BlizOptionsGroup", 26
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 = CreateFrame
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function OnShow(frame)
frame.obj:Fire("OnShow")
end
local function OnHide(frame)
frame.obj:Fire("OnHide")
end
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
local function okay(frame)
frame.obj:Fire("okay")
end
local function cancel(frame)
frame.obj:Fire("cancel")
end
local function default(frame)
frame.obj:Fire("default")
end
local function refresh(frame)
frame.obj:Fire("refresh")
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
self:SetName()
self:SetTitle()
end,
-- ["OnRelease"] = nil,
["OnWidthSet"] = function(self, width)
local content = self.content
local contentwidth = width - 63
if contentwidth < 0 then
contentwidth = 0
end
content:SetWidth(contentwidth)
content.width = contentwidth
end,
["OnHeightSet"] = function(self, height)
local content = self.content
local contentheight = height - 26
if contentheight < 0 then
contentheight = 0
end
content:SetHeight(contentheight)
content.height = contentheight
end,
["SetName"] = function(self, name, parent)
self.frame.name = name
self.frame.parent = parent
end,
["SetTitle"] = function(self, title)
local content = self.content
content:ClearAllPoints()
if not title or title == "" then
content:SetPoint("TOPLEFT", 10, -10)
self.label:SetText("")
else
content:SetPoint("TOPLEFT", 10, -40)
self.label:SetText(title)
end
content:SetPoint("BOTTOMRIGHT", -10, 10)
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
-- CoA-compat: InterfaceOptionsFramePanelContainer is a global from the stock 3.3.5
-- Interface Options frame; on the CoA reworked FrameXML it can be nil at the time
-- AceGUI widgets are constructed. Fall back to UIParent so CreateFrame doesn't blow up.
local _parent = InterfaceOptionsFramePanelContainer or UIParent
local frame = CreateFrame("Frame", nil, _parent)
frame:Hide()
-- support functions for the Blizzard Interface Options
frame.okay = okay
frame.cancel = cancel
frame.default = default
frame.refresh = refresh
-- 10.0 support function aliases (cancel has been removed)
frame.OnCommit = okay
frame.OnDefault = default
frame.OnRefresh = refresh
frame:SetScript("OnHide", OnHide)
frame:SetScript("OnShow", OnShow)
local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalLarge")
label:SetPoint("TOPLEFT", 10, -15)
label:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", 10, -45)
label:SetJustifyH("LEFT")
label:SetJustifyV("TOP")
--Container Support
local content = CreateFrame("Frame", nil, frame)
content:SetPoint("TOPLEFT", 10, -10)
content:SetPoint("BOTTOMRIGHT", -10, 10)
local widget = {
label = label,
frame = frame,
content = content,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsContainer(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)