57a5cdabdf
Imported from /srv/add01/wow-ascension/Interface/AddOns/Bartender4 — the build Ascension's WotLK 3.3.5 client ships. Single vendored drop: Ascension's build process bundles their custom patches with the standard CurseForge packager output (embedded libs), and the individual patches aren't published separately. Net delta vs Nevcairiel 4.4.2, excluding bundled libs and CRLF normalization: 21 files, 2213+/52- — the Ascension-specific adaptations for WotLK 3.3.5 hero classes / custom action systems. License: All rights reserved (per .toc).
99 lines
2.6 KiB
Lua
99 lines
2.6 KiB
Lua
--[[
|
|
Copyright (c) 2009, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
|
|
All rights reserved.
|
|
]]
|
|
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,
|
|
},
|
|
padding = -3,
|
|
position = {
|
|
scale = 0.8,
|
|
},
|
|
}, Bartender4.ButtonBar.defaults) }
|
|
|
|
function MicroMenuMod:OnInitialize()
|
|
self.db = Bartender4.db:RegisterNamespace("MicroMenu", defaults)
|
|
self:SetEnabledState(self.db.profile.enabled)
|
|
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, LFDMicroButton)
|
|
table_insert(buttons, PathToAscensionMicroButton)
|
|
table_insert(buttons, MainMenuMicroButton)
|
|
table_insert(buttons, HelpMicroButton)
|
|
table_insert(buttons, ChallengesMicroButton)
|
|
self.bar.buttons = buttons
|
|
|
|
MicroMenuMod.button_count = #buttons
|
|
|
|
self:SecureHook("UpdateMicroButtons")
|
|
|
|
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
|
|
end
|
|
self.bar:Enable()
|
|
self:ToggleOptions()
|
|
self:ApplyConfig()
|
|
end
|
|
|
|
function MicroMenuMod:ApplyConfig()
|
|
self.bar:ApplyConfig(self.db.profile)
|
|
end
|
|
|
|
function MicroMenuMod:RestoreButtons()
|
|
if not self:IsEnabled() then return end
|
|
for k,v in pairs(self.bar.buttons) do
|
|
v:SetParent(self.bar)
|
|
v:Show()
|
|
end
|
|
self.bar:UpdateButtonLayout()
|
|
end
|
|
|
|
function MicroMenuMod:UpdateMicroButtons()
|
|
if MainMenuBar.state == "player" then
|
|
self:RestoreButtons()
|
|
end
|
|
end
|
|
|
|
MicroMenuBar.button_width = 27
|
|
MicroMenuBar.button_height = 40
|
|
MicroMenuBar.vpad_offset = 0
|
|
function MicroMenuBar:ApplyConfig(config)
|
|
ButtonBar.ApplyConfig(self, config)
|
|
|
|
if not self.config.position.x then
|
|
self:ClearSetPoint("CENTER", -105, 30)
|
|
self:SavePosition()
|
|
end
|
|
|
|
self:UpdateButtonLayout()
|
|
end
|