From 6adcf86b1ba4d9f17deb502c8a0e010171834508 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Mon, 3 Mar 2008 12:17:59 +0000 Subject: [PATCH] make button style work on the pet bar buttons, pretty much done now (short of hotkey display) --- PetBar.lua | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/PetBar.lua b/PetBar.lua index 439cb2e..211e799 100644 --- a/PetBar.lua +++ b/PetBar.lua @@ -74,6 +74,14 @@ function PetBarMod:CreatePetButton(id) button.autocastable = _G[name .. "AutoCastable"] button.autocast = _G[name .. "AutoCast"] + button.normalTexture = button:GetNormalTexture() + button.pushedTexture = button:GetPushedTexture() + button.highlightTexture = button:GetHighlightTexture() + + button.textureCache = {} + button.textureCache.pushed = button.pushedTexture:GetTexture() + button.textureCache.highlight = button.highlightTexture:GetTexture() + return button end @@ -126,19 +134,40 @@ function PetButtonPrototype:Update() SetDesaturation(self.icon, 1) end self.icon:Show() - self:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2") + self.normalTexture:SetTexture("Interface\\Buttons\\UI-Quickslot2") + self.normalTexture:SetTexCoord(0, 0, 0, 0) + self:ShowButton() else self.icon:Hide() - self:SetNormalTexture("Interface\\Buttons\\UI-Quickslot") + self.normalTexture:SetTexture("Interface\\Buttons\\UI-Quickslot") + self.normalTexture:SetTexCoord(-0.1, 1.1, -0.1, 1.12) + self:HideButton() end self:UpdateCooldown() end +function PetButtonPrototype:ShowButton() + if self.overlay then return end + + self.pushedTexture:SetTexture(self.textureCache.pushed) + self.highlightTexture:SetTexture(self.textureCache.highlight) +end + +function PetButtonPrototype:HideButton() + if self.overlay then return end + + self.pushedTexture:SetTexture("") + self.highlightTexture:SetTexture("") +end + function PetButtonPrototype:UpdateCooldown() local start, duration, enable = GetPetActionCooldown(self.id) CooldownFrame_SetTimer(self.cooldown, start, duration, enable) end +-- import style function +PetButtonPrototype.ApplyStyle = Bartender4.ButtonStyle.ApplyStyle + function PetButtonPrototype:ClearSetPoint(...) self:ClearAllPoints() self:SetPoint(...)