Mercurial > wow > reaction
view classes/VehicleExitButton.lua @ 161:d0a41fc7b0d7
Totem bar support
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Fri, 21 Aug 2009 04:15:09 +0000 |
parents | 799c6ea9da7b |
children | 8cc187143acd |
line wrap: on
line source
local ReAction = ReAction local format = string.format ReAction:UpdateRevision("$Revision: 154 $") -- -- VExitButton Button class -- local Super = ReAction.Button local VExitButton = setmetatable( { }, { __index = Super } ) ReAction.Button.VehicleExit = VExitButton function VExitButton:New( idx, config, bar ) local name = format("ReAction_%s_VehicleExit_%d",bar:GetName(),idx) self = Super.New(self, name, config, bar, idx, "SecureFrameTemplate, ActionButtonTemplate", "Button") -- frame setup local f = self:GetFrame() self.frames.icon:SetTexture("Interface\\Vehicles\\UI-Vehicles-Button-Exit-Up") self.frames.icon:SetTexCoord(0.140625, 0.859375, 0.140625, 0.859375) -- attribute setup -- (none) -- non secure scripts f:SetScript("OnClick", VehicleExit) f:SetScript("OnEnter", function(frame) GameTooltip_AddNewbieTip(frame, LEAVE_VEHICLE, 1.0, 1.0, 1.0, nil) end) f:SetScript("OnLeave", GameTooltip_Hide) f:SetScript("OnEvent", function(frame, evt, ...) self:OnEvent(evt,...) end) -- event registration f:EnableMouse(true) f:RegisterForClicks("AnyUp") f:RegisterEvent("UPDATE_BINDINGS") -- attach to skinner bar:SkinButton(self) self:Refresh() self:UpdateHotkey() return self end function VExitButton:GetActionID() return 1 end function VExitButton:Refresh() Super.Refresh(self) -- it seems that setscale kills the texcoord, have to refresh it self.frames.icon:SetTexCoord(0.140625, 0.859375, 0.140625, 0.859375) end function VExitButton:OnEvent(event, ...) if self[event] then self[event](self, event, ...) end end function VExitButton:UPDATE_BINDINGS() self:UpdateHotkey() end