annotate classes/VehicleExitButton.lua @ 169:8cc187143acd

Strip out obsolete revision tracking
author Flick <flickerstreak@gmail.com>
date Tue, 19 Oct 2010 17:20:16 +0000
parents 799c6ea9da7b
children df68b5a40490
rev   line source
flickerstreak@159 1 local ReAction = ReAction
flickerstreak@159 2 local format = string.format
flickerstreak@159 3
flickerstreak@159 4 --
flickerstreak@159 5 -- VExitButton Button class
flickerstreak@159 6 --
flickerstreak@159 7 local Super = ReAction.Button
flickerstreak@159 8 local VExitButton = setmetatable( { }, { __index = Super } )
flickerstreak@159 9 ReAction.Button.VehicleExit = VExitButton
flickerstreak@159 10
flickerstreak@159 11 function VExitButton:New( idx, config, bar )
flickerstreak@159 12 local name = format("ReAction_%s_VehicleExit_%d",bar:GetName(),idx)
flickerstreak@159 13
flickerstreak@159 14 self = Super.New(self, name, config, bar, idx, "SecureFrameTemplate, ActionButtonTemplate", "Button")
flickerstreak@159 15
flickerstreak@159 16 -- frame setup
flickerstreak@159 17 local f = self:GetFrame()
flickerstreak@159 18 self.frames.icon:SetTexture("Interface\\Vehicles\\UI-Vehicles-Button-Exit-Up")
flickerstreak@159 19 self.frames.icon:SetTexCoord(0.140625, 0.859375, 0.140625, 0.859375)
flickerstreak@159 20
flickerstreak@159 21 -- attribute setup
flickerstreak@159 22 -- (none)
flickerstreak@159 23
flickerstreak@159 24 -- non secure scripts
flickerstreak@159 25 f:SetScript("OnClick", VehicleExit)
flickerstreak@159 26 f:SetScript("OnEnter", function(frame) GameTooltip_AddNewbieTip(frame, LEAVE_VEHICLE, 1.0, 1.0, 1.0, nil) end)
flickerstreak@159 27 f:SetScript("OnLeave", GameTooltip_Hide)
flickerstreak@159 28 f:SetScript("OnEvent", function(frame, evt, ...) self:OnEvent(evt,...) end)
flickerstreak@159 29
flickerstreak@159 30 -- event registration
flickerstreak@159 31 f:EnableMouse(true)
flickerstreak@159 32 f:RegisterForClicks("AnyUp")
flickerstreak@159 33 f:RegisterEvent("UPDATE_BINDINGS")
flickerstreak@159 34
flickerstreak@159 35 -- attach to skinner
flickerstreak@159 36 bar:SkinButton(self)
flickerstreak@159 37
flickerstreak@159 38 self:Refresh()
flickerstreak@159 39 self:UpdateHotkey()
flickerstreak@159 40
flickerstreak@159 41 return self
flickerstreak@159 42 end
flickerstreak@159 43
flickerstreak@159 44 function VExitButton:GetActionID()
flickerstreak@159 45 return 1
flickerstreak@159 46 end
flickerstreak@159 47
flickerstreak@159 48 function VExitButton:Refresh()
flickerstreak@159 49 Super.Refresh(self)
flickerstreak@159 50 -- it seems that setscale kills the texcoord, have to refresh it
flickerstreak@159 51 self.frames.icon:SetTexCoord(0.140625, 0.859375, 0.140625, 0.859375)
flickerstreak@159 52 end
flickerstreak@159 53
flickerstreak@159 54 function VExitButton:OnEvent(event, ...)
flickerstreak@159 55 if self[event] then
flickerstreak@159 56 self[event](self, event, ...)
flickerstreak@159 57 end
flickerstreak@159 58 end
flickerstreak@159 59
flickerstreak@159 60 function VExitButton:UPDATE_BINDINGS()
flickerstreak@159 61 self:UpdateHotkey()
flickerstreak@159 62 end