forked from endymonium/keystrokelauncher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Templates.xml
179 lines (163 loc) · 6.5 KB
/
Templates.xml
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<!-- /*******************/ CUSTOM TEMPLATES /*************************/ -->
<!-- nice icon button template -->
<Button name="KLR_IconButtonTemplate" virtual="true">
<NormalTexture file="Interface\Buttons\UI-SquareButton-Up" desaturated="true">
<Color r="0.75" g="0.75" b="0.75"/>
</NormalTexture>
<PushedTexture file="Interface\Buttons\UI-SquareButton-Down" desaturated="true">
<Color r="0.75" g="0.75" b="0.75"/>
</PushedTexture>
<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD" alpha="0.75">
<Anchors>
<Anchor point="TOPLEFT" x="2" y="-2"/>
<Anchor point="BOTTOMRIGHT" x="-2" y="2"/>
</Anchors>
</HighlightTexture>
</Button>
<Frame name="KLR_IconButtonPositionScripts" virtual="true">
<!-- icon position adaptation scripts -->
<Scripts>
<OnMouseDown>
<!-- nudge and dim the icon down a little -->
local xOffset = -1;
if (self.name == "UndoButton") then xOffset = -2; end
local yOffset = -2;
if (self.name == "UndoButton") then yOffset = -3; end
if (self.name == "CategoryButton") then yOffset = -3; end
self.Icon:SetPoint("CENTER", xOffset, yOffset) self.Icon:SetAlpha(0.5)
</OnMouseDown>
<OnMouseUp>
<!-- reset the icon's position and opacity -->
local xOffset = 0;
if (self.name == "UndoButton") then xOffset = -0.5; end
if (self.name == "CategoryButton") then xOffset = 0.5; end
local yOffset = 0;
if (self.name == "UndoButton") then yOffset = -0.5; end
if (self.name == "CategoryButton") then yOffset = -1; end
self.Icon:SetPoint("CENTER", xOffset, yOffset) self.Icon:SetAlpha(1)
</OnMouseUp>
<OnShow>
<!-- reset the icon's position and opacity -->
local xOffset = 0;
if (self.name == "UndoButton") then xOffset = -0.5; end
if (self.name == "CategoryButton") then xOffset = 0.5; end
local yOffset = 0;
if (self.name == "UndoButton") then yOffset = -0.5; end
if (self.name == "CategoryButton") then yOffset = -1; end
self.Icon:SetPoint("CENTER", xOffset, yOffset) self.Icon:SetAlpha(1)
</OnShow>
</Scripts>
</Frame>
<Frame name="KLR_IconButtonTooltipScripts" virtual="true">
<Frames>
<!-- small tooltip frame to describe use of the buttons -->
<Frame parentKey="MiniTooltip" frameStrata="TOOLTIP" hidden="true">
<Size x="0" y="26"/>
<Layers>
<Layer>
<FontString parentKey="Text" inherits="GameFontNormalSmall"/>
</Layer>
</Layers>
</Frame>
</Frames>
<!-- Tooltip associated scripts -->
<Scripts>
<OnLoad>
self.MiniTooltip.Backdrop = CreateFrame("Frame", nil, self.MiniTooltip, "BackdropTemplate")
self.MiniTooltip.Backdrop:SetAllPoints()
self.MiniTooltip.Backdrop.backdropInfo = {
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border",
tile = true,
tileSize = 16,
edgeSize = 16,
insets = { left = 2, right = 2, top = 2, bottom = 2, },
}
self.MiniTooltip.Backdrop:ApplyBackdrop()
self.MiniTooltip.Backdrop:SetBackdropColor(0.05, 0.05, 0.05, 1)
self.MiniTooltip.Backdrop:SetBackdropBorderColor(0.5, 0.5, 0.5, 1)
self.MiniTooltip.Backdrop:SetFrameStrata("DIALOG") -- lower strata than the text, so that is acts as a background (but over the other elements of the frame)
</OnLoad>
<OnEnter>
<!-- Show and reposition the tooltip -->
self.MiniTooltip.Text:SetText(self.tooltip)
self.MiniTooltip:SetWidth(self.MiniTooltip.Text:GetStringWidth()+16)
local _, n = string.gsub(self.tooltip, "\n", "")
if (n > 0) then
self.MiniTooltip:SetHeight(26 + n*10)
else
self.MiniTooltip:SetHeight(26)
end
if (self.name == "AddButton") then
self.MiniTooltip:SetPoint("BOTTOMRIGHT", self, "TOPRIGHT", 4, 7)
elseif (self.name == "TooltipResizeButton") then
self.MiniTooltip:SetPoint("BOTTOMRIGHT", self, "BOTTOMLEFT", -5, 0)
elseif (self.name == "ClearButton") then
self.MiniTooltip:SetPoint("BOTTOM", self, "TOP", 0, 0)
else
self.MiniTooltip:SetPoint("RIGHT", self, "LEFT", 0, 0)
end
self.MiniTooltip:Show()
</OnEnter>
<OnLeave>
<!-- Hide the tooltip -->
self.MiniTooltip:Hide()
</OnLeave>
</Scripts>
</Frame>
<!-- Frame Options button -->
<Button name="KLR_FrameOptionsButton" inherits="KLR_IconButtonTemplate, KLR_IconButtonTooltipScripts, KLR_IconButtonPositionScripts" virtual="true">
<Size x="25" y="25"/>
<KeyValues>
<KeyValue key="tooltip" value="locale"/>
<KeyValue key="name" value="FrameOptionsButton"/>
</KeyValues>
<Layers>
<Layer level="OVERLAY">
<Texture parentKey="Icon" file="Interface\BUTTONS\UI-GuildButton-OfficerNote-Up">
<Size x="15" y="15"/>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
</Texture>
</Layer>
</Layers>
</Button>
<!-- Help button -->
<Button name="KLR_HelpButton" inherits="InlineHyperlinkFrameTemplate, KLR_IconButtonTooltipScripts, KLR_IconButtonPositionScripts" virtual="true">
<Size x="25" y="25"/>
<KeyValues>
<KeyValue key="tooltip" value="locale"/>
<KeyValue key="name" value="HelpButton"/>
</KeyValues>
<Layers>
<Layer level="OVERLAY">
<Texture parentKey="Icon" file="Interface\COMMON\help-i">
<Size x="32" y="32"/>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
</Texture>
</Layer>
</Layers>
</Button>
<!-- Close button -->
<Button name="KLR_CloseButton" inherits="KLR_IconButtonTemplate, KLR_IconButtonPositionScripts" virtual="true">
<Size x="25" y="25"/>
<KeyValues>
<KeyValue key="name" value="CloseButton"/>
</KeyValues>
<Layers>
<Layer level="OVERLAY">
<Texture parentKey="Icon" file="Interface\Buttons\UI-StopButton">
<Size x="14" y="14"/>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
</Texture>
</Layer>
</Layers>
</Button>
</Ui>