forked from nimeral/AuctionatorVanilla
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUPT.txt
497 lines (493 loc) · 14.9 KB
/
UPT.txt
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
--- functions to manage tab interfaces where only one tab of a group may be selected
-function PanelTemplates_Tab_OnClick(self, frame)
- PanelTemplates_SetTab(frame, self:GetID())
-end
-
-function PanelTemplates_SetTab(frame, id)
- frame.selectedTab = id;
- PanelTemplates_UpdateTabs(frame);
-end
-
-function PanelTemplates_GetSelectedTab(frame)
- return frame.selectedTab;
-end
-
-function PanelTemplates_UpdateTabs(frame)
- if ( frame.selectedTab ) then
- local tab;
- for i=1, frame.numTabs, 1 do
- tab = _G[frame:GetName().."Tab"..i];
- if ( tab.isDisabled ) then
- PanelTemplates_SetDisabledTabState(tab);
- elseif ( i == frame.selectedTab ) then
- PanelTemplates_SelectTab(tab);
- else
- PanelTemplates_DeselectTab(tab);
- end
- end
- end
-end
-
-function PanelTemplates_GetTabWidth(tab)
- local tabName = tab:GetName();
-
- local sideWidths = 2 * _G[tabName.."Left"]:GetWidth();
- return tab:GetTextWidth() + sideWidths;
-end
-
-function PanelTemplates_TabResize(tab, padding, absoluteSize, minWidth, maxWidth, absoluteTextSize)
- local tabName = tab:GetName();
-
- local buttonMiddle = _G[tabName.."Middle"];
- local buttonMiddleDisabled = _G[tabName.."MiddleDisabled"];
- local sideWidths = 2 * _G[tabName.."Left"]:GetWidth();
- local tabText = _G[tab:GetName().."Text"];
- local width, tabWidth;
- local textWidth;
- if ( absoluteTextSize ) then
- textWidth = absoluteTextSize;
- else
- tabText:SetWidth(0);
- textWidth = tabText:GetWidth();
- end
- -- If there's an absolute size specified then use it
- if ( absoluteSize ) then
- if ( absoluteSize < sideWidths) then
- width = 1;
- tabWidth = sideWidths
- else
- width = absoluteSize - sideWidths;
- tabWidth = absoluteSize
- end
- tabText:SetWidth(width);
- else
- -- Otherwise try to use padding
- if ( padding ) then
- width = textWidth + padding;
- else
- width = textWidth + 24;
- end
- -- If greater than the maxWidth then cap it
- if ( maxWidth and width > maxWidth ) then
- if ( padding ) then
- width = maxWidth + padding;
- else
- width = maxWidth + 24;
- end
- tabText:SetWidth(width);
- else
- tabText:SetWidth(0);
- end
- if (minWidth and width < minWidth) then
- width = minWidth;
- end
- tabWidth = width + sideWidths;
- end
-
- if ( buttonMiddle ) then
- buttonMiddle:SetWidth(width);
- end
- if ( buttonMiddleDisabled ) then
- buttonMiddleDisabled:SetWidth(width);
- end
-
- tab:SetWidth(tabWidth);
- local highlightTexture = _G[tabName.."HighlightTexture"];
- if ( highlightTexture ) then
- highlightTexture:SetWidth(tabWidth);
- end
-end
-
-function PanelTemplates_SetNumTabs(frame, numTabs)
- frame.numTabs = numTabs;
-end
-
-function PanelTemplates_DisableTab(frame, index)
- _G[frame:GetName().."Tab"..index].isDisabled = 1;
- PanelTemplates_UpdateTabs(frame);
-end
-
-function PanelTemplates_EnableTab(frame, index)
- local tab = _G[frame:GetName().."Tab"..index];
- tab.isDisabled = nil;
- -- Reset text color
- tab:SetDisabledFontObject(GameFontHighlightSmall);
- PanelTemplates_UpdateTabs(frame);
-end
-
-function PanelTemplates_DeselectTab(tab)
- local name = tab:GetName();
- _G[name.."Left"]:Show();
- _G[name.."Middle"]:Show();
- _G[name.."Right"]:Show();
- --tab:UnlockHighlight();
- tab:Enable();
- _G[name.."Text"]:SetPoint("CENTER", tab, "CENTER", (tab.deselectedTextX or 0), (tab.deselectedTextY or 2));
-
- _G[name.."LeftDisabled"]:Hide();
- _G[name.."MiddleDisabled"]:Hide();
- _G[name.."RightDisabled"]:Hide();
-end
-
-function PanelTemplates_SelectTab(tab)
- local name = tab:GetName();
- _G[name.."Left"]:Hide();
- _G[name.."Middle"]:Hide();
- _G[name.."Right"]:Hide();
- --tab:LockHighlight();
- tab:Disable();
- tab:SetDisabledFontObject(GameFontHighlightSmall);
- _G[name.."Text"]:SetPoint("CENTER", tab, "CENTER", (tab.selectedTextX or 0), (tab.selectedTextY or -3));
-
- _G[name.."LeftDisabled"]:Show();
- _G[name.."MiddleDisabled"]:Show();
- _G[name.."RightDisabled"]:Show();
-
- if ( GameTooltip:IsOwned(tab) ) then
- GameTooltip:Hide();
- end
-end
-
-function PanelTemplates_SetDisabledTabState(tab)
- local name = tab:GetName();
- _G[name.."Left"]:Show();
- _G[name.."Middle"]:Show();
- _G[name.."Right"]:Show();
- --tab:UnlockHighlight();
- tab:Disable();
- tab.text = tab:GetText();
- -- Gray out text
- tab:SetDisabledFontObject(GameFontDisableSmall);
- _G[name.."LeftDisabled"]:Hide();
- _G[name.."MiddleDisabled"]:Hide();
- _G[name.."RightDisabled"]:Hide();
-end
-
-function ScrollFrameTemplate_OnMouseWheel(self, value, scrollBar)
- scrollBar = scrollBar or _G[self:GetName() .. "ScrollBar"];
- local scrollStep = scrollBar.scrollStep or scrollBar:GetHeight() / 2
- if ( value > 0 ) then
- scrollBar:SetValue(scrollBar:GetValue() - scrollStep);
- else
- scrollBar:SetValue(scrollBar:GetValue() + scrollStep);
- end
-end
-
--- Function to handle the update of manually calculated scrollframes. Used mostly for listings with an indeterminate number of items
-function FauxScrollFrame_Update(frame, numItems, numToDisplay, buttonHeight, button, smallWidth, bigWidth, highlightFrame, smallHighlightWidth, bigHighlightWidth, alwaysShowScrollBar )
- -- If more than one screen full of skills then show the scrollbar
- local frameName = frame:GetName();
- local scrollBar = _G[ frameName.."ScrollBar" ];
- local showScrollBar;
- if ( numItems > numToDisplay or alwaysShowScrollBar ) then
- frame:Show();
- showScrollBar = 1;
- else
- scrollBar:SetValue(0);
- frame:Hide();
- end
- if ( frame:IsShown() ) then
- local scrollChildFrame = _G[ frameName.."ScrollChildFrame" ];
- local scrollUpButton = _G[ frameName.."ScrollBarScrollUpButton" ];
- local scrollDownButton = _G[ frameName.."ScrollBarScrollDownButton" ];
- local scrollFrameHeight = 0;
- local scrollChildHeight = 0;
-
- if ( numItems > 0 ) then
- scrollFrameHeight = (numItems - numToDisplay) * buttonHeight;
- scrollChildHeight = numItems * buttonHeight;
- if ( scrollFrameHeight < 0 ) then
- scrollFrameHeight = 0;
- end
- scrollChildFrame:Show();
- else
- scrollChildFrame:Hide();
- end
- local maxRange = (numItems - numToDisplay) * buttonHeight;
- if (maxRange < 0) then
- maxRange = 0;
- end
- scrollBar:SetMinMaxValues(0, maxRange);
- scrollBar:SetValueStep(buttonHeight);
- scrollBar:SetStepsPerPage(numToDisplay-1);
- scrollChildFrame:SetHeight(scrollChildHeight);
-
- -- Arrow button handling
- if ( scrollBar:GetValue() == 0 ) then
- scrollUpButton:Disable();
- else
- scrollUpButton:Enable();
- end
- if ((scrollBar:GetValue() - scrollFrameHeight) == 0) then
- scrollDownButton:Disable();
- else
- scrollDownButton:Enable();
- end
-
- -- Shrink because scrollbar is shown
- if ( highlightFrame ) then
- highlightFrame:SetWidth(smallHighlightWidth);
- end
- if ( button ) then
- for i=1, numToDisplay do
- _G[button..i]:SetWidth(smallWidth);
- end
- end
- else
- -- Widen because scrollbar is hidden
- if ( highlightFrame ) then
- highlightFrame:SetWidth(bigHighlightWidth);
- end
- if ( button ) then
- for i=1, numToDisplay do
- _G[button..i]:SetWidth(bigWidth);
- end
- end
- end
- return showScrollBar;
-end
-
-function FauxScrollFrame_OnVerticalScroll(self, value, itemHeight, updateFunction)
- local scrollbar = _G[self:GetName().."ScrollBar"];
- scrollbar:SetValue(value);
- self.offset = floor((value / itemHeight) + 0.5);
- if ( updateFunction ) then
- updateFunction(self);
- end
-end
-
-function FauxScrollFrame_GetOffset(frame)
- return frame.offset;
-end
-
-function FauxScrollFrame_SetOffset(frame, offset)
- frame.offset = offset;
-end
-
--- Scrollframe functions
-function ScrollFrame_OnLoad(self)
- _G[self:GetName().."ScrollBarScrollDownButton"]:Disable();
- _G[self:GetName().."ScrollBarScrollUpButton"]:Disable();
-
- local scrollbar = _G[self:GetName().."ScrollBar"];
- scrollbar:SetMinMaxValues(0, 0);
- scrollbar:SetValue(0);
- self.offset = 0;
-
- if ( self.scrollBarHideable ) then
- _G[self:GetName().."ScrollBar"]:Hide();
- _G[scrollbar:GetName().."ScrollDownButton"]:Hide();
- _G[scrollbar:GetName().."ScrollUpButton"]:Hide();
- else
- _G[scrollbar:GetName().."ScrollDownButton"]:Disable();
- _G[scrollbar:GetName().."ScrollUpButton"]:Disable();
- _G[scrollbar:GetName().."ScrollDownButton"]:Show();
- _G[scrollbar:GetName().."ScrollUpButton"]:Show();
- end
- if ( self.noScrollThumb ) then
- _G[scrollbar:GetName().."ThumbTexture"]:Hide();
- end
-end
-
-function ScrollFrame_OnScrollRangeChanged(self, xrange, yrange)
- local scrollbar = self.ScrollBar or _G[self:GetName().."ScrollBar"];
- if ( not yrange ) then
- yrange = self:GetVerticalScrollRange();
- end
- local value = scrollbar:GetValue();
- if ( value > yrange ) then
- value = yrange;
- end
- scrollbar:SetMinMaxValues(0, yrange);
- scrollbar:SetValue(value);
- if ( floor(yrange) == 0 ) then
- if ( self.scrollBarHideable ) then
- _G[self:GetName().."ScrollBar"]:Hide();
- _G[scrollbar:GetName().."ScrollDownButton"]:Hide();
- _G[scrollbar:GetName().."ScrollUpButton"]:Hide();
- _G[scrollbar:GetName().."ThumbTexture"]:Hide();
- else
- _G[scrollbar:GetName().."ScrollDownButton"]:Disable();
- _G[scrollbar:GetName().."ScrollUpButton"]:Disable();
- _G[scrollbar:GetName().."ScrollDownButton"]:Show();
- _G[scrollbar:GetName().."ScrollUpButton"]:Show();
- if ( not self.noScrollThumb ) then
- _G[scrollbar:GetName().."ThumbTexture"]:Show();
- end
- end
- else
- _G[scrollbar:GetName().."ScrollDownButton"]:Show();
- _G[scrollbar:GetName().."ScrollUpButton"]:Show();
- _G[self:GetName().."ScrollBar"]:Show();
- if ( not self.noScrollThumb ) then
- _G[scrollbar:GetName().."ThumbTexture"]:Show();
- end
- -- The 0.005 is to account for precision errors
- if ( yrange - value > 0.005 ) then
- _G[scrollbar:GetName().."ScrollDownButton"]:Enable();
- else
- _G[scrollbar:GetName().."ScrollDownButton"]:Disable();
- end
- end
-
- -- Hide/show scrollframe borders
- local top = _G[self:GetName().."Top"];
- local bottom = _G[self:GetName().."Bottom"];
- local middle = _G[self:GetName().."Middle"];
- if ( top and bottom and self.scrollBarHideable ) then
- if ( self:GetVerticalScrollRange() == 0 ) then
- top:Hide();
- bottom:Hide();
- else
- top:Show();
- bottom:Show();
- end
- end
- if ( middle and self.scrollBarHideable ) then
- if ( self:GetVerticalScrollRange() == 0 ) then
- middle:Hide();
- else
- middle:Show();
- end
- end
-end
-
-function ScrollBar_AdjustAnchors(scrollBar, topAdj, bottomAdj, xAdj)
- -- assumes default anchoring of topleft-topright, bottomleft-bottomright
- local topY = 0;
- local bottomY = 0;
- local point, parent, refPoint, x, y;
- for i = 1, 2 do
- point, parent, refPoint, x, y = scrollBar:GetPoint(i);
- if ( point == "TOPLEFT" ) then
- topY = y;
- elseif ( point == "BOTTOMLEFT" ) then
- bottomY = y;
- end
- end
- xAdj = xAdj or 0;
- topAdj = topAdj or 0;
- bottomAdj = bottomAdj or 0;
- scrollBar:SetPoint("TOPLEFT", parent, "TOPRIGHT", x + xAdj, topY + topAdj);
- scrollBar:SetPoint("BOTTOMLEFT", parent, "BOTTOMRIGHT", x + xAdj, bottomY + bottomAdj);
-end
-
function ScrollingEdit_OnTextChanged(self, scrollFrame)
-- force an update when the text changes
self.handleCursorChange = true;
@@ -529,47 +155,6 @@ local height, range, scroll, size, curso
end
end
-function EditBox_HandleTabbing(self, tabList)
- local editboxName = self:GetName();
- local index;
- for i=1, #tabList do
- if ( editboxName == tabList[i] ) then
- index = i;
- break;
- end
- end
- if ( IsShiftKeyDown() ) then
- index = index - 1;
- else
- index = index + 1;
- end
-
- if ( index == 0 ) then
- index = #tabList;
- elseif ( index > #tabList ) then
- index = 1;
- end
-
- local target = tabList[index];
- _G[target]:SetFocus();
-end
-
-function EditBox_ClearFocus (self)
- self:ClearFocus();
-end
-
-function EditBox_SetFocus (self)
- self:SetFocus();
-end
-
-function EditBox_HighlightText (self)
- self:HighlightText();
-end
-
-function EditBox_ClearHighlight (self)
- self:HighlightText(0, 0);
-end
-
UIFrameCache = CreateFrame("FRAME");
local caches = {};
function UIFrameCache:New (frameType, baseName, parent, template)
@@ -690,7 +275,7 @@ function CapProgressBar_Update(capBar, c
return;
end
- local barWidth = capBar:GetWidth();
+ local barWidth = capBar:GetWidth() - 4;
local sizePerPoint = barWidth / totalLimit;
local progressWidth = totalQuantity * sizePerPoint;
@@ -716,7 +301,7 @@ function CapProgressBar_Update(capBar, c
if ( progressWidth > 0 ) then
capBar.progress:Show();
- capBar.progress:SetPoint("LEFT", lastFrame, lastRelativePoint, 0, 0);
+ capBar.progress:SetPoint("LEFT", lastFrame, lastRelativePoint, 2, 0);
lastFrame, lastRelativePoint = capBar.progress, "RIGHT";
else
capBar.progress:Hide();
@@ -750,11 +335,49 @@ function InputScrollFrame_OnLoad(self)
scrollBar:SetPoint("TOPLEFT", self, "TOPRIGHT", -13, -11);
scrollBar:SetPoint("BOTTOMLEFT", self, "BOTTOMRIGHT", -13, 9);
-- reposition the up and down buttons
- _G[self:GetName().."ScrollBarScrollDownButton"]:SetPoint("TOP", scrollBar, "BOTTOM", 0, 4);
- _G[self:GetName().."ScrollBarScrollUpButton"]:SetPoint("BOTTOM", scrollBar, "TOP", 0, -4);
+ self.ScrollBar.ScrollDownButton:SetPoint("TOP", scrollBar, "BOTTOM", 0, 4);
+ self.ScrollBar.ScrollUpButton:SetPoint("BOTTOM", scrollBar, "TOP", 0, -4);
-- make the scroll bar hideable and force it to start off hidden so positioning calculations can be done
-- as soon as it needs to be shown
self.scrollBarHideable = 1;
scrollBar:Hide();
self.EditBox:SetWidth(self:GetWidth() - 18);
-end
\ No newline at end of file
+ self.EditBox:SetMaxLetters(self.maxLetters);
+ self.EditBox.Instructions:SetText(self.instructions);
+ self.CharCount:SetShown(not self.hideCharCount);
+end
+
+--Radio button functions
+function SetCheckButtonIsRadio(button, isRadio)
+ if ( isRadio ) then
+ button:SetNormalTexture("Interface\\Buttons\\UI-RadioButton");
+ button:GetNormalTexture():SetTexCoord(0, 0.25, 0, 1);
+
+ button:SetHighlightTexture("Interface\\Buttons\\UI-RadioButton");
+ button:GetHighlightTexture():SetTexCoord(0.5, 0.75, 0, 1);
+
+ button:SetCheckedTexture("Interface\\Buttons\\UI-RadioButton");
+ button:GetCheckedTexture():SetTexCoord(0.25, 0.5, 0, 1);
+
+ button:SetPushedTexture("Interface\\Buttons\\UI-RadioButton");
+ button:GetPushedTexture():SetTexCoord(0, 0.25, 0, 1);
+
+ button:SetDisabledCheckedTexture("Interface\\Buttons\\UI-RadioButton");
+ button:GetDisabledCheckedTexture():SetTexCoord(0.75, 1, 0, 1);
+ else
+ button:SetNormalTexture("Interface\\Buttons\\UI-CheckBox-Up");
+ button:GetNormalTexture():SetTexCoord(0, 1, 0, 1);
+
+ button:SetHighlightTexture("Interface\\Buttons\\UI-CheckBox-Highlight");
+ button:GetHighlightTexture():SetTexCoord(0, 1, 0, 1);
+
+ button:SetCheckedTexture("Interface\\Buttons\\UI-CheckBox-Check");
+ button:GetCheckedTexture():SetTexCoord(0, 1, 0, 1);
+
+ button:SetPushedTexture("Interface\\Buttons\\UI-CheckBox-Down");
+ button:GetPushedTexture():SetTexCoord(0, 1, 0, 1);
+
+ button:SetDisabledCheckedTexture("Interface\\Buttons\\UI-CheckBox-Check-Disabled");
+ button:GetDisabledCheckedTexture():SetTexCoord(0, 1, 0, 1);
+ end
+end