diff --git a/Bartender4.toc b/Bartender4.toc index eb314aa..77eb889 100644 --- a/Bartender4.toc +++ b/Bartender4.toc @@ -64,6 +64,7 @@ StanceBar.lua MicroMenu.lua RepXPBar.lua VehicleBar.lua +MultiCastBar.lua ## Options ## Options\Options.xml diff --git a/MultiCastBar.lua b/MultiCastBar.lua new file mode 100644 index 0000000..c69d27b --- /dev/null +++ b/MultiCastBar.lua @@ -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 diff --git a/Options/MultiCastBar.lua b/Options/MultiCastBar.lua new file mode 100644 index 0000000..ce0d9c1 --- /dev/null +++ b/Options/MultiCastBar.lua @@ -0,0 +1,46 @@ +--[[ + Copyright (c) 2009, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com > + All rights reserved. +]] +-- fetch upvalues +local L = LibStub("AceLocale-3.0"):GetLocale("Bartender4") +local Bar = Bartender4.Bar.prototype + +local MultiCastMod = Bartender4:GetModule("MultiCast") + +function MultiCastMod:SetupOptions() + if not self.options then + self.optionobject = Bar:GetOptionObject() + local enabled = { + type = "toggle", + order = 1, + name = L["Enabled"], + desc = L["Enable the Totem Bar"], + get = function() return self.db.profile.enabled end, + set = "ToggleModule", + handler = self, + } + self.optionobject:AddElement("general", "enabled", enabled) + + self.disabledoptions = { + general = { + type = "group", + name = L["General Settings"], + cmdInline = true, + order = 1, + args = { + enabled = enabled, + } + } + } + self.options = { + order = 100, + type = "group", + name = L["Totem Bar"], + desc = L["Configure the Totem Bar"], + childGroups = "tab", + } + Bartender4:RegisterBarOptions("MultiCast", self.options) + end + self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions +end diff --git a/Options/Options.xml b/Options/Options.xml index 1319c22..cea6e7c 100644 --- a/Options/Options.xml +++ b/Options/Options.xml @@ -15,4 +15,5 @@