From f7845069b5ecc8dc8d52cdbf32839d8cb269cc58 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Tue, 11 Mar 2008 09:06:05 +0000 Subject: [PATCH] tweak style support --- ActionBarPrototype.lua | 2 +- Button.lua | 6 ++++-- ButtonBar.lua | 1 + ButtonStyle.lua | 6 +++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ActionBarPrototype.lua b/ActionBarPrototype.lua index 0a6b59c..ce41bc3 100644 --- a/ActionBarPrototype.lua +++ b/ActionBarPrototype.lua @@ -132,7 +132,6 @@ function ActionBar:ApplyConfig(config) self:UpdateButtons() self:UpdateStates() - self:ForAll("ApplyStyle", self.config.style) end -- Update the number of buttons in our bar, creating new ones if necessary @@ -154,6 +153,7 @@ function ActionBar:UpdateButtons(numbuttons) -- show active buttons for i = 1, numbuttons do buttons[i]:Show() + buttons[i]:ApplyStyle(self.config.style) buttons[i]:UpdateAction(true) end diff --git a/Button.lua b/Button.lua index fcc15ae..e292e33 100644 --- a/Button.lua +++ b/Button.lua @@ -84,8 +84,8 @@ function Bartender4.Button:Create(id, parent) button:RegisterButtonEvents() - button:Show() - button:UpdateAction(true) + --button:Show() + --button:UpdateAction(true) return button end @@ -390,6 +390,7 @@ function Button:SetTooltip() end function Button:ShowButton() + if self.overlay and self.overlay.type == "cy" then return end self.pushedTexture:SetTexture(self.textureCache.pushed) self.highlightTexture:SetTexture(self.textureCache.highlight) @@ -399,6 +400,7 @@ function Button:ShowButton() end function Button:HideButton() + if self.overlay and self.overlay.type == "cy" then return end self.pushedTexture:SetTexture("") self.highlightTexture:SetTexture("") diff --git a/ButtonBar.lua b/ButtonBar.lua index d3e1e88..9068893 100644 --- a/ButtonBar.lua +++ b/ButtonBar.lua @@ -192,6 +192,7 @@ end -- execute a member function on all buttons function ButtonBar:ForAll(method, ...) + if not self.buttons then return end for _, button in self:GetAll() do local func = button[method] if func then diff --git a/ButtonStyle.lua b/ButtonStyle.lua index 841aedb..2d21e8a 100644 --- a/ButtonStyle.lua +++ b/ButtonStyle.lua @@ -46,11 +46,11 @@ function Bartender4.ButtonStyle.ApplyStyle(button, styleName) if cy then style = styledata.default - if button.overlay and button.overlay.type ~= "cy" then + if button.overlay then button.overlay:Hide() - button.overlay = _G[button:GetName() .. "Overlay"] - button.overlay.type = "cy" end + button.overlay = _G[button:GetName() .. "Overlay"] + button.overlay.type = "cy" end if style.overlay and style.FrameFunc then