Game menu: a button an addon adds takes its own place in the column

The column laid out a fixed list of buttons, so the client's
MoonWellGraphics addon button (GameMenuButtonMoonWellGraphics, anchored
under UI Options) kept its own anchor and sat over Edit Mode. Any other
shown button of GameMenuFrame now joins the column after the button its
first anchor names, read when first seen, before the layout moves it;
one without a known anchor goes before Log Out.

Verified with an offline capture at 2560x1440, the button created as
the addon creates it: Options, MoonWell Graphics, Edit Mode, Support,
Macros, Interface Style, then the Log Out section, no overlap.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-10-21 17:49:29 +04:00
parent e1ddbf7614
commit 4c8aabd65e
@@ -3,8 +3,9 @@
-- section adds 20 above its first button), the DiamondMetal frame and header, the buttons as
-- 128-RedButton three-slices 200 x 36.
-- The client's buttons stay, in their order, with benilla's (Edit Mode, Support) and the
-- Interface Style rung (MoonWellUI\GameMenu.lua); the column is laid out on every show, after
-- their own layout.
-- Interface Style rung (MoonWellUI\GameMenu.lua); a button another layer or addon adds (the
-- client's MoonWellGraphics) takes the place it anchored itself to. The column is laid out on
-- every show, after their own layout.
if not MoonWellUI_IsForever() then
return
@@ -55,12 +56,41 @@ local function skinButton(b)
Tpl.PaintRed(b, false)
end
-- The known buttons, with each other shown button of the menu after the one its first anchor
-- names (read when first seen, before this layout moves it), else before Log Out
local function column()
local list = entries()
local known = {}
for _, e in ipairs(list) do
if e[1] then known[e[1]] = true end
end
for _, b in ipairs({ GameMenuFrame:GetChildren() }) do
if not known[b] and b:GetObjectType() == "Button" and b:IsShown() then
if b.foreverAfter == nil then
local _, relative = b:GetPoint(1)
b.foreverAfter = (type(relative) == "table" and relative) or false
end
local at
for i, e in ipairs(list) do
if e[1] == b.foreverAfter then
at = i + 1
elseif not at and e[1] == GameMenuButtonLogout then
at = i
end
end
table.insert(list, at or table.getn(list) + 1, { b })
known[b] = true
end
end
return list
end
-- each shown button in its place, then the menu's size
function M.Layout()
local f = GameMenuFrame
local y = N.top
local queued = false
for _, e in ipairs(entries()) do
for _, e in ipairs(column()) do
local b = e[1]
if e.section then
queued = true