Mercurial > wow > reaction
comparison classes/VehicleExitButton.lua @ 159:799c6ea9da7b
added vehicle exit floater
some fixes for vehicle exit button on main bars
still some lingering settexcoords issues on the vehicle exit icon
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Mon, 29 Jun 2009 17:43:16 +0000 |
parents | |
children | 8cc187143acd |
comparison
equal
deleted
inserted
replaced
158:d2f289c3bae6 | 159:799c6ea9da7b |
---|---|
1 local ReAction = ReAction | |
2 local format = string.format | |
3 | |
4 ReAction:UpdateRevision("$Revision: 154 $") | |
5 | |
6 -- | |
7 -- VExitButton Button class | |
8 -- | |
9 local Super = ReAction.Button | |
10 local VExitButton = setmetatable( { }, { __index = Super } ) | |
11 ReAction.Button.VehicleExit = VExitButton | |
12 | |
13 function VExitButton:New( idx, config, bar ) | |
14 local name = format("ReAction_%s_VehicleExit_%d",bar:GetName(),idx) | |
15 | |
16 self = Super.New(self, name, config, bar, idx, "SecureFrameTemplate, ActionButtonTemplate", "Button") | |
17 | |
18 -- frame setup | |
19 local f = self:GetFrame() | |
20 self.frames.icon:SetTexture("Interface\\Vehicles\\UI-Vehicles-Button-Exit-Up") | |
21 self.frames.icon:SetTexCoord(0.140625, 0.859375, 0.140625, 0.859375) | |
22 | |
23 -- attribute setup | |
24 -- (none) | |
25 | |
26 -- non secure scripts | |
27 f:SetScript("OnClick", VehicleExit) | |
28 f:SetScript("OnEnter", function(frame) GameTooltip_AddNewbieTip(frame, LEAVE_VEHICLE, 1.0, 1.0, 1.0, nil) end) | |
29 f:SetScript("OnLeave", GameTooltip_Hide) | |
30 f:SetScript("OnEvent", function(frame, evt, ...) self:OnEvent(evt,...) end) | |
31 | |
32 -- event registration | |
33 f:EnableMouse(true) | |
34 f:RegisterForClicks("AnyUp") | |
35 f:RegisterEvent("UPDATE_BINDINGS") | |
36 | |
37 -- attach to skinner | |
38 bar:SkinButton(self) | |
39 | |
40 self:Refresh() | |
41 self:UpdateHotkey() | |
42 | |
43 return self | |
44 end | |
45 | |
46 function VExitButton:GetActionID() | |
47 return 1 | |
48 end | |
49 | |
50 function VExitButton:Refresh() | |
51 Super.Refresh(self) | |
52 -- it seems that setscale kills the texcoord, have to refresh it | |
53 self.frames.icon:SetTexCoord(0.140625, 0.859375, 0.140625, 0.859375) | |
54 end | |
55 | |
56 function VExitButton:OnEvent(event, ...) | |
57 if self[event] then | |
58 self[event](self, event, ...) | |
59 end | |
60 end | |
61 | |
62 function VExitButton:UPDATE_BINDINGS() | |
63 self:UpdateHotkey() | |
64 end |