public
Description: WoW Addon - Square Minimap and more
Homepage: http://www.tekkub.net/
Clone URL: git://github.com/tekkub/squeenix.git
Click here to lend your support to: squeenix and make a donation at www.pledgie.com !
squeenix / Hidebuttons.lua
100644 73 lines (52 sloc) 2.627 kb
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
if not Squeenix then return end
 
 
----------------------
-- Locals --
----------------------
 
local Squeenix = Squeenix
local tekcheck = LibStub("tekKonfig-Checkbox")
local frames = {MinimapToggleButton = "close button", GameTimeFrame = "calendar", MinimapZoneTextButton = "zone text", MiniMapWorldMapButton = "world map", MiniMapVoiceChatFrame = "voice chat", MiniMapTracking = "tracking"}
local GAP = 8
 
 
------------------------------
-- Initialization --
------------------------------
 
local mailshow = MiniMapMailFrame.Show
function Squeenix:HideButtons()
if self.db.hideMinimapZoom then MinimapZoomIn:Hide(); MinimapZoomOut:Hide() else MinimapZoomIn:Show(); MinimapZoomOut:Show() end
if self.db.hideMiniMapMailFrame then
MiniMapMailFrame.Show = MiniMapMailFrame.Hide
MiniMapMailFrame:Hide()
else
MiniMapMailFrame.Show = mailshow
if HasNewMail() then MiniMapMailFrame:Show() end
end
for name in pairs(frames) do
if self.db["hide"..name] then _G[name]:Hide() else _G[name]:Show() end
end
end
 
 
---------------------
-- Panel --
---------------------
 
local frame = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer)
frame.name = "Minimap buttons"
frame.parent = "Squeenix"
frame:Hide()
frame:SetScript("OnShow", function(frame)
local Squeenix = Squeenix
local title, subtitle = LibStub("tekKonfig-Heading").new(frame, "Squeenix - Minimap buttons", "These settings allow you to hide the various buttons attached to the minimap.")
 
 
local zoom = tekcheck.new(frame, nil, "Show zoom buttons", "TOPLEFT", subtitle, "BOTTOMLEFT", -2, -GAP)
local checksound = zoom:GetScript("OnClick")
zoom:SetScript("OnClick", function(self) checksound(self); Squeenix.db.hideMinimapZoom = not Squeenix.db.hideMinimapZoom; Squeenix:HideButtons() end)
zoom:SetChecked(not Squeenix.db.hideMinimapZoom)
 
 
local mail = tekcheck.new(frame, nil, "Show new mail indicator", "TOPLEFT", zoom, "BOTTOMLEFT", 0, -GAP)
mail:SetScript("OnClick", function(self) checksound(self); Squeenix.db.hideMiniMapMailFrame = not Squeenix.db.hideMiniMapMailFrame; Squeenix:HideButtons() end)
mail:SetChecked(not Squeenix.db.hideMiniMapMailFrame)
 
 
local anchor = mail
for name,desc in pairs(frames) do
local check = tekcheck.new(frame, nil, "Show "..desc, "TOPLEFT", anchor, "BOTTOMLEFT", 0, -GAP)
check:SetScript("OnClick", function(self) checksound(self); Squeenix.db["hide"..name] = not Squeenix.db["hide"..name]; Squeenix:HideButtons() end)
check:SetChecked(not Squeenix.db["hide"..name])
anchor = check
end
 
 
frame:SetScript("OnShow", nil)
end)
 
InterfaceOptions_AddCategory(frame)