diff --git a/vanilla/Interface/FrameXML/MoonWellUI/Forever/GameMenu.lua b/vanilla/Interface/FrameXML/MoonWellUI/Forever/GameMenu.lua index ed7ff85..b079c22 100644 --- a/vanilla/Interface/FrameXML/MoonWellUI/Forever/GameMenu.lua +++ b/vanilla/Interface/FrameXML/MoonWellUI/Forever/GameMenu.lua @@ -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