return "set" |
end |
end |
do |
local frame = AceConfigDialog.popup |
if not frame then |
frame = CreateFrame("Frame", nil, UIParent) |
AceConfigDialog.popup = frame |
frame:Hide() |
frame:SetPoint("CENTER", UIParent, "CENTER") |
frame:SetSize(320, 72) |
frame:SetFrameStrata("TOOLTIP") |
frame:SetScript("OnKeyDown", function(self, key) |
if key == "ESCAPE" then |
self:SetPropagateKeyboardInput(false) |
if self.cancel:IsShown() then |
self.cancel:Click() |
else -- Showing a validation error |
self:Hide() |
end |
else |
self:SetPropagateKeyboardInput(true) |
end |
end) |
|
local border = CreateFrame("Frame", nil, frame, "DialogBorderDarkTemplate") |
border:SetAllPoints(frame) |
|
local text = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlight") |
text:SetSize(290, 0) |
text:SetPoint("TOP", 0, -16) |
frame.text = text |
|
local function newButton(text) |
local button = CreateFrame("Button", nil, frame) |
button:SetSize(128, 21) |
button:SetNormalFontObject(GameFontNormal) |
button:SetHighlightFontObject(GameFontHighlight) |
button:SetNormalTexture(130763) -- "Interface\\Buttons\\UI-DialogBox-Button-Up" |
button:GetNormalTexture():SetTexCoord(0.0, 1.0, 0.0, 0.71875) |
button:SetPushedTexture(130761) -- "Interface\\Buttons\\UI-DialogBox-Button-Down" |
button:GetPushedTexture():SetTexCoord(0.0, 1.0, 0.0, 0.71875) |
button:SetHighlightTexture(130762) -- "Interface\\Buttons\\UI-DialogBox-Button-Highlight" |
button:GetHighlightTexture():SetTexCoord(0.0, 1.0, 0.0, 0.71875) |
button:SetText(text) |
return button |
end |
|
local accept = newButton(ACCEPT) |
accept:SetPoint("BOTTOMRIGHT", frame, "BOTTOM", -6, 16) |
frame.accept = accept |
|
local cancel = newButton(CANCEL) |
cancel:SetPoint("LEFT", accept, "RIGHT", 13, 0) |
frame.cancel = cancel |
end |
end |
local function confirmPopup(appName, rootframe, basepath, info, message, func, ...) |
if not StaticPopupDialogs["ACECONFIGDIALOG30_CONFIRM_DIALOG"] then |
StaticPopupDialogs["ACECONFIGDIALOG30_CONFIRM_DIALOG"] = {} |
end |
local t = StaticPopupDialogs["ACECONFIGDIALOG30_CONFIRM_DIALOG"] |
for k in pairs(t) do |
t[k] = nil |
end |
t.text = message |
t.button1 = ACCEPT |
t.button2 = CANCEL |
t.preferredIndex = STATICPOPUP_NUMDIALOGS |
local dialog, oldstrata |
t.OnAccept = function() |
safecall(func, unpack(t)) |
if dialog and oldstrata then |
dialog:SetFrameStrata(oldstrata) |
end |
local frame = AceConfigDialog.popup |
frame:Show() |
frame.text:SetText(message) |
-- From StaticPopup.lua |
-- local height = 32 + text:GetHeight() + 2; |
-- height = height + 6 + accept:GetHeight() |
-- We add 32 + 2 + 6 + 21 (button height) == 61 |
local height = 61 + frame.text:GetHeight() |
frame:SetHeight(height) |
|
frame.accept:ClearAllPoints() |
frame.accept:SetPoint("BOTTOMRIGHT", frame, "BOTTOM", -6, 16) |
frame.cancel:Show() |
|
local t = {...} |
local tCount = select("#", ...) |
frame.accept:SetScript("OnClick", function(self) |
safecall(func, unpack(t, 1, tCount)) -- Manually set count as unpack() stops on nil (bug with #table) |
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl)) |
frame:Hide() |
self:SetScript("OnClick", nil) |
frame.cancel:SetScript("OnClick", nil) |
del(info) |
end |
t.OnCancel = function() |
if dialog and oldstrata then |
dialog:SetFrameStrata(oldstrata) |
end |
end) |
frame.cancel:SetScript("OnClick", function(self) |
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl)) |
frame:Hide() |
self:SetScript("OnClick", nil) |
frame.accept:SetScript("OnClick", nil) |
del(info) |
end |
for i = 1, select("#", ...) do |
t[i] = select(i, ...) or false |
end |
t.timeout = 0 |
t.whileDead = 1 |
t.hideOnEscape = 1 |
|
dialog = StaticPopup_Show("ACECONFIGDIALOG30_CONFIRM_DIALOG") |
if dialog then |
oldstrata = dialog:GetFrameStrata() |
dialog:SetFrameStrata("TOOLTIP") |
end |
end) |
end |
|
local function validationErrorPopup(message) |
if not StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"] then |
StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"] = {} |
end |
local t = StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"] |
t.text = message |
t.button1 = OKAY |
t.preferredIndex = STATICPOPUP_NUMDIALOGS |
local dialog, oldstrata |
t.OnAccept = function() |
if dialog and oldstrata then |
dialog:SetFrameStrata(oldstrata) |
end |
end |
t.timeout = 0 |
t.whileDead = 1 |
t.hideOnEscape = 1 |
local frame = AceConfigDialog.popup |
frame:Show() |
frame.text:SetText(message) |
-- From StaticPopup.lua |
-- local height = 32 + text:GetHeight() + 2; |
-- height = height + 6 + accept:GetHeight() |
-- We add 32 + 2 + 6 + 21 (button height) == 61 |
local height = 61 + frame.text:GetHeight() |
frame:SetHeight(height) |
|
dialog = StaticPopup_Show("ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG") |
if dialog then |
oldstrata = dialog:GetFrameStrata() |
dialog:SetFrameStrata("TOOLTIP") |
end |
frame.accept:ClearAllPoints() |
frame.accept:SetPoint("BOTTOM", frame, "BOTTOM", 0, 16) |
frame.cancel:Hide() |
|
frame.accept:SetScript("OnClick", function() |
frame:Hide() |
end) |
end |
|
local function ActivateControl(widget, event, ...) |