forked from dejoblue/DejaCharacterStats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDCSExpand.lua
127 lines (115 loc) · 5.2 KB
/
DCSExpand.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
local _, namespace = ... --localization
local L = namespace.L --localization
-- ------------------------------------------------
-- -- DCS Character Frame Expand/Collapse Button --
-- ------------------------------------------------
local DCS_tooltipText
local PaperDollFrame = PaperDollFrame
local CharacterFrame = CharacterFrame
local function DCS_ExpandCheck_OnEnter(self)
GameTooltip:SetOwner(PaperDollFrame.ExpandButton, "ANCHOR_RIGHT");
GameTooltip:SetText(DCS_tooltipText, 1, 1, 1, 1, true)
GameTooltip:Show()
end
local function DCS_ExpandCheck_OnLeave(self)
GameTooltip_Hide()
end
local _, gdbprivate = ...
gdbprivate.gdbdefaults.gdbdefaults.dejacharacterstatsExpandChecked = {
ExpandSetChecked = true,
}
PaperDollFrame.ExpandButton = CreateFrame("Button", nil, PaperDollFrame)
PaperDollFrame.ExpandButton:SetSize(32, 32)
PaperDollFrame.ExpandButton:SetPoint("BOTTOMLEFT", 298, 3)
--PaperDollFrame.ExpandButton:SetPoint("TOPRIGHT", CharacterTrinket1Slot, "BOTTOMRIGHT", 2, -3)
PaperDollFrame.ExpandButton:SetHighlightTexture("Interface\\BUTTONS\\UI-Common-MouseHilight")
PaperDollFrame.ExpandButton:SetScript("OnEnter", DCS_ExpandCheck_OnEnter)
PaperDollFrame.ExpandButton:SetScript("OnLeave", DCS_ExpandCheck_OnLeave)
PaperDollFrame.ExpandButton:SetScript("OnMouseUp", function (self)
if (CharacterFrame.Expanded) then
CharacterFrame_Collapse()
self:SetNormalTexture("Interface\\BUTTONS\\UI-SpellbookIcon-NextPage-Up")
self:SetPushedTexture("Interface\\BUTTONS\\UI-SpellbookIcon-NextPage-Down")
DCS_tooltipText = L['Show Character Stats'] --Creates a tooltip on mouseover.
gdbprivate.gdb.gdbdefaults.dejacharacterstatsExpandChecked.ExpandSetChecked = false
else
CharacterFrame_Expand()
self:SetNormalTexture("Interface\\BUTTONS\\UI-SpellbookIcon-PrevPage-Up")
self:SetPushedTexture("Interface\\BUTTONS\\UI-SpellbookIcon-PrevPage-Down")
DCS_tooltipText = L['Hide Character Stats'] --Creates a tooltip on mouseover.
gdbprivate.gdb.gdbdefaults.dejacharacterstatsExpandChecked.ExpandSetChecked = true
end
self.Collapsed = not CharacterFrame.Expanded
DCS_ExpandCheck_OnEnter()
end)
PaperDollFrame:HookScript("OnShow", function(self)
local checked = gdbprivate.gdb.gdbdefaults.dejacharacterstatsExpandChecked.ExpandSetChecked
if checked == true then
CharacterFrame_Expand()
PaperDollFrame.ExpandButton:SetNormalTexture("Interface\\BUTTONS\\UI-SpellbookIcon-PrevPage-Up")
PaperDollFrame.ExpandButton:SetPushedTexture("Interface\\BUTTONS\\UI-SpellbookIcon-PrevPage-Down")
DCS_tooltipText = L['Hide Character Stats'] --Creates a tooltip on mouseover.
else
CharacterFrame_Collapse()
PaperDollFrame.ExpandButton:SetNormalTexture("Interface\\BUTTONS\\UI-SpellbookIcon-NextPage-Up")
PaperDollFrame.ExpandButton:SetPushedTexture("Interface\\BUTTONS\\UI-SpellbookIcon-NextPage-Down")
DCS_tooltipText = L['Show Character Stats'] --Creates a tooltip on mouseover.
end
end)
--------------------------
-- Toggle Expand Button --
--------------------------
local _, gdbprivate = ...
gdbprivate.gdbdefaults.gdbdefaults.dejacharacterstatsExpandButtonChecked = {
ExpandButtonSetChecked = true,
}
local DCS_ExpandButtonCheck = CreateFrame("CheckButton", "DCS_ExpandButtonCheck", DejaCharacterStatsPanel, "InterfaceOptionsCheckButtonTemplate")
DCS_ExpandButtonCheck:RegisterEvent("PLAYER_LOGIN")
DCS_ExpandButtonCheck:ClearAllPoints()
DCS_ExpandButtonCheck:SetPoint("LEFT", 30, -205)
DCS_ExpandButtonCheck:SetScale(1)
DCS_ExpandButtonCheck.tooltipText = L['Displays the Expand button for the character stats frame.'] --Creates a tooltip on mouseover.
_G[DCS_ExpandButtonCheck:GetName() .. "Text"]:SetText(L["Expand"])
DCS_ExpandButtonCheck:SetScript("OnEvent", function(self, event)
if event == "PLAYER_LOGIN" then
local checked = gdbprivate.gdb.gdbdefaults.dejacharacterstatsExpandButtonChecked.ExpandButtonSetChecked
self:SetChecked(checked)
if checked then
PaperDollFrame.ExpandButton:Show()
else
PaperDollFrame.ExpandButton:Hide()
end
end
--[[
if event == "PLAYER_LOGIN" then
local checked = gdbprivate.gdb.gdbdefaults.dejacharacterstatsExpandButtonChecked
self:SetChecked(checked.ExpandButtonSetChecked)
if self:GetChecked(true) then
PaperDollFrame.ExpandButton:Show()
gdbprivate.gdb.gdbdefaults.dejacharacterstatsExpandButtonChecked.ExpandButtonSetChecked = true
else
PaperDollFrame.ExpandButton:Hide()
gdbprivate.gdb.gdbdefaults.dejacharacterstatsExpandButtonChecked.ExpandButtonSetChecked = false
end
end
--]]
end)
DCS_ExpandButtonCheck:SetScript("OnClick", function(self)
local checked = self:GetChecked()
gdbprivate.gdb.gdbdefaults.dejacharacterstatsExpandButtonChecked.ExpandButtonSetChecked = checked
if checked then
PaperDollFrame.ExpandButton:Show()
else
PaperDollFrame.ExpandButton:Hide()
end
--[[
local checked = gdbprivate.gdb.gdbdefaults.dejacharacterstatsExpandButtonChecked
if self:GetChecked(true) then
PaperDollFrame.ExpandButton:Show()
gdbprivate.gdb.gdbdefaults.dejacharacterstatsExpandButtonChecked.ExpandButtonSetChecked = true
else
PaperDollFrame.ExpandButton:Hide()
gdbprivate.gdb.gdbdefaults.dejacharacterstatsExpandButtonChecked.ExpandButtonSetChecked = false
end
--]]
end)