You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1276 lines
32 KiB
1276 lines
32 KiB
local E, L, V, P, G = unpack(ElvUI)
|
|
local AB = E:GetModule('ActionBars')
|
|
local UF = E:GetModule('UnitFrames')
|
|
local NP = E:GetModule('NamePlates')
|
|
local M = E:GetModule('Misc')
|
|
local S = E:GetModule('Skins')
|
|
|
|
local _G = _G
|
|
local pairs, type, unpack, assert, ceil, error = pairs, type, unpack, assert, ceil, error
|
|
local tremove, tContains, tinsert, next, wipe = tremove, tContains, tinsert, next, wipe
|
|
|
|
local CreateFrame = CreateFrame
|
|
local MoneyFrame_Update = MoneyFrame_Update
|
|
local UnitIsDeadOrGhost, InCinematic = UnitIsDeadOrGhost, InCinematic
|
|
local PurchaseSlot, GetBankSlotCost = PurchaseSlot, GetBankSlotCost
|
|
local ReloadUI, PlaySound, StopMusic = ReloadUI, PlaySound, StopMusic
|
|
local StaticPopup_Resize = StaticPopup_Resize
|
|
local GetBindingFromClick = GetBindingFromClick
|
|
|
|
local AutoCompleteEditBox_OnEnterPressed = AutoCompleteEditBox_OnEnterPressed
|
|
local AutoCompleteEditBox_OnTextChanged = AutoCompleteEditBox_OnTextChanged
|
|
local ChatEdit_FocusActiveWindow = ChatEdit_FocusActiveWindow
|
|
|
|
local DisableAddOn = C_AddOns.DisableAddOn
|
|
local IsAddOnLoaded = C_AddOns.IsAddOnLoaded
|
|
|
|
local STATICPOPUP_TEXTURE_ALERT = STATICPOPUP_TEXTURE_ALERT
|
|
local STATICPOPUP_TEXTURE_ALERTGEAR = STATICPOPUP_TEXTURE_ALERTGEAR
|
|
local YES, NO, OKAY, CANCEL, ACCEPT, DECLINE = YES, NO, OKAY, CANCEL, ACCEPT, DECLINE
|
|
-- GLOBALS: ElvUIBindPopupWindowCheckButton
|
|
|
|
local DOWNLOAD_URL = 'https://tukui.org/elvui'
|
|
local fallback_color = {1, 1, 1, 1}
|
|
|
|
E.PopupDialogs = {}
|
|
E.StaticPopup_DisplayedFrames = {}
|
|
|
|
E.PopupDialogs.ELVUI_UPDATE_AVAILABLE = {
|
|
text = L["ElvUI is five or more revisions out of date. You can download the newest version from tukui.org."],
|
|
hasEditBox = 1,
|
|
OnShow = function(self)
|
|
self.editBox:SetAutoFocus(false)
|
|
self.editBox.width = self.editBox:GetWidth()
|
|
self.editBox:Width(220)
|
|
self.editBox:SetText(DOWNLOAD_URL)
|
|
ChatEdit_FocusActiveWindow()
|
|
end,
|
|
OnHide = function(self)
|
|
self.editBox:Width(self.editBox.width or 50)
|
|
self.editBox.width = nil
|
|
end,
|
|
hideOnEscape = 1,
|
|
button1 = OKAY,
|
|
EditBoxOnEnterPressed = function(self)
|
|
ChatEdit_FocusActiveWindow()
|
|
self:GetParent():Hide()
|
|
end,
|
|
EditBoxOnEscapePressed = function(self)
|
|
ChatEdit_FocusActiveWindow()
|
|
self:GetParent():Hide()
|
|
end,
|
|
EditBoxOnTextChanged = function(self)
|
|
if self:GetText() ~= DOWNLOAD_URL then
|
|
self:SetText(DOWNLOAD_URL)
|
|
end
|
|
|
|
self:HighlightText()
|
|
|
|
ChatEdit_FocusActiveWindow()
|
|
end,
|
|
OnEditFocusGained = function(self)
|
|
self:HighlightText()
|
|
end,
|
|
showAlert = 1,
|
|
}
|
|
|
|
E.PopupDialogs.ELVUI_EDITBOX = {
|
|
text = E.title,
|
|
button1 = OKAY,
|
|
hasEditBox = 1,
|
|
OnShow = function(self, data)
|
|
self.editBox:SetAutoFocus(false)
|
|
self.editBox.width = self.editBox:GetWidth()
|
|
self.editBox:Width(280)
|
|
self.editBox:AddHistoryLine('text')
|
|
self.editBox.temptxt = data
|
|
self.editBox:SetText(data)
|
|
self.editBox:SetJustifyH('CENTER')
|
|
end,
|
|
OnHide = function(self)
|
|
self.editBox:Width(self.editBox.width or 50)
|
|
self.editBox.width = nil
|
|
self.temptxt = nil
|
|
end,
|
|
EditBoxOnEnterPressed = function(self)
|
|
self:GetParent():Hide()
|
|
end,
|
|
EditBoxOnEscapePressed = function(self)
|
|
self:GetParent():Hide()
|
|
end,
|
|
EditBoxOnTextChanged = function(self)
|
|
if self:GetText() ~= self.temptxt then
|
|
self:SetText(self.temptxt)
|
|
end
|
|
|
|
self:HighlightText()
|
|
end,
|
|
whileDead = 1,
|
|
preferredIndex = 3,
|
|
hideOnEscape = 1,
|
|
}
|
|
|
|
E.PopupDialogs.UPDATE_REQUEST = {
|
|
text = L["UPDATE_REQUEST"],
|
|
button1 = OKAY,
|
|
showAlert = 1,
|
|
}
|
|
|
|
E.PopupDialogs.CONFIRM_LOSE_BINDING_CHANGES = {
|
|
text = CONFIRM_LOSE_BINDING_CHANGES,
|
|
button1 = OKAY,
|
|
button2 = CANCEL,
|
|
OnAccept = function()
|
|
AB:ChangeBindingProfile()
|
|
AB.bindingsChanged = nil
|
|
end,
|
|
OnCancel = function()
|
|
local isChecked = ElvUIBindPopupWindowCheckButton:GetChecked()
|
|
ElvUIBindPopupWindowCheckButton:SetChecked(not isChecked)
|
|
end,
|
|
whileDead = 1,
|
|
showAlert = 1,
|
|
}
|
|
|
|
E.PopupDialogs.TUKUI_ELVUI_INCOMPATIBLE = {
|
|
text = L["Oh lord, you have got ElvUI and Tukui both enabled at the same time. Select an addon to disable."],
|
|
OnAccept = function() DisableAddOn('ElvUI'); ReloadUI() end,
|
|
OnCancel = function() DisableAddOn('Tukui'); ReloadUI() end,
|
|
button1 = 'ElvUI',
|
|
button2 = 'Tukui',
|
|
whileDead = 1,
|
|
hideOnEscape = false,
|
|
}
|
|
|
|
E.PopupDialogs.DISABLE_INCOMPATIBLE_ADDON = {
|
|
text = L["Do you swear not to post in technical support about something not working without first disabling the addon/module combination first?"],
|
|
OnAccept = function()
|
|
E.global.ignoreIncompatible = true
|
|
end,
|
|
OnCancel = function()
|
|
local popup = E.PopupDialogs.INCOMPATIBLE_ADDON
|
|
E:StaticPopup_Hide('DISABLE_INCOMPATIBLE_ADDON')
|
|
E:StaticPopup_Show('INCOMPATIBLE_ADDON', popup.button1, popup.button2)
|
|
end,
|
|
button1 = L["I Swear"],
|
|
button2 = DECLINE,
|
|
whileDead = 1,
|
|
hideOnEscape = false,
|
|
}
|
|
|
|
E.PopupDialogs.INCOMPATIBLE_ADDON = {
|
|
text = L["INCOMPATIBLE_ADDON"],
|
|
OnAccept = function() local popup = E.PopupDialogs.INCOMPATIBLE_ADDON; popup.accept(popup) end,
|
|
OnCancel = function() local popup = E.PopupDialogs.INCOMPATIBLE_ADDON; popup.cancel(popup) end,
|
|
button3 = L["Disable Warning"],
|
|
OnAlt = function()
|
|
E:StaticPopup_Hide('INCOMPATIBLE_ADDON')
|
|
E:StaticPopup_Show('DISABLE_INCOMPATIBLE_ADDON')
|
|
end,
|
|
whileDead = 1,
|
|
hideOnEscape = false,
|
|
}
|
|
|
|
E.PopupDialogs.CONFIG_RL = {
|
|
text = L["One or more of the changes you have made require a ReloadUI."],
|
|
button1 = ACCEPT,
|
|
button2 = CANCEL,
|
|
OnAccept = ReloadUI,
|
|
whileDead = 1,
|
|
hideOnEscape = false,
|
|
}
|
|
|
|
E.PopupDialogs.GLOBAL_RL = {
|
|
text = L["One or more of the changes you have made will effect all characters using this addon. You will have to reload the user interface to see the changes you have made."],
|
|
button1 = ACCEPT,
|
|
button2 = CANCEL,
|
|
OnAccept = ReloadUI,
|
|
whileDead = 1,
|
|
hideOnEscape = false,
|
|
}
|
|
|
|
E.PopupDialogs.PRIVATE_RL = {
|
|
text = L["A setting you have changed will change an option for this character only. This setting that you have changed will be uneffected by changing user profiles. Changing this setting requires that you reload your User Interface."],
|
|
button1 = ACCEPT,
|
|
button2 = CANCEL,
|
|
OnAccept = ReloadUI,
|
|
whileDead = 1,
|
|
hideOnEscape = false,
|
|
}
|
|
|
|
E.PopupDialogs.RESET_ALL_FILTERS = {
|
|
text = L["Accepting this will reset all filters to default. Are you sure?"],
|
|
button1 = ACCEPT,
|
|
button2 = CANCEL,
|
|
OnAccept = function()
|
|
UF:ResetFilters()
|
|
|
|
if E:Config_GetWindow() then
|
|
E:RefreshGUI()
|
|
end
|
|
|
|
UF:Update_AllFrames()
|
|
NP:ConfigureAll()
|
|
end,
|
|
whileDead = 1,
|
|
hideOnEscape = false,
|
|
}
|
|
|
|
E.PopupDialogs.RESET_UF_UNIT = {
|
|
text = L["Accepting this will reset the UnitFrame settings for %s. Are you sure?"],
|
|
button1 = ACCEPT,
|
|
button2 = CANCEL,
|
|
OnAccept = function(_, data)
|
|
if data and data.unit then
|
|
UF:ResetUnitSettings(data.unit)
|
|
if data.mover then
|
|
E:ResetMovers(data.mover)
|
|
end
|
|
|
|
if data.unit == 'raidpet' then
|
|
UF:CreateAndUpdateHeaderGroup(data.unit, nil, nil, true)
|
|
end
|
|
|
|
if IsAddOnLoaded('ElvUI_Options') then
|
|
local ACD = E.Libs.AceConfigDialog
|
|
if ACD and ACD.OpenFrames and ACD.OpenFrames.ElvUI then
|
|
ACD:SelectGroup('ElvUI', 'unitframe', data.unit)
|
|
end
|
|
end
|
|
else
|
|
E:Print(L["Error resetting UnitFrame."])
|
|
end
|
|
end,
|
|
whileDead = 1,
|
|
hideOnEscape = false,
|
|
}
|
|
|
|
E.PopupDialogs.RESET_UF_AF = {
|
|
text = L["Accepting this will reset your Filter Priority lists for all auras on UnitFrames. Are you sure?"],
|
|
button1 = ACCEPT,
|
|
button2 = CANCEL,
|
|
OnAccept = function()
|
|
UF:ResetAuraPriority()
|
|
end,
|
|
whileDead = 1,
|
|
hideOnEscape = false,
|
|
}
|
|
|
|
E.PopupDialogs.RESET_NP_AF = {
|
|
text = L["Accepting this will reset your Filter Priority lists for all auras on NamePlates. Are you sure?"],
|
|
button1 = ACCEPT,
|
|
button2 = CANCEL,
|
|
OnAccept = function()
|
|
NP:ResetAuraPriority()
|
|
end,
|
|
whileDead = 1,
|
|
hideOnEscape = false,
|
|
}
|
|
|
|
E.PopupDialogs.BUY_BANK_SLOT = {
|
|
text = CONFIRM_BUY_BANK_SLOT,
|
|
button1 = YES,
|
|
button2 = NO,
|
|
OnAccept = PurchaseSlot,
|
|
OnShow = function(self)
|
|
MoneyFrame_Update(self.moneyFrame, GetBankSlotCost())
|
|
end,
|
|
hasMoneyFrame = 1,
|
|
hideOnEscape = 1,
|
|
}
|
|
|
|
E.PopupDialogs.CANNOT_BUY_BANK_SLOT = {
|
|
text = L["Can't buy anymore slots!"],
|
|
button1 = ACCEPT,
|
|
whileDead = 1,
|
|
}
|
|
|
|
E.PopupDialogs.NO_BANK_BAGS = {
|
|
text = L["You must purchase a bank slot first!"],
|
|
button1 = ACCEPT,
|
|
whileDead = 1,
|
|
}
|
|
|
|
E.PopupDialogs.RESETUI_CHECK = {
|
|
text = L["Are you sure you want to reset every mover back to it's default position?"],
|
|
button1 = ACCEPT,
|
|
button2 = CANCEL,
|
|
OnAccept = function()
|
|
E:ResetAllUI()
|
|
end,
|
|
whileDead = 1,
|
|
}
|
|
|
|
E.PopupDialogs.DISBAND_RAID = {
|
|
text = L["Are you sure you want to disband the group?"],
|
|
button1 = ACCEPT,
|
|
button2 = CANCEL,
|
|
OnAccept = function() M:DisbandRaidGroup() end,
|
|
whileDead = 1,
|
|
}
|
|
|
|
E.PopupDialogs.CONFIRM_LOOT_DISTRIBUTION = {
|
|
text = CONFIRM_LOOT_DISTRIBUTION,
|
|
button1 = YES,
|
|
button2 = NO,
|
|
hideOnEscape = 1,
|
|
}
|
|
|
|
E.PopupDialogs.RESET_PROFILE_PROMPT = {
|
|
text = L["Are you sure you want to reset all the settings on this profile?"],
|
|
button1 = YES,
|
|
button2 = NO,
|
|
hideOnEscape = 1,
|
|
OnAccept = function() E:ResetProfile() end,
|
|
}
|
|
|
|
E.PopupDialogs.RESET_PRIVATE_PROFILE_PROMPT = {
|
|
text = L["Are you sure you want to reset all the settings on this profile?"],
|
|
button1 = YES,
|
|
button2 = NO,
|
|
hideOnEscape = 1,
|
|
OnAccept = function() E:ResetPrivateProfile() end,
|
|
}
|
|
|
|
E.PopupDialogs.APPLY_FONT_WARNING = {
|
|
text = L["Are you sure you want to apply this font to all ElvUI elements?"],
|
|
OnAccept = function() E:GeneralMedia_ApplyToAll() end,
|
|
OnCancel = function() E:StaticPopup_Hide('APPLY_FONT_WARNING') end,
|
|
button1 = YES,
|
|
button2 = CANCEL,
|
|
whileDead = 1,
|
|
hideOnEscape = false,
|
|
}
|
|
|
|
E.PopupDialogs.MODULE_COPY_CONFIRM = {
|
|
button1 = ACCEPT,
|
|
button2 = CANCEL,
|
|
whileDead = 1,
|
|
hideOnEscape = false,
|
|
}
|
|
|
|
E.PopupDialogs.SCRIPT_PROFILE = {
|
|
text = L["You are using CPU Profiling. This causes decreased performance. Do you want to disable it or continue?"],
|
|
button1 = L["Disable"],
|
|
button2 = L["Continue"],
|
|
OnAccept = function()
|
|
E:SetCVar('scriptProfile', 0)
|
|
ReloadUI()
|
|
end,
|
|
showAlert = 1,
|
|
whileDead = 1,
|
|
hideOnEscape = false,
|
|
}
|
|
|
|
local MAX_STATIC_POPUPS = 4
|
|
function E:StaticPopup_OnShow()
|
|
PlaySound(850) --IG_MAINMENU_OPEN
|
|
|
|
local dialog = E.PopupDialogs[self.which]
|
|
if dialog then
|
|
local OnShow = dialog.OnShow
|
|
if OnShow then
|
|
OnShow(self, self.data)
|
|
end
|
|
|
|
local dialogName = self:GetName()
|
|
if dialog.hasMoneyInputFrame then
|
|
_G[dialogName..'MoneyInputFrameGold']:SetFocus()
|
|
end
|
|
|
|
if dialog.enterClicksFirstButton or dialog.hideOnEscape then
|
|
self:SetScript('OnKeyDown', E.StaticPopup_OnKeyDown)
|
|
end
|
|
end
|
|
|
|
-- boost static popups over ace gui
|
|
if IsAddOnLoaded('ElvUI_Options') then
|
|
local ACD = E.Libs.AceConfigDialog
|
|
if ACD and ACD.OpenFrames and ACD.OpenFrames.ElvUI then
|
|
self.frameStrataIncreased = true
|
|
self:SetFrameStrata('FULLSCREEN_DIALOG')
|
|
|
|
local popupFrameLevel = self:GetFrameLevel()
|
|
if popupFrameLevel < 100 then
|
|
self:SetFrameLevel(popupFrameLevel+100)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function E:StaticPopup_EscapePressed()
|
|
local closed = nil
|
|
for _, frame in pairs(E.StaticPopup_DisplayedFrames) do
|
|
if frame:IsShown() and frame.hideOnEscape then
|
|
local standardDialog = E.PopupDialogs[frame.which]
|
|
if standardDialog then
|
|
local OnCancel = standardDialog.OnCancel
|
|
local noCancelOnEscape = standardDialog.noCancelOnEscape
|
|
if OnCancel and not noCancelOnEscape then
|
|
OnCancel(frame, frame.data, 'clicked')
|
|
end
|
|
|
|
frame:Hide()
|
|
else
|
|
E:StaticPopupSpecial_Hide(frame)
|
|
end
|
|
|
|
closed = 1
|
|
end
|
|
end
|
|
|
|
return closed
|
|
end
|
|
|
|
function E:StaticPopup_CollapseTable()
|
|
local displayedFrames = E.StaticPopup_DisplayedFrames
|
|
local index = #displayedFrames
|
|
while index >= 1 and not displayedFrames[index]:IsShown() do
|
|
tremove(displayedFrames, index)
|
|
index = index - 1
|
|
end
|
|
end
|
|
|
|
function E:StaticPopup_SetUpPosition(dialog)
|
|
if not tContains(E.StaticPopup_DisplayedFrames, dialog) then
|
|
dialog:ClearAllPoints()
|
|
|
|
local lastFrame = E.StaticPopup_DisplayedFrames[#E.StaticPopup_DisplayedFrames]
|
|
if lastFrame then
|
|
dialog:Point('TOP', lastFrame, 'BOTTOM', 0, -4)
|
|
else
|
|
dialog:Point('TOP', E.UIParent, 'TOP', 0, -100)
|
|
end
|
|
|
|
tinsert(E.StaticPopup_DisplayedFrames, dialog)
|
|
end
|
|
end
|
|
|
|
function E:StaticPopupSpecial_Show(frame)
|
|
if frame.exclusive then
|
|
E:StaticPopup_HideExclusive()
|
|
end
|
|
|
|
E:StaticPopup_SetUpPosition(frame)
|
|
frame:Show()
|
|
end
|
|
|
|
function E:StaticPopupSpecial_Hide(frame)
|
|
frame:Hide()
|
|
E:StaticPopup_CollapseTable()
|
|
end
|
|
|
|
--Used to figure out if we can resize a frame
|
|
function E:StaticPopup_IsLastDisplayedFrame(frame)
|
|
for i = #E.StaticPopup_DisplayedFrames, 1, -1 do
|
|
local popup = E.StaticPopup_DisplayedFrames[i]
|
|
if popup:IsShown() then
|
|
return frame == popup
|
|
end
|
|
end
|
|
|
|
return false
|
|
end
|
|
|
|
function E:StaticPopup_OnKeyDown(key)
|
|
if GetBindingFromClick(key) == 'TOGGLEGAMEMENU' then
|
|
return E:StaticPopup_EscapePressed()
|
|
end
|
|
|
|
local dialog = key == 'ENTER' and E.PopupDialogs[self.which]
|
|
if dialog and dialog.enterClicksFirstButton then
|
|
local i, dialogName = 1, self:GetName()
|
|
local button = _G[dialogName..'Button'..i]
|
|
while button do
|
|
if button:IsShown() then
|
|
E.StaticPopup_OnClick(self, i)
|
|
return
|
|
end
|
|
|
|
i = i + 1
|
|
button = _G[dialogName..'Button'..i]
|
|
end
|
|
end
|
|
end
|
|
|
|
function E:StaticPopup_OnHide()
|
|
PlaySound(851) --IG_MAINMENU_CLOSE
|
|
|
|
E:StaticPopup_CollapseTable()
|
|
|
|
local dialog = E.PopupDialogs[self.which]
|
|
|
|
local OnHide = dialog.OnHide
|
|
if OnHide then
|
|
OnHide(self, self.data)
|
|
end
|
|
|
|
if self.extraFrame then
|
|
self.extraFrame:Hide()
|
|
end
|
|
|
|
if self.editBox then
|
|
self.editBox:ClearText()
|
|
end
|
|
|
|
if dialog.enterClicksFirstButton then
|
|
self:SetScript('OnKeyDown', nil)
|
|
end
|
|
|
|
-- static popup was boosted over ace gui, set it back to normal
|
|
if self.frameStrataIncreased then
|
|
self.frameStrataIncreased = nil
|
|
self:SetFrameStrata('DIALOG')
|
|
|
|
local popupFrameLevel = self:GetFrameLevel()
|
|
if popupFrameLevel > 100 then
|
|
self:SetFrameLevel(popupFrameLevel-100)
|
|
end
|
|
end
|
|
end
|
|
|
|
function E:StaticPopup_OnUpdate(elapsed)
|
|
local info = E.PopupDialogs[self.which]
|
|
|
|
if self.timeleft and self.timeleft > 0 then
|
|
self.timeleft = self.timeleft - elapsed
|
|
|
|
if self.timeleft <= 0 then
|
|
if not info.timeoutInformationalOnly then
|
|
self.timeleft = nil
|
|
|
|
if info.OnCancel then
|
|
info.OnCancel(self, self.data, 'timeout')
|
|
end
|
|
|
|
self:Hide()
|
|
end
|
|
|
|
return
|
|
end
|
|
end
|
|
|
|
local dialogName = self:GetName()
|
|
local button1 = _G[dialogName..'Button1']
|
|
if self.startDelay then
|
|
self.startDelay = self.startDelay - elapsed
|
|
|
|
if self.startDelay <= 0 then
|
|
self.startDelay = nil
|
|
|
|
button1:Enable()
|
|
|
|
local text = _G[dialogName..'Text']
|
|
if text then
|
|
text:SetFormattedText(info.text, text.text_arg1, text.text_arg2)
|
|
end
|
|
|
|
if StaticPopup_Resize then
|
|
StaticPopup_Resize(self, self.which)
|
|
elseif self.Resize then
|
|
self:Resize(self.which)
|
|
end
|
|
|
|
return
|
|
end
|
|
end
|
|
|
|
if self.acceptDelay then
|
|
self.acceptDelay = self.acceptDelay - elapsed
|
|
|
|
local enabled = self.acceptDelay <= 0
|
|
button1:SetEnabled(enabled)
|
|
|
|
if enabled then
|
|
button1:SetText(info.button1)
|
|
|
|
self.acceptDelay = nil
|
|
|
|
if info.OnAcceptDelayExpired ~= nil then
|
|
info.OnAcceptDelayExpired(self, self.data)
|
|
end
|
|
else
|
|
button1:SetText(ceil(self.acceptDelay))
|
|
end
|
|
end
|
|
|
|
if info and info.OnUpdate then
|
|
info.OnUpdate(self, elapsed)
|
|
end
|
|
end
|
|
|
|
function E:StaticPopup_OnClick(index)
|
|
if not self:IsShown() then return end
|
|
|
|
local which = self.which
|
|
local info = E.PopupDialogs[which]
|
|
if not info then return end
|
|
|
|
if info.selectCallbackByIndex then
|
|
local func
|
|
if index == 1 then
|
|
func = info.OnAccept or info.OnButton1
|
|
elseif index == 2 then
|
|
func = info.OnCancel or info.OnButton2
|
|
elseif index == 3 then
|
|
func = info.OnButton3
|
|
elseif index == 4 then
|
|
func = info.OnButton4
|
|
elseif index == 5 then
|
|
func = info.OnExtraButton
|
|
end
|
|
|
|
if func then
|
|
local keepOpen = func(self, self.data, 'clicked')
|
|
if not keepOpen and which == self.which then
|
|
self:Hide()
|
|
end
|
|
end
|
|
else
|
|
local hide = true
|
|
if index == 1 then
|
|
local OnAccept = info.OnAccept or info.OnButton1
|
|
if OnAccept then
|
|
hide = not OnAccept(self, self.data, self.data2)
|
|
end
|
|
elseif index == 3 then
|
|
local OnAlt = info.OnAlt or info.OnButton2
|
|
if OnAlt then
|
|
OnAlt(self, self.data, 'clicked')
|
|
end
|
|
else
|
|
local OnCancel = info.OnCancel
|
|
if OnCancel then
|
|
hide = not OnCancel(self, self.data, 'clicked')
|
|
end
|
|
end
|
|
|
|
if hide and (which == self.which) then
|
|
-- can self.which change inside one of the On* functions???
|
|
self:Hide()
|
|
end
|
|
end
|
|
end
|
|
|
|
function E:StaticPopup_EditBoxOnEnterPressed()
|
|
if not self.autoCompleteParams or not AutoCompleteEditBox_OnEnterPressed(self) then
|
|
local parent = self:GetParent()
|
|
local owner = parent and parent:GetParent()
|
|
local which, dialog
|
|
|
|
if parent and parent.which then
|
|
which = parent.which
|
|
dialog = parent
|
|
elseif owner and owner.which then -- This is needed if this is a money input frame since it's nested deeper than a normal edit box
|
|
which = owner.which
|
|
dialog = owner
|
|
end
|
|
|
|
local popup = E.PopupDialogs[which]
|
|
local onEnterPressed = popup and popup.EditBoxOnEnterPressed
|
|
if onEnterPressed then
|
|
onEnterPressed(self, dialog.data)
|
|
end
|
|
end
|
|
end
|
|
|
|
function E:StaticPopup_EditBoxOnEscapePressed()
|
|
local parent = self:GetParent()
|
|
local popup = parent and E.PopupDialogs[parent.which]
|
|
local onEscapePressed = popup and popup.EditBoxOnEscapePressed
|
|
if onEscapePressed then
|
|
onEscapePressed(self, parent.data)
|
|
end
|
|
end
|
|
|
|
function E:StaticPopup_EditBoxOnTextChanged(userInput)
|
|
if not self.autoCompleteParams or not AutoCompleteEditBox_OnTextChanged(self, userInput) then
|
|
local parent = self:GetParent()
|
|
local popup = parent and E.PopupDialogs[parent.which]
|
|
local onTextChanged = popup and popup.EditBoxOnTextChanged
|
|
if onTextChanged then
|
|
onTextChanged(self, parent.data)
|
|
end
|
|
end
|
|
end
|
|
|
|
function E:StaticPopup_FindVisible(which, data)
|
|
local info = E.PopupDialogs[which]
|
|
if not info then return end
|
|
|
|
for index = 1, MAX_STATIC_POPUPS do
|
|
local frame = _G['ElvUI_StaticPopup'..index]
|
|
if frame and frame:IsShown() and (frame.which == which) and (not info.multiple or (frame.data == data)) then
|
|
return frame
|
|
end
|
|
end
|
|
end
|
|
|
|
function E:StaticPopup_Resize(dialog, which)
|
|
local info = E.PopupDialogs[which]
|
|
if not info then return end
|
|
|
|
local dialogName = dialog:GetName()
|
|
local text = _G[dialogName..'Text']
|
|
local editBox = _G[dialogName..'EditBox']
|
|
local button1 = _G[dialogName..'Button1']
|
|
|
|
local maxHeightSoFar = dialog.maxHeightSoFar or 0
|
|
local maxWidthSoFar = dialog.maxWidthSoFar or 0
|
|
local width = 320
|
|
|
|
if dialog.numButtons == 4 then
|
|
width = 574
|
|
elseif dialog.numButtons == 3 then
|
|
width = 440
|
|
elseif info.showAlert or info.showAlertGear or info.closeButton then
|
|
width = 420 -- Widen
|
|
elseif info.editBoxWidth and info.editBoxWidth > 260 then
|
|
width = width + (info.editBoxWidth - 260)
|
|
end
|
|
|
|
if width > maxWidthSoFar then
|
|
dialog:Width(width)
|
|
dialog.maxWidthSoFar = width
|
|
end
|
|
|
|
if info.wideText then
|
|
dialog.text:Width(360)
|
|
dialog.SubText:Width(360)
|
|
else
|
|
dialog.text:Width(290)
|
|
dialog.SubText:Width(290)
|
|
end
|
|
|
|
local height = 32 + (text and text:GetHeight() or 0) + 8 + button1:GetHeight()
|
|
if info.hasEditBox then
|
|
height = height + 8 + editBox:GetHeight()
|
|
elseif info.hasMoneyFrame then
|
|
height = height + 16
|
|
elseif info.hasMoneyInputFrame then
|
|
height = height + 22
|
|
end
|
|
|
|
if info.hasItemFrame then
|
|
height = height + (info.compactItemFrame and 44 or 64)
|
|
end
|
|
|
|
if info.hasCheckButton then
|
|
height = height + 32
|
|
end
|
|
|
|
if height > maxHeightSoFar then
|
|
dialog:Height(height)
|
|
dialog.maxHeightSoFar = height
|
|
end
|
|
end
|
|
|
|
function E:StaticPopup_OnEvent()
|
|
self.maxHeightSoFar = 0
|
|
|
|
E:StaticPopup_Resize(self, self.which)
|
|
end
|
|
|
|
local tempButtonLocs = {} --So we don't make a new table each time.
|
|
function E:StaticPopup_Show(which, text_arg1, text_arg2, data)
|
|
local info = E.PopupDialogs[which]
|
|
if not info then return end
|
|
|
|
if UnitIsDeadOrGhost('player') and not info.whileDead then
|
|
if info.OnCancel then
|
|
info.OnCancel()
|
|
end
|
|
|
|
return
|
|
end
|
|
|
|
if InCinematic() and not info.interruptCinematic then
|
|
if info.OnCancel then
|
|
info.OnCancel()
|
|
end
|
|
|
|
return
|
|
end
|
|
|
|
if info.cancels then
|
|
for index = 1, MAX_STATIC_POPUPS do
|
|
local frame = _G['ElvUI_StaticPopup'..index]
|
|
if frame:IsShown() and (frame.which == info.cancels) then
|
|
frame:Hide()
|
|
|
|
local popup = E.PopupDialogs[frame.which]
|
|
local OnCancel = popup and popup.OnCancel
|
|
if OnCancel then
|
|
OnCancel(frame, frame.data, 'override')
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Pick a free dialog to use, find an open dialog of the requested type
|
|
local dialog = E:StaticPopup_FindVisible(which, data)
|
|
if dialog then
|
|
if not info.noCancelOnReuse then
|
|
local OnCancel = info.OnCancel
|
|
if OnCancel then
|
|
OnCancel(dialog, dialog.data, 'override')
|
|
end
|
|
end
|
|
|
|
dialog:Hide()
|
|
else -- Find a free dialog
|
|
local index = 1
|
|
if info.preferredIndex then
|
|
index = info.preferredIndex
|
|
end
|
|
|
|
for i = index, MAX_STATIC_POPUPS do
|
|
local frame = _G['ElvUI_StaticPopup'..i]
|
|
if frame and not frame:IsShown() then
|
|
dialog = frame
|
|
break
|
|
end
|
|
end
|
|
|
|
--If dialog not found and there's a preferredIndex then try to find an available frame before the preferredIndex
|
|
if not dialog and info.preferredIndex then
|
|
for i = 1, info.preferredIndex do
|
|
local frame = _G['ElvUI_StaticPopup'..i]
|
|
if frame and not frame:IsShown() then
|
|
dialog = frame
|
|
break
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
if not dialog then
|
|
if info.OnCancel then
|
|
info.OnCancel()
|
|
end
|
|
|
|
return
|
|
end
|
|
|
|
dialog.maxHeightSoFar, dialog.maxWidthSoFar = 0, 0
|
|
|
|
-- Set the text of the dialog
|
|
local dialogName = dialog:GetName()
|
|
local text = _G[dialogName..'Text']
|
|
if text then
|
|
text:SetFormattedText(info.text, text_arg1, text_arg2)
|
|
end
|
|
|
|
-- Show or hide the close button
|
|
local closeButton = _G[dialogName..'CloseButton']
|
|
if info.closeButton then
|
|
if info.closeButtonIsHide then
|
|
closeButton:SetNormalTexture([[Interface\Buttons\UI-Panel-HideButton-Up]])
|
|
closeButton:SetPushedTexture([[Interface\Buttons\UI-Panel-HideButton-Down]])
|
|
else
|
|
closeButton:SetNormalTexture([[Interface\Buttons\UI-Panel-MinimizeButton-Up]])
|
|
closeButton:SetPushedTexture([[Interface\Buttons\UI-Panel-MinimizeButton-Down]])
|
|
end
|
|
|
|
closeButton:Show()
|
|
else
|
|
closeButton:Hide()
|
|
end
|
|
|
|
-- Set the editbox of the dialog
|
|
local editBox = _G[dialogName..'EditBox']
|
|
if info.hasEditBox then
|
|
editBox:Show()
|
|
|
|
if info.maxLetters then
|
|
editBox:SetMaxLetters(info.maxLetters)
|
|
editBox:SetCountInvisibleLetters(info.countInvisibleLetters)
|
|
end
|
|
|
|
if info.maxBytes then
|
|
editBox:SetMaxBytes(info.maxBytes)
|
|
end
|
|
|
|
editBox:Width(info.editBoxWidth or 130)
|
|
else
|
|
editBox:Hide()
|
|
end
|
|
|
|
-- Show or hide money frame
|
|
local moneyFrame = _G[dialogName..'MoneyFrame']
|
|
local moneyInputFrame = _G[dialogName..'MoneyInputFrame']
|
|
if info.hasMoneyFrame then
|
|
moneyFrame:Show()
|
|
moneyInputFrame:Hide()
|
|
elseif info.hasMoneyInputFrame then
|
|
moneyInputFrame:Show()
|
|
moneyFrame:Hide()
|
|
|
|
-- Set OnEnterPress for money input frames
|
|
if info.EditBoxOnEnterPressed then
|
|
moneyInputFrame.gold:SetScript('OnEnterPressed', E.StaticPopup_EditBoxOnEnterPressed)
|
|
moneyInputFrame.silver:SetScript('OnEnterPressed', E.StaticPopup_EditBoxOnEnterPressed)
|
|
moneyInputFrame.copper:SetScript('OnEnterPressed', E.StaticPopup_EditBoxOnEnterPressed)
|
|
else
|
|
moneyInputFrame.gold:SetScript('OnEnterPressed', nil)
|
|
moneyInputFrame.silver:SetScript('OnEnterPressed', nil)
|
|
moneyInputFrame.copper:SetScript('OnEnterPressed', nil)
|
|
end
|
|
else
|
|
moneyFrame:Hide()
|
|
moneyInputFrame:Hide()
|
|
end
|
|
|
|
-- Show or hide item button
|
|
local itemFrame = _G[dialogName..'ItemFrame']
|
|
local itemFrameCount = _G[dialogName..'ItemFrameCount']
|
|
if info.hasItemFrame then
|
|
itemFrame:Show()
|
|
|
|
if data and type(data) == 'table' then
|
|
itemFrame.link = data.link
|
|
|
|
local iconTexture = _G[dialogName..'ItemFrameIconTexture']
|
|
if iconTexture then
|
|
iconTexture:SetTexture(data.texture)
|
|
end
|
|
|
|
local nameText = _G[dialogName..'ItemFrameText']
|
|
if nameText then
|
|
nameText:SetTextColor(unpack(data.color or fallback_color))
|
|
nameText:SetText(data.name)
|
|
end
|
|
|
|
if data.count and data.count > 1 then
|
|
itemFrameCount:SetText(data.count)
|
|
itemFrameCount:Show()
|
|
else
|
|
itemFrameCount:Hide()
|
|
end
|
|
end
|
|
else
|
|
itemFrame:Hide()
|
|
end
|
|
|
|
-- Set the miscellaneous variables for the dialog
|
|
dialog.which = which
|
|
dialog.timeleft = info.timeout
|
|
dialog.hideOnEscape = info.hideOnEscape
|
|
dialog.exclusive = info.exclusive
|
|
dialog.enterClicksFirstButton = info.enterClicksFirstButton
|
|
|
|
-- Set the buttons of the dialog
|
|
local button1 = _G[dialogName..'Button1']
|
|
local button2 = _G[dialogName..'Button2']
|
|
local button3 = _G[dialogName..'Button3']
|
|
local button4 = _G[dialogName..'Button4']
|
|
|
|
do --If there is any recursion in this block, we may get errors (tempButtonLocs is static). If you have to recurse, we'll have to create a new table each time.
|
|
assert(#tempButtonLocs == 0) --If this fails, we're recursing. (See the table.wipe at the end of the block)
|
|
|
|
tinsert(tempButtonLocs, button1)
|
|
tinsert(tempButtonLocs, button2)
|
|
tinsert(tempButtonLocs, button3)
|
|
tinsert(tempButtonLocs, button4)
|
|
|
|
for i = #tempButtonLocs, 1, -1 do
|
|
local tempButtonLoc = tempButtonLocs[i]
|
|
|
|
--Do this stuff before we move it. (This is why we go back-to-front)
|
|
tempButtonLoc:SetText(info['button'..i])
|
|
tempButtonLoc:Hide()
|
|
tempButtonLoc:ClearAllPoints()
|
|
|
|
--Now we possibly remove it.
|
|
if not (info['button'..i] and (not info['DisplayButton'..i] or info['DisplayButton'..i](dialog))) then
|
|
tremove(tempButtonLocs, i)
|
|
end
|
|
end
|
|
|
|
--Save off the number of buttons.
|
|
local numButtons = #tempButtonLocs
|
|
dialog.numButtons = numButtons
|
|
|
|
if numButtons == 4 then
|
|
tempButtonLocs[1]:SetPoint('BOTTOMRIGHT', dialog, 'BOTTOM', -139, 16);
|
|
elseif numButtons == 3 then
|
|
tempButtonLocs[1]:Point('BOTTOMRIGHT', dialog, 'BOTTOM', -72, 16)
|
|
elseif numButtons == 2 then
|
|
tempButtonLocs[1]:Point('BOTTOMRIGHT', dialog, 'BOTTOM', -6, 16)
|
|
elseif numButtons == 1 then
|
|
tempButtonLocs[1]:Point('BOTTOM', dialog, 'BOTTOM', 0, 16)
|
|
end
|
|
|
|
for i = 1, numButtons do
|
|
local tempButtonLoc = tempButtonLocs[i]
|
|
|
|
if i > 1 then
|
|
tempButtonLoc:Point('LEFT', tempButtonLocs[i-1], 'RIGHT', 13, 0)
|
|
end
|
|
|
|
local width = tempButtonLoc:GetTextWidth()
|
|
if width > 110 then
|
|
tempButtonLoc:Width(width + 20)
|
|
else
|
|
tempButtonLoc:Width(120)
|
|
end
|
|
|
|
tempButtonLoc:Enable()
|
|
tempButtonLoc:Show()
|
|
end
|
|
|
|
wipe(tempButtonLocs)
|
|
end
|
|
|
|
-- Show or hide the alert icon
|
|
local alertIcon = _G[dialogName..'AlertIcon']
|
|
if info.showAlert then
|
|
alertIcon:SetTexture(STATICPOPUP_TEXTURE_ALERT)
|
|
alertIcon:Point('LEFT', 24, button3:IsShown() and 10 or 0)
|
|
alertIcon:Show()
|
|
elseif info.showAlertGear then
|
|
alertIcon:SetTexture(STATICPOPUP_TEXTURE_ALERTGEAR)
|
|
alertIcon:Point('LEFT', 24, 0)
|
|
alertIcon:Show()
|
|
else
|
|
alertIcon:SetTexture()
|
|
alertIcon:Hide()
|
|
end
|
|
|
|
-- Show or hide the checkbox
|
|
local checkButton = _G[dialogName..'CheckButton']
|
|
local checkButtonText = _G[dialogName..'CheckButtonText']
|
|
if info.hasCheckButton then
|
|
checkButton:ClearAllPoints()
|
|
checkButton:Point('BOTTOMLEFT', 24, 20 + button1:GetHeight())
|
|
|
|
if info.checkButtonText then
|
|
checkButtonText:SetText(info.checkButtonText)
|
|
checkButtonText:Show()
|
|
else
|
|
checkButtonText:Hide()
|
|
end
|
|
|
|
checkButton:Show()
|
|
else
|
|
checkButton:Hide()
|
|
end
|
|
|
|
if info.StartDelay then
|
|
dialog.startDelay = info.StartDelay()
|
|
button1:Disable()
|
|
else
|
|
dialog.startDelay = nil
|
|
button1:Enable()
|
|
end
|
|
|
|
if info.acceptDelay then
|
|
dialog.acceptDelay = info.acceptDelay
|
|
button1:Disable()
|
|
else
|
|
dialog.acceptDelay = nil
|
|
button1:Enable()
|
|
end
|
|
|
|
editBox.autoCompleteParams = info.autoCompleteParams
|
|
editBox.autoCompleteRegex = info.autoCompleteRegex
|
|
editBox.autoCompleteFormatRegex = info.autoCompleteFormatRegex
|
|
editBox.addHighlightedText = true
|
|
|
|
-- Finally size and show the dialog
|
|
E:StaticPopup_SetUpPosition(dialog)
|
|
dialog:Show()
|
|
|
|
E:StaticPopup_Resize(dialog, which)
|
|
|
|
if info.sound then
|
|
PlaySound(info.sound)
|
|
end
|
|
|
|
return dialog
|
|
end
|
|
|
|
function E:StaticPopup_Hide(which, data)
|
|
for index = 1, MAX_STATIC_POPUPS do
|
|
local dialog = _G['ElvUI_StaticPopup'..index]
|
|
if dialog.which == which and (not data or (data == dialog.data)) then
|
|
dialog:Hide()
|
|
end
|
|
end
|
|
end
|
|
|
|
function E:StaticPopup_ButtonOnClick()
|
|
local id = self:GetID()
|
|
local parent = self:GetParent()
|
|
E.StaticPopup_OnClick(parent, id)
|
|
end
|
|
|
|
function E:StaticPopup_CheckButtonOnClick()
|
|
local parent = self:GetParent()
|
|
local which = parent and parent.which
|
|
local info = E.PopupDialogs[which]
|
|
if not info then return end
|
|
|
|
self:SetChecked(self:GetChecked())
|
|
|
|
if info.checkButtonOnClick then
|
|
info.checkButtonOnClick(self)
|
|
end
|
|
end
|
|
|
|
-- Static popup secure buttons
|
|
local SecureButtons = {}
|
|
local SecureOnEnter = function(frame) frame.text:SetTextColor(1, 1, 1) end
|
|
local SecureOnLeave = function(frame) frame.text:SetTextColor(1, 0.2, 0.2) end
|
|
function E:StaticPopup_CreateSecureButton(popup, button, text, attributes)
|
|
local btn = CreateFrame('Button', nil, popup, 'SecureActionButtonTemplate')
|
|
btn:RegisterForClicks('AnyUp', 'AnyDown')
|
|
btn:SetAllPoints(button)
|
|
btn:SetSize(button:GetSize())
|
|
btn:HookScript('OnEnter', SecureOnEnter)
|
|
btn:HookScript('OnLeave', SecureOnLeave)
|
|
S:HandleButton(btn)
|
|
|
|
for key, value in next, attributes do
|
|
btn:SetAttribute(key, value)
|
|
end
|
|
|
|
local t = btn:CreateFontString(nil, 'OVERLAY')
|
|
t:Point('CENTER', 0, 1)
|
|
t:FontTemplate(nil, nil, 'SHADOW')
|
|
t:SetJustifyH('CENTER')
|
|
t:SetText(text)
|
|
btn.text = t
|
|
|
|
btn:SetFontString(t)
|
|
btn:SetTemplate(nil, true)
|
|
SecureOnLeave(btn)
|
|
|
|
return btn
|
|
end
|
|
|
|
function E:StaticPopup_GetAllSecureButtons()
|
|
return SecureButtons
|
|
end
|
|
|
|
function E:StaticPopup_GetSecureButton(which)
|
|
return SecureButtons[which]
|
|
end
|
|
|
|
function E:StaticPopup_PositionSecureButton(popup, popupButton, secureButton)
|
|
secureButton:SetParent(popup)
|
|
secureButton:SetAllPoints(popupButton)
|
|
secureButton:SetSize(popupButton:GetSize())
|
|
end
|
|
|
|
function E:StaticPopup_SetSecureButton(which, btn)
|
|
if SecureButtons[which] then
|
|
error('A secure StaticPopup Button called `'..which..'` already exists.')
|
|
end
|
|
|
|
SecureButtons[which] = btn
|
|
end
|
|
|
|
function E:StaticPopup_HandleButton(button)
|
|
if not button then return end
|
|
|
|
button:OffsetFrameLevel(1)
|
|
button:SetScript('OnClick', E.StaticPopup_ButtonOnClick)
|
|
S:HandleButton(button)
|
|
end
|
|
|
|
function E:Contruct_StaticPopups()
|
|
E.StaticPopupFrames = {}
|
|
|
|
for index = 1, MAX_STATIC_POPUPS do
|
|
local popup = CreateFrame('Frame', 'ElvUI_StaticPopup'..index, E.UIParent, E.Retail and '' or 'StaticPopupTemplate')
|
|
|
|
popup:SetScript('OnShow', E.StaticPopup_OnShow)
|
|
popup:SetScript('OnHide', E.StaticPopup_OnHide)
|
|
popup:SetScript('OnEvent', E.StaticPopup_OnEvent)
|
|
popup:SetScript('OnUpdate', E.StaticPopup_OnUpdate)
|
|
|
|
if popup.Border then
|
|
popup.Border:StripTextures()
|
|
end
|
|
|
|
popup:SetTemplate('Transparent')
|
|
popup:SetID(index)
|
|
|
|
local frame = _G['ElvUI_StaticPopup'..index]
|
|
local checkbutton = CreateFrame('CheckButton', 'ElvUI_StaticPopup'..index..'CheckButton', frame, 'UICheckButtonTemplate')
|
|
if checkbutton then
|
|
checkbutton:SetScript('OnClick', E.StaticPopup_CheckButtonOnClick)
|
|
checkbutton:Size(24)
|
|
|
|
S:HandleCheckBox(checkbutton)
|
|
|
|
local checkbuttontext = _G['ElvUI_StaticPopup'..index..'CheckButtonText']
|
|
if checkbuttontext then
|
|
checkbuttontext:FontTemplate(nil, nil, 'SHADOW')
|
|
checkbuttontext:SetTextColor(1,0.17,0.26)
|
|
checkbuttontext:Point('LEFT', checkbutton, 'RIGHT', 4, 1)
|
|
end
|
|
end
|
|
|
|
for i = 1, 4 do
|
|
local button = _G['ElvUI_StaticPopup'..index..'Button'..i]
|
|
if button then
|
|
E:StaticPopup_HandleButton()
|
|
end
|
|
end
|
|
|
|
local extraButton = _G['ElvUI_StaticPopup'..index..'ExtraButton']
|
|
if extraButton then
|
|
E:StaticPopup_HandleButton(extraButton)
|
|
end
|
|
|
|
local moneyInputFrame = _G['ElvUI_StaticPopup'..index..'MoneyInputFrame']
|
|
if moneyInputFrame then
|
|
S:HandleEditBox(moneyInputFrame.gold)
|
|
S:HandleEditBox(moneyInputFrame.silver)
|
|
S:HandleEditBox(moneyInputFrame.copper)
|
|
end
|
|
|
|
local editbox = _G['ElvUI_StaticPopup'..index..'EditBox']
|
|
if editbox then
|
|
editbox:SetScript('OnEnterPressed', E.StaticPopup_EditBoxOnEnterPressed)
|
|
editbox:SetScript('OnEscapePressed', E.StaticPopup_EditBoxOnEscapePressed)
|
|
editbox:SetScript('OnTextChanged', E.StaticPopup_EditBoxOnTextChanged)
|
|
editbox:OffsetFrameLevel(1)
|
|
|
|
S:HandleEditBox(editbox)
|
|
|
|
editbox.backdrop:Point('TOPLEFT', -2, -4)
|
|
editbox.backdrop:Point('BOTTOMRIGHT', 2, 4)
|
|
end
|
|
|
|
local nameFrame = _G['ElvUI_StaticPopup'..index..'ItemFrameNameFrame']
|
|
if nameFrame then
|
|
nameFrame:Kill()
|
|
end
|
|
|
|
local itemFrame = _G['ElvUI_StaticPopup'..index..'ItemFrame']
|
|
if itemFrame then
|
|
itemFrame:GetNormalTexture():Kill()
|
|
itemFrame:SetTemplate()
|
|
itemFrame:StyleButton()
|
|
end
|
|
|
|
local iconTexture = _G['ElvUI_StaticPopup'..index..'ItemFrameIconTexture']
|
|
if iconTexture then
|
|
iconTexture:SetTexCoord(unpack(E.TexCoords))
|
|
iconTexture:SetInside()
|
|
end
|
|
|
|
E.StaticPopupFrames[index] = popup
|
|
end
|
|
|
|
if _G.StaticPopup_SetUpPosition then
|
|
E:SecureHook('StaticPopup_SetUpPosition')
|
|
end
|
|
|
|
if _G.StaticPopup_CollapseTable then
|
|
E:SecureHook('StaticPopup_CollapseTable')
|
|
end
|
|
end
|
|
|