Initial implementation of the MultiCastBar (TotemBar)

This commit is contained in:
Hendrik Leppkes
2009-06-27 17:39:18 +02:00
parent 9aff89fac5
commit 4eda77cd4f
4 changed files with 106 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
--[[
Copyright (c) 2009, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com >
All rights reserved.
]]
local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4")
-- fetch upvalues
local Bar = Bartender4.Bar.prototype
local table_insert = table.insert
local defaults = { profile = Bartender4:Merge({
enabled = true,
}, Bartender4.Bar.defaults) }
-- register module
local MultiCastMod = Bartender4:NewModule("MultiCast")
-- create prototype information
local MultiCastBar = setmetatable({}, {__index = Bar})
function MultiCastMod:OnInitialize()
self.db = Bartender4.db:RegisterNamespace("MultiCast", defaults)
self:SetEnabledState(self.db.profile.enabled)
end
function MultiCastMod:OnEnable()
if not self.bar then
self.bar = setmetatable(Bartender4.Bar:Create("MultiCast", self.db.profile, L["Totem Bar"]), {__index = MultiCastBar})
self.bar.content = MultiCastActionBarFrame
self.bar.content:SetScript("OnShow", nil)
self.bar.content:SetScript("OnHide", nil)
self.bar.content:SetParent(self.bar)
self.bar.content:Show()
self.bar.content:SetFrameLevel(self.bar:GetFrameLevel() + 1)
end
self.bar:Enable()
self:ToggleOptions()
self:ApplyConfig()
end
function MultiCastMod:ApplyConfig()
self.bar:ApplyConfig(self.db.profile)
end
function MultiCastBar:ApplyConfig(config)
Bar.ApplyConfig(self, config)
self:PerformLayout()
end
function MultiCastBar:PerformLayout()
self:SetSize(240, 43)
local bar = self.content
bar:ClearAllPoints()
bar:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 0)
end