- re-order button internals, should be easier to apply skins to now.

- will flush all keybindings made with keyBound (yeah branch and all :P run s/BT4Button([^:]+):/BT4Button\1Secure:/ on your bindings cache :p )
This commit is contained in:
Hendrik Leppkes
2008-04-08 16:31:53 +00:00
parent e4510fbbb4
commit fa1419dc05
3 changed files with 43 additions and 49 deletions
+1 -1
View File
@@ -190,7 +190,7 @@ function BT4ActionBars:ReassignBindings()
local frame = self.actionbars[1]
ClearOverrideBindings(frame)
for i = 1,min(#frame.buttons, 12) do
local button, real_button = ("ACTIONBUTTON%d"):format(i), ("BT4Button%d"):format(i)
local button, real_button = ("ACTIONBUTTON%d"):format(i), ("BT4Button%dSecure"):format(i)
for k=1, select('#', GetBindingKey(button)) do
local key = select(k, GetBindingKey(button))
SetOverrideBindingClick(frame, false, key, real_button)
+40 -42
View File
@@ -20,12 +20,42 @@ Bartender4.Button.prototype = Button
function Bartender4.Button:Create(id, parent)
local absid = (parent.id - 1) * 12 + id
local name = ("BT4Button%d"):format(absid)
local button = setmetatable(CreateFrame("CheckButton", name, parent, "SecureActionButtonTemplate, ActionButtonTemplate"), Button_MT)
local button = setmetatable(CreateFrame("CheckButton", name.."Secure", parent, "SecureActionButtonTemplate"), Button_MT)
button.rid = id
button.id = absid
button.parent = parent
button.settings = parent.module.db
button:SetFrameStrata("MEDIUM")
button:SetWidth(36)
button:SetHeight(36)
button:SetPushedTexture("Interface\\Buttons\\UI-Quickslot-Depress")
button:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square")
button:GetHighlightTexture():SetBlendMode("ADD")
button:SetCheckedTexture("Interface\\Buttons\\CheckButtonHilight")
button:GetCheckedTexture():SetBlendMode("ADD")
button:SetNormalTexture("")
button.Proxy = CreateFrame("CheckButton", name, button, "ActionButtonTemplate")
button.Proxy:SetFrameStrata("LOW")
button.Proxy:ClearAllPoints()
button.Proxy:SetAllPoints(button)
button.Proxy:SetPushedTexture("")
button.Proxy:SetHighlightTexture("")
button.Proxy:SetCheckedTexture("")
local NormalTexture = button.Proxy:GetNormalTexture()
NormalTexture:SetWidth(66)
NormalTexture:SetHeight(66)
NormalTexture:ClearAllPoints()
NormalTexture:SetPoint("CENTER", 0, -1)
NormalTexture:Show()
button.normalTexture = NormalTexture
button.pushedTexture = button:GetPushedTexture()
button.highlightTexture = button:GetHighlightTexture()
button:SetScript("OnEvent", button.EventHandler)
button:SetScript("OnUpdate", onUpdate)
button:SetScript("OnEnter", onEnter)
@@ -44,23 +74,6 @@ function Bartender4.Button:Create(id, parent)
button.flash = _G[("%sFlash"):format(name)]
button.flash:Hide()
--button:SetNormalTexture("")
--local realNormalTexture = _G[("%sNormalTexture"):format(name)]
--button.normalTexture = button:CreateTexture(("%sBT4NormalTexture"):format(name))
--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.pushedTexture = button:GetPushedTexture()
button.highlightTexture = button:GetHighlightTexture()
button.textureCache = {}
button.textureCache.pushed = button.pushedTexture:GetTexture()
button.textureCache.highlight = button.highlightTexture:GetTexture()
@@ -192,15 +205,12 @@ function Button:Update()
else
self:UnregisterActionEvents()
if ( self.showgrid == 0 and not self.parent.config.showgrid ) then
self.normalTexture:Hide()
else
self.normalTexture:Show()
end
self.cooldown:Hide()
self:HideButton()
if ( self.showgrid == 0 and not self.parent.config.showgrid ) then
self:HideButton()
end
self:SetScript("OnUpdate", nil)
end
@@ -237,8 +247,8 @@ function Button:UpdateIcon()
self.icon:Hide()
self.cooldown:Hide()
self.normalTexture:SetTexture("Interface\\Buttons\\UI-Quickslot")
self.hotkey:SetVertexColor(0.6, 0.6, 0.6)
self.normalTexture:SetTexCoord(-0.1, 1.1, -0.1, 1.12)
self.hotkey:SetVertexColor(0.6, 0.6, 0.6)
self.iconTex = nil
end
end
@@ -390,42 +400,30 @@ 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)
if self.overlay then
self.overlay:Show()
end
self.Proxy:Show()
end
function Button:HideButton()
if self.overlay and self.overlay.type == "cy" then return end
self.pushedTexture:SetTexture("")
self.highlightTexture:SetTexture("")
if self.overlay then
self.overlay:Hide()
end
self.Proxy:Hide()
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
self:ShowButton()
end
function Button:HideGrid()
local button = self.frame
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
self.overlay:Hide()
end
self:HideButton()
end
end
+2 -6
View File
@@ -20,6 +20,7 @@ local styledata = {
padding = 3,
overlay = true,
FrameFunc = function(button)
button = button.Proxy or button
local name = button:GetName().."DreamLayout"
local frame = _G[name] or CreateFrame("Frame", name, button)
frame:ClearAllPoints()
@@ -46,11 +47,6 @@ function Bartender4.ButtonStyle.ApplyStyle(button, styleName)
if cy then
style = styledata.default
if button.overlay and button.overlay.type ~= "cy" then
button.overlay:Hide()
end
button.overlay = _G[button:GetName() .. "Overlay"]
button.overlay.type = "cy"
end
if style.overlay and style.FrameFunc then
@@ -59,7 +55,7 @@ function Bartender4.ButtonStyle.ApplyStyle(button, styleName)
button.overlay = style.FrameFunc(button)
end
else
if button.overlay and button.overlay.type ~= "cy" then
if button.overlay then
button.overlay:Hide()
button.overlay = nil
end