MicroMenu now uses the default ButtonBar template, which enables it to use full Row control
This commit is contained in:
+12
-26
@@ -3,10 +3,10 @@ local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
|
||||
local MicroMenuMod = Bartender4:NewModule("MicroMenu", "AceHook-3.0")
|
||||
|
||||
-- fetch upvalues
|
||||
local Bar = Bartender4.Bar.prototype
|
||||
local ButtonBar = Bartender4.ButtonBar.prototype
|
||||
|
||||
-- create prototype information
|
||||
local MicroMenuBar = setmetatable({}, {__index = Bar})
|
||||
local MicroMenuBar = setmetatable({}, {__index = ButtonBar})
|
||||
|
||||
local table_insert = table.insert
|
||||
|
||||
@@ -16,7 +16,7 @@ local defaults = { profile = Bartender4:Merge({
|
||||
visibility = {
|
||||
possess = false,
|
||||
},
|
||||
}, Bartender4.Bar.defaults) }
|
||||
}, Bartender4.ButtonBar.defaults) }
|
||||
|
||||
function MicroMenuMod:OnInitialize()
|
||||
self.db = Bartender4.db:RegisterNamespace("MicroMenu", defaults)
|
||||
@@ -27,7 +27,7 @@ local noopFunc = function() end
|
||||
|
||||
function MicroMenuMod:OnEnable()
|
||||
if not self.bar then
|
||||
self.bar = setmetatable(Bartender4.Bar:Create("MicroMenu", self.db.profile, L["Micro Menu"]), {__index = MicroMenuBar})
|
||||
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)
|
||||
@@ -41,6 +41,8 @@ function MicroMenuMod:OnEnable()
|
||||
table_insert(buttons, HelpMicroButton)
|
||||
self.bar.buttons = buttons
|
||||
|
||||
MicroMenuMod.button_count = #buttons
|
||||
|
||||
self:RawHook("UpdateTalentButton", noopFunc, true)
|
||||
self:RawHook("AchievementMicroButton_Update", noopFunc, true)
|
||||
|
||||
@@ -48,6 +50,7 @@ function MicroMenuMod:OnEnable()
|
||||
v:SetParent(self.bar)
|
||||
v:Show()
|
||||
v:SetFrameLevel(self.bar:GetFrameLevel() + 1)
|
||||
v.ClearSetPoint = self.bar.ClearSetPoint
|
||||
end
|
||||
|
||||
self.bar:SetPoint("CENTER", -105, 27)
|
||||
@@ -61,27 +64,10 @@ 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)
|
||||
Bar.ApplyConfig(self, config)
|
||||
self:PerformLayout()
|
||||
end
|
||||
|
||||
function MicroMenuBar:PerformLayout()
|
||||
if self.config.vertical then
|
||||
self:SetSize(35, 377)
|
||||
self.buttons[1]:ClearAllPoints()
|
||||
self.buttons[1]:SetPoint("TOPLEFT", self, "TOPLEFT", 5, 18)
|
||||
for i = 2, #self.buttons do
|
||||
self.buttons[i]:ClearAllPoints()
|
||||
self.buttons[i]:SetPoint("TOPLEFT", self.buttons[i-1], "BOTTOMLEFT", 0, 21)
|
||||
end
|
||||
else
|
||||
self:SetSize(252, 45)
|
||||
self.buttons[1]:ClearAllPoints()
|
||||
self.buttons[1]:SetPoint("TOPLEFT", self, "TOPLEFT", 5, 18)
|
||||
for i = 2, #self.buttons do
|
||||
self.buttons[i]:ClearAllPoints()
|
||||
self.buttons[i]:SetPoint("TOPLEFT", self.buttons[i-1], "TOPRIGHT", -4, 0)
|
||||
end
|
||||
end
|
||||
ButtonBar.ApplyConfig(self, config)
|
||||
self:UpdateButtonLayout()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user