flickerstreak@175: local addonName, addonTable = ... flickerstreak@175: local ReAction = addonTable.ReAction flickerstreak@218: local L = ReAction.L flickerstreak@159: local format = string.format flickerstreak@159: flickerstreak@159: -- flickerstreak@159: -- VExitButton Button class flickerstreak@159: -- flickerstreak@218: local buttonTypeID = "VehicleExit" flickerstreak@159: local Super = ReAction.Button flickerstreak@218: local VExitButton = setmetatable( flickerstreak@218: { flickerstreak@218: defaultBarConfig = { flickerstreak@218: type = buttonTypeID , flickerstreak@218: btnWidth = 36, flickerstreak@218: btnHeight = 36, flickerstreak@218: btnRows = 1, flickerstreak@218: btnColumns = 1, flickerstreak@218: spacing = 3 flickerstreak@218: }, flickerstreak@218: flickerstreak@218: barType = L["Exit Vehicle Floater"], flickerstreak@218: }, flickerstreak@218: { __index = Super } ) flickerstreak@159: ReAction.Button.VehicleExit = VExitButton flickerstreak@159: flickerstreak@159: function VExitButton:New( idx, config, bar ) flickerstreak@159: local name = format("ReAction_%s_VehicleExit_%d",bar:GetName(),idx) flickerstreak@159: flickerstreak@159: self = Super.New(self, name, config, bar, idx, "SecureFrameTemplate, ActionButtonTemplate", "Button") flickerstreak@159: flickerstreak@159: -- frame setup flickerstreak@159: local f = self:GetFrame() flickerstreak@159: self.frames.icon:SetTexture("Interface\\Vehicles\\UI-Vehicles-Button-Exit-Up") flickerstreak@159: self.frames.icon:SetTexCoord(0.140625, 0.859375, 0.140625, 0.859375) flickerstreak@159: flickerstreak@159: -- attribute setup flickerstreak@159: -- (none) flickerstreak@159: flickerstreak@159: -- non secure scripts flickerstreak@159: f:SetScript("OnClick", VehicleExit) flickerstreak@159: f:SetScript("OnEnter", function(frame) GameTooltip_AddNewbieTip(frame, LEAVE_VEHICLE, 1.0, 1.0, 1.0, nil) end) flickerstreak@159: f:SetScript("OnLeave", GameTooltip_Hide) flickerstreak@159: f:SetScript("OnEvent", function(frame, evt, ...) self:OnEvent(evt,...) end) flickerstreak@159: flickerstreak@159: -- event registration flickerstreak@159: f:EnableMouse(true) flickerstreak@159: f:RegisterForClicks("AnyUp") flickerstreak@159: f:RegisterEvent("UPDATE_BINDINGS") flickerstreak@159: flickerstreak@159: -- attach to skinner flickerstreak@159: bar:SkinButton(self) flickerstreak@159: flickerstreak@159: self:Refresh() flickerstreak@159: self:UpdateHotkey() flickerstreak@159: flickerstreak@159: return self flickerstreak@159: end flickerstreak@159: flickerstreak@159: function VExitButton:GetActionID() flickerstreak@159: return 1 flickerstreak@159: end flickerstreak@159: flickerstreak@159: function VExitButton:Refresh() flickerstreak@159: Super.Refresh(self) flickerstreak@159: -- it seems that setscale kills the texcoord, have to refresh it flickerstreak@159: self.frames.icon:SetTexCoord(0.140625, 0.859375, 0.140625, 0.859375) flickerstreak@159: end flickerstreak@159: flickerstreak@159: function VExitButton:OnEvent(event, ...) flickerstreak@159: if self[event] then flickerstreak@159: self[event](self, event, ...) flickerstreak@159: end flickerstreak@159: end flickerstreak@159: flickerstreak@159: function VExitButton:UPDATE_BINDINGS() flickerstreak@159: self:UpdateHotkey() flickerstreak@159: end