74 lines
2.1 KiB
Lua
74 lines
2.1 KiB
Lua
local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
|
|
-- register module
|
|
local MicroMenuMod = Bartender4:NewModule("MicroMenu", "AceHook-3.0")
|
|
|
|
-- fetch upvalues
|
|
local ButtonBar = Bartender4.ButtonBar.prototype
|
|
|
|
-- create prototype information
|
|
local MicroMenuBar = setmetatable({}, {__index = ButtonBar})
|
|
|
|
local table_insert = table.insert
|
|
|
|
local defaults = { profile = Bartender4:Merge({
|
|
enabled = true,
|
|
vertical = false,
|
|
visibility = {
|
|
possess = false,
|
|
},
|
|
}, Bartender4.ButtonBar.defaults) }
|
|
|
|
function MicroMenuMod:OnInitialize()
|
|
self.db = Bartender4.db:RegisterNamespace("MicroMenu", defaults)
|
|
self:SetEnabledState(self.db.profile.enabled)
|
|
end
|
|
|
|
local noopFunc = function() end
|
|
|
|
function MicroMenuMod:OnEnable()
|
|
if not self.bar then
|
|
self.bar = setmetatable(Bartender4.ButtonBar:Create("MicroMenu", self.db.profile, L["Micro Menu"]), {__index = MicroMenuBar})
|
|
local buttons = {}
|
|
table_insert(buttons, CharacterMicroButton)
|
|
table_insert(buttons, SpellbookMicroButton)
|
|
table_insert(buttons, TalentMicroButton)
|
|
table_insert(buttons, AchievementMicroButton)
|
|
table_insert(buttons, QuestLogMicroButton)
|
|
table_insert(buttons, SocialsMicroButton)
|
|
table_insert(buttons, PVPMicroButton)
|
|
table_insert(buttons, LFGMicroButton)
|
|
table_insert(buttons, MainMenuMicroButton)
|
|
table_insert(buttons, HelpMicroButton)
|
|
self.bar.buttons = buttons
|
|
|
|
MicroMenuMod.button_count = #buttons
|
|
|
|
self:RawHook("UpdateTalentButton", noopFunc, true)
|
|
self:RawHook("AchievementMicroButton_Update", noopFunc, true)
|
|
|
|
for i,v in pairs(buttons) do
|
|
v:SetParent(self.bar)
|
|
v:Show()
|
|
v:SetFrameLevel(self.bar:GetFrameLevel() + 1)
|
|
v.ClearSetPoint = self.bar.ClearSetPoint
|
|
end
|
|
|
|
self.bar:SetPoint("CENTER", -105, 27)
|
|
end
|
|
self.bar:Enable()
|
|
self:ToggleOptions()
|
|
self.bar:ApplyConfig(self.db.profile)
|
|
end
|
|
|
|
function MicroMenuMod:ApplyConfig()
|
|
self.bar:ApplyConfig(self.db.profile)
|
|
end
|
|
|
|
MicroMenuBar.button_width = 28
|
|
MicroMenuBar.button_height = 58
|
|
MicroMenuBar.vpad_offset = -21
|
|
function MicroMenuBar:ApplyConfig(config)
|
|
ButtonBar.ApplyConfig(self, config)
|
|
self:UpdateButtonLayout()
|
|
end
|