From aa66d37a95019e3bd395de93efc8bcab91978407 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Thu, 21 Feb 2008 13:28:43 +0000 Subject: [PATCH] stub for a petbar - not worky yet --- Bartender4.toc | 1 + PetBar.lua | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++ StanceBar.lua | 7 ++++++- 3 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 PetBar.lua diff --git a/Bartender4.toc b/Bartender4.toc index a210056..8a7a1b1 100644 --- a/Bartender4.toc +++ b/Bartender4.toc @@ -26,3 +26,4 @@ ActionBars.lua ActionBarPrototype.lua ActionBarStates.lua StanceBar.lua +PetBar.lua diff --git a/PetBar.lua b/PetBar.lua new file mode 100644 index 0000000..d8a83d7 --- /dev/null +++ b/PetBar.lua @@ -0,0 +1,57 @@ +--[[ $Id: StanceBar.lua 61678 2008-02-17 01:37:33Z nevcairiel $ ]] + +-- register module +local PetBarMod = Bartender4:NewModule("PetBar") + +-- fetch upvalues +local ActionBars = Bartender4:GetModule("ActionBars") +local ButtonBar = Bartender4.ButtonBar.prototype + +-- create prototype information +local PetBar = setmetatable({}, {__index = ButtonBar}) +local PetButtonPrototype = CreateFrame("CheckButton") +local PetButton_MT = {__index = PetButtonPrototype} + +local defaults = { profile = Bartender4:Merge({ + enabled = true, + scale = 1.5, +}, Bartender4.ButtonBar.defaults) } + +function PetBarMod:OnInitialize() + self.db = Bartender4.db:RegisterNamespace("PetBar", defaults) + + self:SetupOptions() +end + +function PetBarMod:OnEnable() + if not self.bar then + self.bar = setmetatable(Bartender4.ButtonBar:Create("Pet", nil, self.db.profile), {__index = PetBar}) + + self.bar:ClearSetPoint("CENTER") + self.bar:ApplyConfig() + self.bar:SetScript("OnEvent", PetBar.OnEvent) + end +end + +function PetBarMod:OnDisable() + if not self.bar then return end + self.bar:UnregisterAllEvents() + self.bar:Hide() +end + +function PetBarMod:SetupOptions() + self.options = Bartender4.ButtonBar.prototype:GetOptionObject() + + ActionBars.options.args["pet"] = { + order = 30, + type = "group", + name = "Pet Bar", + desc = "Configure the Pet Bar", + childGroups = "tab", + } + ActionBars.options.args["stance"].args = self.options.table +end + +function PetBarMod:ApplyConfig() + self.bar:ApplyConfig(self.db.profile) +end diff --git a/StanceBar.lua b/StanceBar.lua index 3336e48..7f1ee08 100644 --- a/StanceBar.lua +++ b/StanceBar.lua @@ -1,8 +1,13 @@ --[[ $Id$ ]] +-- register module local StanceBarMod = Bartender4:NewModule("StanceBar") + +-- fetch upvalues local ActionBars = Bartender4:GetModule("ActionBars") local ButtonBar = Bartender4.ButtonBar.prototype + +-- create prototype information local StanceBar = setmetatable({}, {__index = ButtonBar}) local StanceButtonPrototype = CreateFrame("CheckButton") local StanceButton_MT = {__index = StanceButtonPrototype} @@ -20,7 +25,7 @@ end function StanceBarMod:OnEnable() if not self.bar then - self.bar = setmetatable(Bartender4.ButtonBar:Create("stance", nil, self.db.profile), {__index = StanceBar}) + self.bar = setmetatable(Bartender4.ButtonBar:Create("Stance", nil, self.db.profile), {__index = StanceBar}) self.bar:ClearSetPoint("CENTER") self.bar:ApplyConfig()