Support proper hotkeys and range coloring for the vehicle buttons.

This commit is contained in:
Hendrik Leppkes
2009-04-17 10:50:31 +02:00
parent fe0281fdb7
commit af8f18617d
2 changed files with 24 additions and 0 deletions
+1
View File
@@ -239,6 +239,7 @@ function onUpdate(self, elapsed)
end
end
end
Bartender4.Button.onUpdate = onUpdate
local function updateIcon(self)
if self.action then
+23
View File
@@ -197,6 +197,22 @@ function Bartender4:UpdateBlizzardVehicle()
]])
end
RegisterStateDriver(self.vehicleController, "vehicle", "[target=vehicle,exists,bonusbar:5]vehicle;novehicle")
local btn = "VehicleMenuBarActionButton%d"
for i=1,6 do
local name = btn:format(i)
local button = _G[name]
button.UpdateUsable = Bartender4.Button.prototype.UpdateUsable
button:SetScript("OnUpdate", Bartender4.Button.onUpdate)
button.icon = _G[("%sIcon"):format(name)]
button.border = _G[("%sBorder"):format(name)]
button.cooldown = _G[("%sCooldown"):format(name)]
button.macroName = _G[("%sName"):format(name)]
button.hotkey = _G[("%sHotKey"):format(name)]
button.count = _G[("%sCount"):format(name)]
button.flash = _G[("%sFlash"):format(name)]
button.BT4init = true
button:SetParent(VehicleMenuBarActionButtonFrame)
end
else
MainMenuBarArtFrame:UnregisterEvent("UNIT_ENTERING_VEHICLE")
MainMenuBarArtFrame:UnregisterEvent("UNIT_ENTERED_VEHICLE")
@@ -215,6 +231,13 @@ function Bartender4:UpdateBlizzardVehicle()
if self.vehicleController then
UnregisterStateDriver(self.vehicleController, "vehicle")
end
local btn = "VehicleMenuBarActionButton%d"
for i=1,6 do
local name = btn:format(i)
local button = _G[name]
button.BT4init = nil
button:SetScript("OnUpdate", ActionButton_OnUpdate)
end
end
end