I discovered the MultiActionBar backgrounds are generated using the following XML code.
XML Code:
<CheckButton name="MultiBarButtonTemplate" virtual="true" inherits="ActionBarButtonTemplate">
<Layers>
<Layer level="BACKGROUND" textureSubLevel="-1">
<Texture name="$parentFloatingBG" file="Interface\Buttons\UI-Quickslot" alpha="0.4">
<Anchors>
<Anchor point="TOPLEFT" x="-15" y="15"/>
<Anchor point="BOTTOMRIGHT" x="15" y="-15"/>
</Anchors>
</Texture>
</Layer>
</Layers>
</CheckButton>
I used this to generate the following Lua code.
Lua Code:
-- Hide the MainMenuBar textures
MainMenuBarTexture0:Hide();
MainMenuBarTexture1:Hide();
-- Generate the backgrounds as needed
for i=1,NUM_ACTIONBAR_BUTTONS do
local bg=_G["ActionButton"..i]:CreateTexture("$parentFloatingBG","BACKGROUND");
bg:SetDrawLayer("BACKGROUND",-1);-- For some strange reason, we can't set sublevel in button:CreateTexture()
bg:SetPoint("TOPLEFT",-15,15);
bg:SetPoint("BOTTOMRIGHT",15,-15);
bg:SetTexture("Interface\\Buttons\\UI-Quickslot");
bg:SetAlpha(0.4);
end
-- Helper function to show/hide the main ActionBar
local function UpdateButtons(show)
-- Can't show/hide buttons while in combat from insecure code, so don't try to
if InCombatLockdown() then return; end
for i=1,NUM_ACTIONBAR_BUTTONS do
-- We need to set the attribute ourselves since the show/hide grid functions won't do it from insecure code
local btn=_G["ActionButton"..i];
btn:SetAttribute("showgrid",math.max(btn:GetAttribute("showgrid")+(show and 1 or -1),0));
_G[show and "ActionButton_ShowGrid" or "ActionButton_HideGrid"](btn);
end
end
-- Hooks to our helper function
hooksecurefunc("MultiActionBar_ShowAllGrids",function() UpdateButtons(true); end);
hooksecurefunc("MultiActionBar_HideAllGrids",function() UpdateButtons(false); end);
I had some trouble with getting the ActionButtons to behave like the MultiActionBars. This is mostly because the Blizzard functions needed don't like to be called from insecure code.