So I've got the following code to restyle the MicroMenu buttons, after I saw that Blizzard does a similar thing in
MainMenuBarMicroButtons.lua
Lua Code:
local MicroMenuButtons = {
CharacterMicroButton,
SpellbookMicroButton,
TalentMicroButton,
AchievementMicroButton,
QuestLogMicroButton,
GuildMicroButton,
LFDMicroButton,
CollectionsMicroButton,
EJMicroButton,
StoreMicroButton,
MainMenuMicroButton,
}
local MicroMenuFrame = CreateFrame("Frame","MicroMenuFrame",UIParent)
MicroMenuFrame:SetPoint("CENTER",UIParent,"CENTER")
MicroMenuFrame:SetSize(10,10)
local width = 25
local height = 25
local offset = 0
local path = "Interface\\AddOns\\TestUI\\media\\microbutton\\"
for i=1, #MicroMenuButtons do
local button = MicroMenuButtons[i]
local name = button:GetName()
print(name)
button:ClearAllPoints()
button:SetParent(MicroMenuFrame)
button:SetPoint("LEFT",MicroMenuFrame,"LEFT",offset,0)
button:SetSize(width,height)
button:SetHitRectInsets(0,0,0,0) -- Override the cropped click region
button:SetNormalTexture(path..name.."-Normal")
button:SetPushedTexture(path..name.."-Pushed")
button:SetDisabledTexture(path..name.."-Disabled")
button:SetHighlightTexture(path..name.."-Highlight")
offset = offset + width + 4
end
In my case, though, it crashes the client with a ACCESS_VIOLATION error. Whoopsie. I'm pretty positive it is because I'm using variables to generate part of the texture path, though I did a printout of what the generated texture path would be and it seemed okay. They do match up with the file location in the addon folder.
https://i.gyazo.com/1336c828da869c56...7c46542d88.png
Also, does anyone have any general tips on styling the micromenu? I've noticed the
MainMenuMicroButton resets to its standard textures upon login. I'm guessing it has to do with the fact that there's a StreamDL state it sometimes switches to, so I'd have to find and hook that function to override it? I'd like to avoid overriding the actual textures if I can, though I'm starting to that'd be waaaaaaaay easier than this. Either that or building the micromenu from scratch, but then I'd either have to rewrite the tooltip info or figure out how to reliably hook hold of it.