From a1189dbad8071433378a1c726988cfe98cdbcf7f Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Sat, 21 Feb 2009 14:58:17 +0100 Subject: [PATCH] Added options to adjust the vertical and horizontal growth direction --- Bar.lua | 10 +++++++--- ButtonBar.lua | 21 +++++++++++++++++++++ Options/ButtonBar.lua | 20 ++++++++++++++++++++ 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/Bar.lua b/Bar.lua index a1ec1f3..9fabbef 100644 --- a/Bar.lua +++ b/Bar.lua @@ -147,9 +147,7 @@ function Bartender4.Bar:Create(id, config, name) overlay:SetScript("OnClick", barOnClick) overlay:SetFrameLevel(bar:GetFrameLevel() + 10) - overlay:ClearAllPoints() - local anchor = bar:GetAnchor() - overlay:SetPoint(anchor, bar, anchor) + bar:AnchorOverlay() overlay:Hide() bar.elapsed = 0 @@ -200,6 +198,12 @@ function Bar:GetAnchor() return ((self.config.position.growVertical == "DOWN") and "TOP" or "BOTTOM") .. ((self.config.position.growHorizontal == "RIGHT") and "LEFT" or "RIGHT") end +function Bar:AnchorOverlay() + self.overlay:ClearAllPoints() + local anchor = self:GetAnchor() + self.overlay:SetPoint(anchor, self, anchor) +end + function Bar:UpgradeConfig() local version = self.config.version or 1 if version < 2 then diff --git a/ButtonBar.lua b/ButtonBar.lua index aa63b99..dc70594 100644 --- a/ButtonBar.lua +++ b/ButtonBar.lua @@ -119,6 +119,27 @@ function ButtonBar:GetHideHotkey() return self.config.hidehotkey end +function ButtonBar:SetHGrowth(value) + self.config.position.growHorizontal = value + self:AnchorOverlay() + self:UpdateButtonLayout() +end + +function ButtonBar:GetHGrowth() + return self.config.position.growHorizontal +end + +function ButtonBar:SetVGrowth(value) + self.config.position.growVertical = value + self:AnchorOverlay() + self:UpdateButtonLayout() +end + +function ButtonBar:GetVGrowth() + return self.config.position.growVertical +end + + ButtonBar.ClickThroughSupport = true function ButtonBar:SetClickThrough(click) if click ~= nil then diff --git a/Options/ButtonBar.lua b/Options/ButtonBar.lua index 4fdd6b6..5bbd507 100644 --- a/Options/ButtonBar.lua +++ b/Options/ButtonBar.lua @@ -19,6 +19,8 @@ do zoom = "Zoom", macrotext = "HideMacroText", hotkey = "HideHotkey", + vgrowth = "VGrowth", + hgrowth = "HGrowth", } -- retrieves a valid bar object from the barregistry table @@ -80,6 +82,24 @@ function ButtonBar:GetOptionObject() set = optSetter, get = optGetter, }, + vgrowth = { + order = 75, + name = L["Vertical Growth"], + desc = L["Vertical growth direction for this bar."], + type = "select", + values = {UP = L["Up"], DOWN = L["Down"]}, + set = optSetter, + get = optGetter, + }, + hgrowth = { + order = 76, + name = L["Horizontal Growth"], + desc = L["Horizontal growth direction for this bar."], + type = "select", + values = {LEFT = L["Left"], RIGHT = L["Right"]}, + set = optSetter, + get = optGetter, + }, hidedesc = { order = 80, name = L["Button Look"],