From 3246f3a8a5948e0016dde931ccf5326f42f881c5 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Fri, 7 Mar 2008 10:18:42 +0000 Subject: [PATCH] improve button handling with overlays --- Button.lua | 49 ++++++++++++++++++++++++++----------------------- ButtonStyle.lua | 5 ++++- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/Button.lua b/Button.lua index ea53b2d..d64f09d 100644 --- a/Button.lua +++ b/Button.lua @@ -45,8 +45,13 @@ function Bartender4.Button:Create(id, parent) --button.normalTexture:SetAllPoints(realNormalTexture) --realNormalTexture:Hide() + button:SetNormalTexture("") + local oldNT = _G[("%sNormalTexture"):format(name)] + oldNT:Hide() + + button.normalTexture = button:CreateTexture(("%sBTNormalTexture"):format(name)) + button.normalTexture:SetAllPoints(oldNT) - button.normalTexture = button:GetNormalTexture() -- _G[("%sNormalTexture"):format(name)] button.pushedTexture = button:GetPushedTexture() button.highlightTexture = button:GetHighlightTexture() @@ -177,14 +182,8 @@ function Button:Update() if ( self.showgrid == 0 and not self.parent.config.showgrid ) then self.normalTexture:Hide() - if self.overlay then - self.overlay:Hide() - end else self.normalTexture:Show() - if self.overlay then - self.overlay:Show() - end end self.cooldown:Hide() @@ -319,31 +318,35 @@ function Button:SetTooltip() end function Button:ShowButton() - if self.overlay then return end - self.pushedTexture:SetTexture(self.textureCache.pushed) self.highlightTexture:SetTexture(self.textureCache.highlight) -end - -function Button:HideButton() - if self.overlay then return end - - self.pushedTexture:SetTexture("") - self.highlightTexture:SetTexture("") -end - -function Button:ShowGrid(override) - if not override then self.showgrid = self.showgrid+1 end - self.normalTexture:Show() if self.overlay then self.overlay:Show() end end -function Button:HideGrid(override) +function Button:HideButton() + self.pushedTexture:SetTexture("") + self.highlightTexture:SetTexture("") + + if self.overlay then + self.overlay:Hide() + end +end + +function Button:ShowGrid() + self.showgrid = self.showgrid + 1 + self.normalTexture:Show() + + if self.overlay and not self.overlay.hidegrid then + self.overlay:Show() + end +end + +function Button:HideGrid() local button = self.frame - if not override then self.showgrid = self.showgrid-1 end + if self.showgrid > 0 then self.showgrid = self.showgrid - 1 end if ( self.showgrid == 0 and not HasAction(self.action) and not self.parent.config.showgrid ) then self.normalTexture:Hide() if self.overlay then diff --git a/ButtonStyle.lua b/ButtonStyle.lua index f6f789b..a6feb77 100644 --- a/ButtonStyle.lua +++ b/ButtonStyle.lua @@ -14,7 +14,7 @@ local styles = { local styledata = { ["default"] = {}, - ["zoom"] = { texCoord = {0.06, 0.94, 0.06, 0.94} }, + ["zoom"] = { texCoord = {0.07, 0.93, 0.07, 0.93} }, ["dream"] = { texCoord = {0.08,0.92,0.08,0.92}, padding = 3, @@ -27,6 +27,9 @@ local styledata = { frame:SetBackdropColor(0, 0, 0, 0.6) frame:SetAllPoints(button) frame:SetFrameLevel(button:GetFrameLevel() - 2) + frame:Show() + frame.type = "dream" + frame.hidegrid = true return frame end, },