-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathGUI_Reset.lua
110 lines (89 loc) · 3.31 KB
/
GUI_Reset.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
local Recount = _G.Recount
local AceLocale = LibStub("AceLocale-3.0")
local L = AceLocale:GetLocale("Recount")
local revision = tonumber(string.sub("$Revision: 1563 $", 12, -3))
if Recount.Version < revision then
Recount.Version = revision
end
local CreateFrame = CreateFrame
local UIParent = UIParent
local me = {}
function me:CreateResetWindow()
me.ResetFrame = CreateFrame("Frame", nil, UIParent, BackdropTemplateMixin and "BackdropTemplate")
local theFrame = me.ResetFrame
theFrame:ClearAllPoints()
theFrame:SetPoint("CENTER",UIParent)
theFrame:SetHeight(78)
theFrame:SetWidth(200)
theFrame:SetBackdrop({
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16,
edgeFile = "Interface\\AddOns\\Recount\\textures\\otravi-semi-full-border", edgeSize = 32,
insets = {left = 1, right = 1, top = 20, bottom = 1},
})
theFrame:SetBackdropBorderColor(1.0, 0.0, 0.0)
theFrame:SetBackdropColor(24 / 255, 24 / 255, 24 / 255)
Recount.Colors:RegisterBorder("Other Windows","Title",theFrame)
Recount.Colors:RegisterBackground("Other Windows","Background",theFrame)
theFrame:EnableMouse(true)
theFrame:SetMovable(true)
theFrame:SetScript("OnMouseDown", function(this, button)
if (((not this.isLocked) or (this.isLocked == 0)) and (button == "LeftButton")) then
Recount:SetWindowTop(this)
this:StartMoving()
this.isMoving = true
end
end)
theFrame:SetScript("OnMouseUp", function(this)
if (this.isMoving) then
this:StopMovingOrSizing()
this.isMoving = false
end
end)
theFrame:SetScript("OnShow", function(this)
Recount:SetWindowTop(this)
end)
theFrame:SetScript("OnHide", function(this)
if (this.isMoving) then
this:StopMovingOrSizing()
this.isMoving = false
end
end)
theFrame.Title = theFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
theFrame.Title:SetPoint("TOPLEFT", theFrame, "TOPLEFT", 6, -15)
theFrame.Title:SetTextColor(1.0, 1.0, 1.0, 1.0)
theFrame.Title:SetText(L["Reset Recount?"])
Recount:AddFontString(theFrame.Title)
--Recount.Colors:UnregisterItem(me.ResetFrame.Title)
Recount.Colors:RegisterFont("Other Windows", "Title Text", me.ResetFrame.Title)
theFrame.Text = theFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
theFrame.Text:SetPoint("CENTER", theFrame, "CENTER", 0, -3)
theFrame.Text:SetTextColor(1.0, 1.0, 1.0)
theFrame.Text:SetText(L["Do you wish to reset the data?"])
Recount:AddFontString(theFrame.Text)
theFrame.YesButton = CreateFrame("Button", nil, theFrame, "UIPanelButtonTemplate")
theFrame.YesButton:SetWidth(90)
theFrame.YesButton:SetHeight(24)
theFrame.YesButton:SetPoint("BOTTOMRIGHT", theFrame, "BOTTOM", -4, 4)
theFrame.YesButton:SetScript("OnClick", function()
Recount:ResetData()theFrame:Hide()
end)
theFrame.YesButton:SetText(L["Yes"])
theFrame.NoButton = CreateFrame("Button", nil, theFrame, "UIPanelButtonTemplate")
theFrame.NoButton:SetWidth(90)
theFrame.NoButton:SetHeight(24)
theFrame.NoButton:SetPoint("BOTTOMLEFT", theFrame, "BOTTOM", 4, 4)
theFrame.NoButton:SetScript("OnClick", function()
theFrame:Hide()
end)
theFrame.NoButton:SetText(L["No"])
theFrame:Hide()
theFrame:SetFrameStrata("DIALOG")
--Need to add it to our window ordering system
Recount:AddWindow(theFrame)
end
function Recount:ShowReset()
if me.ResetFrame == nil then
me:CreateResetWindow()
end
me.ResetFrame:Show()
end