Zerotorescue@101
|
1 local addon = select(2, ...);
|
Zerotorescue@101
|
2
|
Zerotorescue@101
|
3 local function ShowTooltip(self)
|
Zerotorescue@101
|
4 -- If this function is called from a widget, self is the widget and self.frame the actual frame
|
Zerotorescue@101
|
5 local this = self.frame or self;
|
Zerotorescue@101
|
6
|
Zerotorescue@132
|
7 if not this.tooltipTitle or addon.db.profile.defaults.hideHelp then return; end
|
Zerotorescue@106
|
8
|
Zerotorescue@101
|
9 GameTooltip:SetOwner(this, "ANCHOR_NONE");
|
Zerotorescue@104
|
10 if this.tooltipLocation and this.tooltipLocation == "BOTTOM" then
|
Zerotorescue@104
|
11 GameTooltip:SetPoint("TOP", this, "BOTTOM");
|
Zerotorescue@101
|
12 else
|
Zerotorescue@101
|
13 GameTooltip:SetPoint("BOTTOM", this, "TOP");
|
Zerotorescue@101
|
14 end
|
Zerotorescue@101
|
15 GameTooltip:SetText(this.tooltipTitle, 1, .82, 0, 1);
|
Zerotorescue@101
|
16
|
Zerotorescue@101
|
17 if type(this.tooltip) == "string" then
|
Zerotorescue@101
|
18 GameTooltip:AddLine(this.tooltip, 1, 1, 1, 1);
|
Zerotorescue@101
|
19 end
|
Zerotorescue@101
|
20
|
Zerotorescue@101
|
21 GameTooltip:Show();
|
Zerotorescue@101
|
22 end
|
Zerotorescue@101
|
23
|
Zerotorescue@101
|
24 local function HideTooltip()
|
Zerotorescue@101
|
25 GameTooltip:Hide();
|
Zerotorescue@101
|
26 end
|
Zerotorescue@101
|
27
|
Zerotorescue@110
|
28 function addon:CreateMoverFrame()
|
Zerotorescue@132
|
29 if InventoriumItemMover then
|
Zerotorescue@132
|
30 return;
|
Zerotorescue@132
|
31 end
|
Zerotorescue@132
|
32
|
Zerotorescue@101
|
33 local frameWidth = 400;
|
Zerotorescue@101
|
34
|
Zerotorescue@101
|
35 -- Main window
|
Zerotorescue@101
|
36 local frame = CreateFrame("Frame", "InventoriumItemMover", UIParent);
|
Zerotorescue@101
|
37 -- Hide by default
|
Zerotorescue@101
|
38 frame:Hide();
|
Zerotorescue@101
|
39 -- Center the frame (will be adjusted later)
|
Zerotorescue@101
|
40 frame:SetPoint("CENTER", UIParent, "CENTER", 0, 0);
|
Zerotorescue@101
|
41 -- Put in front of other windows
|
Zerotorescue@101
|
42 frame:SetFrameStrata("FULLSCREEN_DIALOG");
|
Zerotorescue@101
|
43 frame:SetToplevel(true);
|
Zerotorescue@101
|
44 -- Give it a size
|
Zerotorescue@101
|
45 frame:SetWidth(frameWidth);
|
Zerotorescue@101
|
46 frame:SetHeight(175);
|
Zerotorescue@101
|
47 -- Background
|
Zerotorescue@101
|
48 frame:SetBackdrop({
|
Zerotorescue@101
|
49 bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
|
Zerotorescue@101
|
50 edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
|
Zerotorescue@104
|
51 edgeSize = 20,
|
Zerotorescue@101
|
52 insets = {
|
Zerotorescue@101
|
53 left = 5,
|
Zerotorescue@101
|
54 right = 5,
|
Zerotorescue@101
|
55 top = 5,
|
Zerotorescue@101
|
56 bottom = 5,
|
Zerotorescue@101
|
57 },
|
Zerotorescue@101
|
58 });
|
Zerotorescue@101
|
59 frame:SetBackdropColor(0, 0, 0, .8);
|
Zerotorescue@101
|
60 -- Mouse functions
|
Zerotorescue@101
|
61 frame:EnableMouse();
|
Zerotorescue@101
|
62 frame:SetMovable(true);
|
Zerotorescue@101
|
63 frame:SetResizable(true);
|
Zerotorescue@101
|
64 frame:SetMinResize(300, 175);
|
Zerotorescue@101
|
65 -- Set event handlers
|
Zerotorescue@101
|
66 frame:SetScript("OnMouseUp", function(this) this:StopMovingOrSizing(); end);
|
Zerotorescue@101
|
67 frame:SetScript("OnShow", function(this)
|
Zerotorescue@104
|
68 if not tContains(StaticPopup_DisplayedFrames, this) then
|
Zerotorescue@104
|
69 -- We wish to display our box at a similar position as the default interface's static popups, so we literally copied the code for these popups
|
Zerotorescue@104
|
70 local lastFrame = StaticPopup_DisplayedFrames[#StaticPopup_DisplayedFrames];
|
Zerotorescue@104
|
71 if lastFrame then
|
Zerotorescue@104
|
72 this:SetPoint("TOP", lastFrame, "BOTTOM", 0, 0);
|
Zerotorescue@104
|
73 else
|
Zerotorescue@104
|
74 this:SetPoint("TOP", UIParent, "TOP", 0, -135);
|
Zerotorescue@104
|
75 end
|
Zerotorescue@104
|
76
|
Zerotorescue@104
|
77 -- Position other static popups below this
|
Zerotorescue@104
|
78 tinsert(StaticPopup_DisplayedFrames, this);
|
Zerotorescue@101
|
79 end
|
Zerotorescue@101
|
80
|
Zerotorescue@101
|
81 this:AdjustScrollTableRows();
|
Zerotorescue@101
|
82
|
Zerotorescue@101
|
83 PlaySound("OrcExploration");
|
Zerotorescue@101
|
84 end);
|
Zerotorescue@110
|
85 frame:SetScript("OnHide", function(this)
|
Zerotorescue@110
|
86 StaticPopup_CollapseTable(this);
|
Zerotorescue@110
|
87 end);
|
Zerotorescue@101
|
88
|
Zerotorescue@101
|
89 -- Title (AceGUI frame-widget-title used as example)
|
Zerotorescue@101
|
90 local titleBackground = frame:CreateTexture(nil, "OVERLAY");
|
Zerotorescue@101
|
91 titleBackground:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header");
|
Zerotorescue@101
|
92 titleBackground:SetTexCoord(0.31, 0.67, 0, 0.63);
|
Zerotorescue@101
|
93 titleBackground:SetPoint("TOP", 0, 12);
|
Zerotorescue@101
|
94 titleBackground:SetWidth(150);
|
Zerotorescue@101
|
95 titleBackground:SetHeight(40);
|
Zerotorescue@119
|
96
|
Zerotorescue@119
|
97 frame.titleBackground = titleBackground;
|
Zerotorescue@119
|
98
|
Zerotorescue@101
|
99 local titleBackgroundLeft = frame:CreateTexture(nil, "OVERLAY");
|
Zerotorescue@101
|
100 titleBackgroundLeft:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header");
|
Zerotorescue@101
|
101 titleBackgroundLeft:SetTexCoord(0.21, 0.31, 0, 0.63);
|
Zerotorescue@101
|
102 titleBackgroundLeft:SetPoint("RIGHT", titleBackground, "LEFT");
|
Zerotorescue@101
|
103 titleBackgroundLeft:SetWidth(30);
|
Zerotorescue@101
|
104 titleBackgroundLeft:SetHeight(40);
|
Zerotorescue@101
|
105
|
Zerotorescue@101
|
106 local titleBackgroundRight = frame:CreateTexture(nil, "OVERLAY");
|
Zerotorescue@101
|
107 titleBackgroundRight:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header");
|
Zerotorescue@101
|
108 titleBackgroundRight:SetTexCoord(0.67, 0.77, 0, 0.63);
|
Zerotorescue@101
|
109 titleBackgroundRight:SetPoint("LEFT", titleBackground, "RIGHT");
|
Zerotorescue@101
|
110 titleBackgroundRight:SetWidth(30);
|
Zerotorescue@101
|
111 titleBackgroundRight:SetHeight(40);
|
Zerotorescue@101
|
112
|
Zerotorescue@101
|
113 local frmTitle = CreateFrame("Frame", nil, frame);
|
Zerotorescue@101
|
114 frmTitle:EnableMouse(true);
|
Zerotorescue@101
|
115 frmTitle:SetScript("OnMouseDown", function(this) this:GetParent():StartMoving(); end);
|
Zerotorescue@101
|
116 frmTitle:SetScript("OnMouseUp", function(this) this:GetParent():StopMovingOrSizing(); end);
|
Zerotorescue@101
|
117 frmTitle:SetAllPoints(titleBackground);
|
Zerotorescue@101
|
118
|
Zerotorescue@101
|
119 local lblTitle = frmTitle:CreateFontString(nil, "OVERLAY", "GameFontNormal");
|
Zerotorescue@101
|
120 lblTitle:SetPoint("TOP", titleBackground, "TOP", 0, -14);
|
Zerotorescue@110
|
121
|
Zerotorescue@110
|
122 frame.lblTitle = lblTitle;
|
Zerotorescue@101
|
123
|
Zerotorescue@101
|
124 -- Resizer (vertical only)
|
Zerotorescue@101
|
125 local frmResizer = CreateFrame("Frame", nil, frame);
|
Zerotorescue@101
|
126 frmResizer:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 0, -10);
|
Zerotorescue@101
|
127 frmResizer:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", 0, -10);
|
Zerotorescue@101
|
128 frmResizer:SetHeight(20);
|
Zerotorescue@101
|
129 frmResizer:EnableMouse();
|
Zerotorescue@101
|
130 frmResizer:SetScript("OnMouseDown", function(this) this:GetParent():StartSizing("BOTTOM"); end);
|
Zerotorescue@101
|
131 frmResizer:SetScript("OnMouseUp", function(this) this:GetParent():StopMovingOrSizing(); end);
|
Zerotorescue@101
|
132
|
Zerotorescue@101
|
133 -- Description
|
Zerotorescue@101
|
134 local lblDescription = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal");
|
Zerotorescue@106
|
135 lblDescription:SetPoint("TOPLEFT", frame, "TOPLEFT", 15, -27);
|
Zerotorescue@104
|
136 lblDescription:SetWidth(frameWidth - 15 - 15); -- 10 margin left & 10 margin right
|
Zerotorescue@101
|
137 lblDescription:SetJustifyH("LEFT");
|
Zerotorescue@101
|
138 lblDescription:SetJustifyV("TOP");
|
Zerotorescue@101
|
139
|
Zerotorescue@101
|
140 frame.lblDescription = lblDescription;
|
Zerotorescue@101
|
141
|
Zerotorescue@101
|
142 -- Buttons
|
Zerotorescue@132
|
143 -- Proceed
|
Zerotorescue@132
|
144 local btnProceed = CreateFrame("Button", "$parentProceed", frame, "UIPanelButtonTemplate");
|
Zerotorescue@132
|
145 btnProceed:SetHeight(21);
|
Zerotorescue@132
|
146 btnProceed:SetWidth(125);
|
Zerotorescue@132
|
147 btnProceed:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 15, 11);
|
Zerotorescue@132
|
148 btnProceed:SetScript("OnClick", function(this) this.OnClick(this); end);
|
Zerotorescue@132
|
149 btnProceed:SetScript("OnEnter", ShowTooltip);
|
Zerotorescue@132
|
150 btnProceed:SetScript("OnLeave", HideTooltip);
|
Zerotorescue@101
|
151
|
Zerotorescue@132
|
152 frame.btnProceed = btnProceed;
|
Zerotorescue@101
|
153
|
Zerotorescue@101
|
154 -- Cancel
|
Zerotorescue@101
|
155 local btnCancel = CreateFrame("Button", "$parentCancel", frame, "UIPanelButtonTemplate");
|
Zerotorescue@101
|
156 btnCancel:SetHeight(21);
|
Zerotorescue@101
|
157 btnCancel:SetWidth(125);
|
Zerotorescue@104
|
158 btnCancel:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -15, 11);
|
Zerotorescue@110
|
159 btnCancel:SetScript("OnClick", function(this) this.OnClick(this); end);
|
Zerotorescue@101
|
160 btnCancel:SetScript("OnEnter", ShowTooltip);
|
Zerotorescue@101
|
161 btnCancel:SetScript("OnLeave", HideTooltip);
|
Zerotorescue@101
|
162
|
Zerotorescue@101
|
163 frame.btnCancel = btnCancel;
|
Zerotorescue@101
|
164
|
Zerotorescue@101
|
165 -- Because the scrolling table code-behind will change this element's height, we can't rely on that. Make a dummy frame which we can measure
|
Zerotorescue@101
|
166 local frmMeasureDummy = CreateFrame("Frame", nil, frame);
|
Zerotorescue@106
|
167 frmMeasureDummy:SetPoint("TOP", frame.lblDescription, "BOTTOM", 0, -18);
|
Zerotorescue@106
|
168 frmMeasureDummy:SetPoint("LEFT", frame, "LEFT", 15, 0);
|
Zerotorescue@104
|
169 frmMeasureDummy:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -15, 35);
|
Zerotorescue@101
|
170
|
Zerotorescue@101
|
171 frame.frmMeasureDummy = frmMeasureDummy;
|
Zerotorescue@101
|
172
|
Zerotorescue@101
|
173 -- Scrolling table with a list of items to be moved
|
Zerotorescue@101
|
174 local ScrollingTable = LibStub("ScrollingTable");
|
Zerotorescue@132
|
175 local scrollTable = ScrollingTable:CreateST({}, 4, 15, nil, frame); -- inserting a dummy cols, real cols to be set in SetFrameSettings
|
Zerotorescue@132
|
176 scrollTable.frame:SetPoint("TOP", frame.lblDescription, "BOTTOM", 0, -18);
|
Zerotorescue@132
|
177 scrollTable.frame:SetPoint("LEFT", frame, "LEFT", 15, 0);
|
Zerotorescue@132
|
178 scrollTable.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -15, 35);
|
Zerotorescue@106
|
179 -- When moving over a row, provide a tooltip for the item
|
Zerotorescue@132
|
180 scrollTable:RegisterEvents({
|
Zerotorescue@101
|
181 ["OnEnter"] = function(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...)
|
Zerotorescue@106
|
182 if row and realrow then
|
Zerotorescue@106
|
183 -- Data row
|
Zerotorescue@106
|
184
|
Zerotorescue@112
|
185 if data[realrow] and data[realrow].rowData and data[realrow].rowData.itemId then
|
Zerotorescue@106
|
186 GameTooltip:SetOwner(rowFrame, "ANCHOR_NONE");
|
Zerotorescue@106
|
187 GameTooltip:SetPoint("TOPLEFT", rowFrame, "BOTTOMLEFT");
|
Zerotorescue@112
|
188 GameTooltip:SetHyperlink(("item:%d"):format(data[realrow].rowData.itemId));
|
Zerotorescue@106
|
189 GameTooltip:Show();
|
Zerotorescue@106
|
190 end
|
Zerotorescue@106
|
191 else
|
Zerotorescue@106
|
192 -- Header row
|
Zerotorescue@106
|
193
|
Zerotorescue@106
|
194 if cols[column].tooltipTitle and type(cols[column].tooltipTitle) == "string" then
|
Zerotorescue@106
|
195 cellFrame.tooltipTitle = cols[column].tooltipTitle;
|
Zerotorescue@106
|
196 if cols[column].tooltip then
|
Zerotorescue@106
|
197 cellFrame.tooltip = cols[column].tooltip; -- Optional
|
Zerotorescue@106
|
198 else
|
Zerotorescue@106
|
199 cellFrame.tooltip = nil;
|
Zerotorescue@106
|
200 end
|
Zerotorescue@106
|
201
|
Zerotorescue@106
|
202 ShowTooltip(cellFrame);
|
Zerotorescue@106
|
203 end
|
Zerotorescue@101
|
204 end
|
Zerotorescue@101
|
205 end,
|
Zerotorescue@101
|
206 ["OnLeave"] = function(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...)
|
Zerotorescue@106
|
207 HideTooltip();
|
Zerotorescue@101
|
208 end,
|
Zerotorescue@141
|
209 ["OnClick"] = function() end,
|
Zerotorescue@101
|
210 });
|
Zerotorescue@101
|
211
|
Zerotorescue@132
|
212 frame.scrollTable = scrollTable;
|
Zerotorescue@110
|
213
|
Zerotorescue@106
|
214 -- Change the amount of displayed rows based on the size of the frame
|
Zerotorescue@106
|
215 frame.AdjustScrollTableRows = function(this)
|
Zerotorescue@106
|
216 local newRows = math.floor(( this.frmMeasureDummy:GetHeight() - 5 ) / 15);
|
Zerotorescue@110
|
217 newRows = (newRows < 4 and 4) or newRows;
|
Zerotorescue@106
|
218
|
Zerotorescue@106
|
219 this.scrollTable:SetDisplayRows(newRows, 15);
|
Zerotorescue@106
|
220 end;
|
Zerotorescue@106
|
221 frame:SetScript("OnSizeChanged", frame.AdjustScrollTableRows);
|
Zerotorescue@101
|
222 end
|
Zerotorescue@101
|
223
|
Zerotorescue@101
|
224 function addon:SetMoverFrameData(data)
|
Zerotorescue@101
|
225 InventoriumItemMover.scrollTable:SetData(data);
|
Zerotorescue@101
|
226
|
Zerotorescue@101
|
227 InventoriumItemMover:Show();
|
Zerotorescue@101
|
228 end
|
Zerotorescue@110
|
229
|
Zerotorescue@132
|
230 function addon:SetMoverFrameSettings(title, description, proceed, cancel, headers)
|
Zerotorescue@110
|
231 local frame = InventoriumItemMover;
|
Zerotorescue@110
|
232
|
Zerotorescue@110
|
233 frame.lblTitle:SetText(title);
|
Zerotorescue@119
|
234 -- Adjust size for the title background
|
Zerotorescue@119
|
235 frame.titleBackground:SetWidth((frame.lblTitle:GetWidth() or 0) + 10); -- 10 pixels margin
|
Zerotorescue@110
|
236
|
Zerotorescue@110
|
237 frame.lblDescription:SetText(description);
|
Zerotorescue@110
|
238
|
Zerotorescue@132
|
239 frame.btnProceed:SetText(proceed.text);
|
Zerotorescue@132
|
240 frame.btnProceed.tooltipTitle = proceed.tooltipTitle;
|
Zerotorescue@132
|
241 frame.btnProceed.tooltip = proceed.tooltip;
|
Zerotorescue@132
|
242 frame.btnProceed.OnClick = proceed.onClick;
|
Zerotorescue@110
|
243
|
Zerotorescue@110
|
244 frame.btnCancel:SetText(cancel.text);
|
Zerotorescue@110
|
245 frame.btnCancel.tooltipTitle = cancel.tooltipTitle;
|
Zerotorescue@110
|
246 frame.btnCancel.tooltip = cancel.tooltip;
|
Zerotorescue@110
|
247 frame.btnCancel.OnClick = cancel.onClick;
|
Zerotorescue@110
|
248
|
Zerotorescue@110
|
249 frame.scrollTable:SetDisplayCols(headers);
|
Zerotorescue@110
|
250 end
|
Zerotorescue@132
|
251
|
Zerotorescue@132
|
252 function addon:CreateQueueFrame()
|
Zerotorescue@132
|
253 if InventoriumQueuer then
|
Zerotorescue@132
|
254 return;
|
Zerotorescue@132
|
255 end
|
Zerotorescue@132
|
256
|
Zerotorescue@132
|
257 do
|
Zerotorescue@132
|
258 local frameWidth = 400;
|
Zerotorescue@132
|
259
|
Zerotorescue@132
|
260 -- Main window
|
Zerotorescue@132
|
261 local frame = CreateFrame("Frame", "InventoriumQueuer", UIParent);
|
Zerotorescue@206
|
262 -- Close on escape
|
Zerotorescue@206
|
263 tinsert(UISpecialFrames, "InventoriumQueuer");
|
Zerotorescue@132
|
264 -- Hide by default
|
Zerotorescue@132
|
265 frame:Hide();
|
Zerotorescue@132
|
266 -- Center the frame (will be adjusted later)
|
Zerotorescue@132
|
267 frame:SetPoint("CENTER", UIParent, "CENTER", 0, 0);
|
Zerotorescue@132
|
268 -- Put in front of other windows
|
Zerotorescue@132
|
269 frame:SetFrameStrata("FULLSCREEN_DIALOG");
|
Zerotorescue@132
|
270 frame:SetToplevel(true);
|
Zerotorescue@132
|
271 -- Give it a size
|
Zerotorescue@132
|
272 frame:SetWidth(frameWidth);
|
Zerotorescue@132
|
273 frame:SetHeight(430);
|
Zerotorescue@132
|
274 -- Background
|
Zerotorescue@132
|
275 frame:SetBackdrop({
|
Zerotorescue@132
|
276 bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
|
Zerotorescue@132
|
277 edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
|
Zerotorescue@132
|
278 edgeSize = 20,
|
Zerotorescue@132
|
279 insets = {
|
Zerotorescue@132
|
280 left = 5,
|
Zerotorescue@132
|
281 right = 5,
|
Zerotorescue@132
|
282 top = 5,
|
Zerotorescue@132
|
283 bottom = 5,
|
Zerotorescue@132
|
284 },
|
Zerotorescue@132
|
285 });
|
Zerotorescue@132
|
286 frame:SetBackdropColor(0, 0, 0, .8);
|
Zerotorescue@132
|
287 -- Mouse functions
|
Zerotorescue@132
|
288 frame:EnableMouse();
|
Zerotorescue@132
|
289 frame:SetMovable(true);
|
Zerotorescue@132
|
290 -- Set event handlers
|
Zerotorescue@132
|
291 frame:SetScript("OnMouseUp", function(this) this:StopMovingOrSizing(); end);
|
Zerotorescue@132
|
292 frame:SetScript("OnShow", function(this)
|
Zerotorescue@132
|
293 this:AdjustScrollTableRows();
|
Zerotorescue@132
|
294 end);
|
Zerotorescue@132
|
295
|
Zerotorescue@132
|
296 -- Title (AceGUI frame-widget-title used as example)
|
Zerotorescue@132
|
297 local titleBackground = frame:CreateTexture(nil, "OVERLAY");
|
Zerotorescue@132
|
298 titleBackground:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header");
|
Zerotorescue@132
|
299 titleBackground:SetTexCoord(0.31, 0.67, 0, 0.63);
|
Zerotorescue@132
|
300 titleBackground:SetPoint("TOP", 0, 12);
|
Zerotorescue@132
|
301 titleBackground:SetWidth(150);
|
Zerotorescue@132
|
302 titleBackground:SetHeight(40);
|
Zerotorescue@132
|
303
|
Zerotorescue@132
|
304 frame.titleBackground = titleBackground;
|
Zerotorescue@132
|
305
|
Zerotorescue@132
|
306 local titleBackgroundLeft = frame:CreateTexture(nil, "OVERLAY");
|
Zerotorescue@132
|
307 titleBackgroundLeft:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header");
|
Zerotorescue@132
|
308 titleBackgroundLeft:SetTexCoord(0.21, 0.31, 0, 0.63);
|
Zerotorescue@132
|
309 titleBackgroundLeft:SetPoint("RIGHT", titleBackground, "LEFT");
|
Zerotorescue@132
|
310 titleBackgroundLeft:SetWidth(30);
|
Zerotorescue@132
|
311 titleBackgroundLeft:SetHeight(40);
|
Zerotorescue@132
|
312
|
Zerotorescue@132
|
313 local titleBackgroundRight = frame:CreateTexture(nil, "OVERLAY");
|
Zerotorescue@132
|
314 titleBackgroundRight:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header");
|
Zerotorescue@132
|
315 titleBackgroundRight:SetTexCoord(0.67, 0.77, 0, 0.63);
|
Zerotorescue@132
|
316 titleBackgroundRight:SetPoint("LEFT", titleBackground, "RIGHT");
|
Zerotorescue@132
|
317 titleBackgroundRight:SetWidth(30);
|
Zerotorescue@132
|
318 titleBackgroundRight:SetHeight(40);
|
Zerotorescue@132
|
319
|
Zerotorescue@132
|
320 local frmTitle = CreateFrame("Frame", nil, frame);
|
Zerotorescue@132
|
321 frmTitle:EnableMouse(true);
|
Zerotorescue@132
|
322 frmTitle:SetScript("OnMouseDown", function(this) this:GetParent():StartMoving(); end);
|
Zerotorescue@132
|
323 frmTitle:SetScript("OnMouseUp", function(this) this:GetParent():StopMovingOrSizing(); end);
|
Zerotorescue@132
|
324 frmTitle:SetAllPoints(titleBackground);
|
Zerotorescue@132
|
325
|
Zerotorescue@132
|
326 local lblTitle = frmTitle:CreateFontString(nil, "OVERLAY", "GameFontNormal");
|
Zerotorescue@132
|
327 lblTitle:SetPoint("TOP", titleBackground, "TOP", 0, -14);
|
Zerotorescue@132
|
328
|
Zerotorescue@132
|
329 frame.lblTitle = lblTitle;
|
Zerotorescue@132
|
330
|
Zerotorescue@132
|
331 -- Expand button
|
Zerotorescue@132
|
332 local btnExpander = CreateFrame("Button", "$parentExpander", frame);
|
Zerotorescue@132
|
333 btnExpander:SetWidth(32);
|
Zerotorescue@132
|
334 btnExpander:SetHeight(32);
|
Zerotorescue@132
|
335 btnExpander:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -10, -10);
|
Zerotorescue@132
|
336 btnExpander:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Up");
|
Zerotorescue@132
|
337 btnExpander:SetPushedTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Down");
|
Zerotorescue@132
|
338 btnExpander:SetDisabledTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Disabled");
|
Zerotorescue@132
|
339 btnExpander:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight", "ADD");
|
Zerotorescue@132
|
340 btnExpander.tooltipTitle = "Show unqueueables";
|
Zerotorescue@132
|
341 btnExpander.tooltip = "Click to show a list of all unqueueable but tracked items.";
|
Zerotorescue@132
|
342 btnExpander:SetScript("OnEnter", ShowTooltip);
|
Zerotorescue@132
|
343 btnExpander:SetScript("OnLeave", HideTooltip);
|
Zerotorescue@132
|
344 btnExpander:SetScript("OnClick", function(this)
|
Zerotorescue@132
|
345 if this.Expanded then
|
Zerotorescue@132
|
346 -- Collapsing
|
Zerotorescue@132
|
347 this.Expanded = nil;
|
Zerotorescue@132
|
348 InventoriumQueuerUnqueueables:Hide();
|
Zerotorescue@132
|
349 PlaySound("igCharacterInfoClose");
|
Zerotorescue@132
|
350
|
Zerotorescue@132
|
351 -- Next is an expand
|
Zerotorescue@132
|
352 this:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Up");
|
Zerotorescue@132
|
353 this:SetPushedTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Down");
|
Zerotorescue@132
|
354 this:SetDisabledTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Disabled");
|
Zerotorescue@132
|
355 else
|
Zerotorescue@132
|
356 -- Expanding
|
Zerotorescue@132
|
357 this.Expanded = true;
|
Zerotorescue@132
|
358
|
Zerotorescue@132
|
359 -- Position the frame against the queuer window
|
Zerotorescue@132
|
360 InventoriumQueuerUnqueueables:ClearAllPoints();
|
Zerotorescue@132
|
361 InventoriumQueuerUnqueueables:SetPoint("TOPLEFT", this:GetParent(), "TOPRIGHT", 0, 0);
|
Zerotorescue@132
|
362 InventoriumQueuerUnqueueables:SetPoint("BOTTOMLEFT", this:GetParent(), "BOTTOMLEFT", 0, 0);
|
Zerotorescue@132
|
363 InventoriumQueuerUnqueueables:Show();
|
Zerotorescue@132
|
364 PlaySound("igCharacterInfoOpen");
|
Zerotorescue@132
|
365
|
Zerotorescue@132
|
366 -- Next is a collapse
|
Zerotorescue@132
|
367 this:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Up");
|
Zerotorescue@132
|
368 this:SetPushedTexture("Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Down");
|
Zerotorescue@132
|
369 this:SetDisabledTexture("Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Disabled");
|
Zerotorescue@132
|
370 end
|
Zerotorescue@132
|
371 end);
|
Zerotorescue@132
|
372
|
Zerotorescue@132
|
373 -- Description
|
Zerotorescue@132
|
374 local lblDescription = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal");
|
Zerotorescue@132
|
375 lblDescription:SetPoint("TOPLEFT", frame, "TOPLEFT", 15, -27);
|
Zerotorescue@132
|
376 lblDescription:SetPoint("RIGHT", btnExpander, "LEFT", -15, 0);
|
Zerotorescue@132
|
377 lblDescription:SetJustifyH("LEFT");
|
Zerotorescue@132
|
378 lblDescription:SetJustifyV("TOP");
|
Zerotorescue@132
|
379 lblDescription:SetWidth(frameWidth - 70);
|
Zerotorescue@132
|
380
|
Zerotorescue@132
|
381 frame.lblDescription = lblDescription;
|
Zerotorescue@132
|
382
|
Zerotorescue@132
|
383 -- Buttons
|
Zerotorescue@132
|
384 -- Proceed
|
Zerotorescue@132
|
385 local btnProceed = CreateFrame("Button", "$parentProceed", frame, "UIPanelButtonTemplate");
|
Zerotorescue@132
|
386 btnProceed:SetHeight(21);
|
Zerotorescue@132
|
387 btnProceed:SetWidth(125);
|
Zerotorescue@132
|
388 btnProceed:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 15, 11);
|
Zerotorescue@132
|
389 btnProceed:SetScript("OnClick", function(this) this.OnClick(this); end);
|
Zerotorescue@132
|
390 btnProceed:SetScript("OnEnter", ShowTooltip);
|
Zerotorescue@132
|
391 btnProceed:SetScript("OnLeave", HideTooltip);
|
Zerotorescue@132
|
392
|
Zerotorescue@132
|
393 frame.btnProceed = btnProceed;
|
Zerotorescue@132
|
394
|
Zerotorescue@132
|
395 -- Cancel
|
Zerotorescue@132
|
396 local btnCancel = CreateFrame("Button", "$parentCancel", frame, "UIPanelButtonTemplate");
|
Zerotorescue@132
|
397 btnCancel:SetHeight(21);
|
Zerotorescue@132
|
398 btnCancel:SetWidth(125);
|
Zerotorescue@132
|
399 btnCancel:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -15, 11);
|
Zerotorescue@132
|
400 btnCancel:SetScript("OnClick", function(this) this.OnClick(this); end);
|
Zerotorescue@132
|
401 btnCancel:SetScript("OnEnter", ShowTooltip);
|
Zerotorescue@132
|
402 btnCancel:SetScript("OnLeave", HideTooltip);
|
Zerotorescue@132
|
403
|
Zerotorescue@132
|
404 frame.btnCancel = btnCancel;
|
Zerotorescue@145
|
405
|
Zerotorescue@145
|
406 -- Craft
|
Zerotorescue@145
|
407 local btnCraft = CreateFrame("Button", "$parentCraft", frame, "UIPanelButtonTemplate");
|
Zerotorescue@145
|
408 btnCraft:SetHeight(21);
|
Zerotorescue@145
|
409 --btnCraft:SetWidth(125);
|
Zerotorescue@145
|
410 btnCraft:SetPoint("TOPLEFT", btnProceed, "TOPRIGHT", 15, 0);
|
Zerotorescue@145
|
411 btnCraft:SetPoint("BOTTOMRIGHT", btnCancel, "BOTTOMLEFT", -15, 0);
|
Zerotorescue@145
|
412 btnCraft:SetScript("OnClick", function(this) this.OnClick(this); end);
|
Zerotorescue@145
|
413 btnCraft:SetScript("OnEnter", ShowTooltip);
|
Zerotorescue@145
|
414 btnCraft:SetScript("OnLeave", HideTooltip);
|
Zerotorescue@145
|
415
|
Zerotorescue@145
|
416 frame.btnCraft = btnCraft;
|
Zerotorescue@132
|
417
|
Zerotorescue@132
|
418 -- Because the scrolling table code-behind will change the scrolltable element's height, we can't rely on that. Make a dummy frame which we can measure
|
Zerotorescue@132
|
419 local frmMeasureDummy = CreateFrame("Frame", nil, frame);
|
Zerotorescue@132
|
420 frmMeasureDummy:SetPoint("TOP", frame.lblDescription, "BOTTOM", 0, -18);
|
Zerotorescue@132
|
421 frmMeasureDummy:SetPoint("LEFT", frame, "LEFT", 15, 0);
|
Zerotorescue@132
|
422 frmMeasureDummy:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -15, 35);
|
Zerotorescue@132
|
423
|
Zerotorescue@132
|
424 frame.frmMeasureDummy = frmMeasureDummy;
|
Zerotorescue@132
|
425
|
Zerotorescue@132
|
426 -- Scrolling table with a list of items to be queued
|
Zerotorescue@132
|
427 local ScrollingTable = LibStub("ScrollingTable");
|
Zerotorescue@132
|
428 local scrollTable = ScrollingTable:CreateST({}, 4, 15, nil, frame); -- inserting a dummy cols, real cols to be set in SetFrameSettings
|
Zerotorescue@132
|
429 scrollTable.frame:SetPoint("TOP", frame.lblDescription, "BOTTOM", 0, -18);
|
Zerotorescue@132
|
430 scrollTable.frame:SetPoint("LEFT", frame, "LEFT", 15, 0);
|
Zerotorescue@132
|
431 scrollTable.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -15, 35);
|
Zerotorescue@132
|
432 -- When moving over a row, provide a tooltip for the item
|
Zerotorescue@132
|
433 scrollTable:RegisterEvents({
|
Zerotorescue@144
|
434 ["OnEnter"] = function(rowFrame, cellFrame, data, cols, row, realrow, column)
|
Zerotorescue@132
|
435 if row and realrow then
|
Zerotorescue@132
|
436 -- Data row
|
Zerotorescue@132
|
437
|
Zerotorescue@144
|
438 if cols[column].name == "X" then
|
Zerotorescue@144
|
439 cellFrame.tooltipTitle = "Remove";
|
Zerotorescue@144
|
440 cellFrame.tooltip = "Remove this item from the queue.";
|
Zerotorescue@144
|
441 cellFrame.tooltipLocation = "BOTTOM";
|
Zerotorescue@144
|
442
|
Zerotorescue@144
|
443 ShowTooltip(cellFrame);
|
Zerotorescue@144
|
444 elseif data[realrow] and data[realrow].rowData and data[realrow].rowData.itemId then
|
Zerotorescue@132
|
445 GameTooltip:SetOwner(rowFrame, "ANCHOR_NONE");
|
Zerotorescue@132
|
446 GameTooltip:SetPoint("TOPLEFT", rowFrame, "BOTTOMLEFT");
|
Zerotorescue@132
|
447 GameTooltip:SetHyperlink(("item:%d"):format(data[realrow].rowData.itemId));
|
Zerotorescue@132
|
448 GameTooltip:Show();
|
Zerotorescue@132
|
449 end
|
Zerotorescue@132
|
450 else
|
Zerotorescue@132
|
451 -- Header row
|
Zerotorescue@132
|
452
|
Zerotorescue@132
|
453 if cols[column].tooltipTitle and type(cols[column].tooltipTitle) == "string" then
|
Zerotorescue@132
|
454 cellFrame.tooltipTitle = cols[column].tooltipTitle;
|
Zerotorescue@132
|
455 if cols[column].tooltip then
|
Zerotorescue@132
|
456 cellFrame.tooltip = cols[column].tooltip; -- Optional
|
Zerotorescue@132
|
457 else
|
Zerotorescue@132
|
458 cellFrame.tooltip = nil;
|
Zerotorescue@132
|
459 end
|
Zerotorescue@132
|
460
|
Zerotorescue@132
|
461 ShowTooltip(cellFrame);
|
Zerotorescue@132
|
462 end
|
Zerotorescue@132
|
463 end
|
Zerotorescue@132
|
464 end,
|
Zerotorescue@144
|
465 ["OnLeave"] = function()
|
Zerotorescue@132
|
466 HideTooltip();
|
Zerotorescue@132
|
467 end,
|
Zerotorescue@144
|
468 ["OnClick"] = function(rowFrame, cellFrame, data, cols, row, realrow, column)
|
Zerotorescue@144
|
469 if row and realrow then
|
Zerotorescue@144
|
470 -- Data row
|
Zerotorescue@144
|
471
|
Zerotorescue@144
|
472 if cols[column].name == "X" then
|
Zerotorescue@144
|
473 cols[column].onClick(data[realrow].rowData);
|
Zerotorescue@144
|
474
|
Zerotorescue@144
|
475 return true; -- cancel default event
|
Zerotorescue@144
|
476 end
|
Zerotorescue@144
|
477 end
|
Zerotorescue@144
|
478 end,
|
Zerotorescue@132
|
479 });
|
Zerotorescue@144
|
480 scrollTable:EnableSelection(true);
|
Zerotorescue@132
|
481
|
Zerotorescue@132
|
482 frame.scrollTable = scrollTable;
|
Zerotorescue@132
|
483
|
Zerotorescue@132
|
484 -- Change the amount of displayed rows based on the size of the frame
|
Zerotorescue@132
|
485 frame.AdjustScrollTableRows = function(this)
|
Zerotorescue@132
|
486 local newRows = math.floor(( this.frmMeasureDummy:GetHeight() - 5 ) / 15);
|
Zerotorescue@132
|
487 newRows = (newRows < 4 and 4) or newRows;
|
Zerotorescue@132
|
488
|
Zerotorescue@132
|
489 this.scrollTable:SetDisplayRows(newRows, 15);
|
Zerotorescue@132
|
490 end;
|
Zerotorescue@132
|
491 frame:SetScript("OnSizeChanged", frame.AdjustScrollTableRows);
|
Zerotorescue@132
|
492 end
|
Zerotorescue@132
|
493 do
|
Zerotorescue@132
|
494 local frameWidth = 300;
|
Zerotorescue@132
|
495
|
Zerotorescue@132
|
496 -- Main window
|
Zerotorescue@132
|
497 local frame = CreateFrame("Frame", "InventoriumQueuerUnqueueables", InventoriumQueuer);
|
Zerotorescue@132
|
498 -- Hide by default
|
Zerotorescue@132
|
499 frame:Hide();
|
Zerotorescue@132
|
500 -- Position the frame against the queuer window
|
Zerotorescue@132
|
501 frame:SetPoint("TOPLEFT", InventoriumQueuer, "TOPRIGHT", 0, 0);
|
Zerotorescue@132
|
502 frame:SetPoint("BOTTOMLEFT", InventoriumQueuer, "BOTTOMLEFT", 0, 0);
|
Zerotorescue@132
|
503 -- Put in front of other windows
|
Zerotorescue@132
|
504 frame:SetFrameStrata("FULLSCREEN_DIALOG");
|
Zerotorescue@132
|
505 frame:SetToplevel(true);
|
Zerotorescue@132
|
506 -- Give it a size
|
Zerotorescue@132
|
507 frame:SetWidth(frameWidth);
|
Zerotorescue@132
|
508 -- Background
|
Zerotorescue@132
|
509 frame:SetBackdrop({
|
Zerotorescue@132
|
510 bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
|
Zerotorescue@132
|
511 edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
|
Zerotorescue@132
|
512 edgeSize = 20,
|
Zerotorescue@132
|
513 insets = {
|
Zerotorescue@132
|
514 left = 5,
|
Zerotorescue@132
|
515 right = 5,
|
Zerotorescue@132
|
516 top = 5,
|
Zerotorescue@132
|
517 bottom = 5,
|
Zerotorescue@132
|
518 },
|
Zerotorescue@132
|
519 });
|
Zerotorescue@132
|
520 frame:SetBackdropColor(0, 0, 0, .8);
|
Zerotorescue@132
|
521 -- Mouse functions
|
Zerotorescue@132
|
522 frame:EnableMouse();
|
Zerotorescue@132
|
523 frame:SetMovable(true);
|
Zerotorescue@132
|
524 -- Set event handlers
|
Zerotorescue@132
|
525 frame:SetScript("OnMouseUp", function(this) this:StopMovingOrSizing(); end);
|
Zerotorescue@132
|
526 frame:SetScript("OnShow", function(this)
|
Zerotorescue@132
|
527 this:AdjustScrollTableRows();
|
Zerotorescue@132
|
528 end);
|
Zerotorescue@132
|
529
|
Zerotorescue@132
|
530 -- Title (AceGUI frame-widget-title used as example)
|
Zerotorescue@132
|
531 local titleBackground = frame:CreateTexture(nil, "OVERLAY");
|
Zerotorescue@132
|
532 titleBackground:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header");
|
Zerotorescue@132
|
533 titleBackground:SetTexCoord(0.31, 0.67, 0, 0.63);
|
Zerotorescue@132
|
534 titleBackground:SetPoint("TOP", 0, 12);
|
Zerotorescue@132
|
535 titleBackground:SetWidth(90);
|
Zerotorescue@132
|
536 titleBackground:SetHeight(40);
|
Zerotorescue@132
|
537
|
Zerotorescue@132
|
538 frame.titleBackground = titleBackground;
|
Zerotorescue@132
|
539
|
Zerotorescue@132
|
540 local titleBackgroundLeft = frame:CreateTexture(nil, "OVERLAY");
|
Zerotorescue@132
|
541 titleBackgroundLeft:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header");
|
Zerotorescue@132
|
542 titleBackgroundLeft:SetTexCoord(0.21, 0.31, 0, 0.63);
|
Zerotorescue@132
|
543 titleBackgroundLeft:SetPoint("RIGHT", titleBackground, "LEFT");
|
Zerotorescue@132
|
544 titleBackgroundLeft:SetWidth(30);
|
Zerotorescue@132
|
545 titleBackgroundLeft:SetHeight(40);
|
Zerotorescue@132
|
546
|
Zerotorescue@132
|
547 local titleBackgroundRight = frame:CreateTexture(nil, "OVERLAY");
|
Zerotorescue@132
|
548 titleBackgroundRight:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header");
|
Zerotorescue@132
|
549 titleBackgroundRight:SetTexCoord(0.67, 0.77, 0, 0.63);
|
Zerotorescue@132
|
550 titleBackgroundRight:SetPoint("LEFT", titleBackground, "RIGHT");
|
Zerotorescue@132
|
551 titleBackgroundRight:SetWidth(30);
|
Zerotorescue@132
|
552 titleBackgroundRight:SetHeight(40);
|
Zerotorescue@132
|
553
|
Zerotorescue@132
|
554 local frmTitle = CreateFrame("Frame", nil, frame);
|
Zerotorescue@132
|
555 frmTitle:EnableMouse(true);
|
Zerotorescue@132
|
556 frmTitle:SetScript("OnMouseDown", function(this) this:GetParent():StartMoving(); end);
|
Zerotorescue@132
|
557 frmTitle:SetScript("OnMouseUp", function(this) this:GetParent():StopMovingOrSizing(); end);
|
Zerotorescue@132
|
558 frmTitle:SetAllPoints(titleBackground);
|
Zerotorescue@132
|
559
|
Zerotorescue@132
|
560 local lblTitle = frmTitle:CreateFontString(nil, "OVERLAY", "GameFontNormal");
|
Zerotorescue@132
|
561 lblTitle:SetPoint("TOP", titleBackground, "TOP", 0, -14);
|
Zerotorescue@132
|
562 lblTitle:SetText("Unqueueables");
|
Zerotorescue@132
|
563
|
Zerotorescue@132
|
564 -- Because the scrolling table code-behind will change this element's height, we can't rely on that. Make a dummy frame which we can measure
|
Zerotorescue@132
|
565 local frmMeasureDummy = CreateFrame("Frame", nil, frame);
|
Zerotorescue@132
|
566 frmMeasureDummy:SetPoint("TOPLEFT", frame, "TOPLEFT", 15, -42);
|
Zerotorescue@132
|
567 frmMeasureDummy:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -15, 15);
|
Zerotorescue@132
|
568
|
Zerotorescue@132
|
569 frame.frmMeasureDummy = frmMeasureDummy;
|
Zerotorescue@132
|
570
|
Zerotorescue@132
|
571 -- Scrolling table with a list of items to be queued
|
Zerotorescue@132
|
572 local ScrollingTable = LibStub("ScrollingTable");
|
Zerotorescue@132
|
573 local scrollTable = ScrollingTable:CreateST({}, 4, 15, nil, frame); -- inserting a dummy cols, real cols to be set in SetFrameSettings
|
Zerotorescue@132
|
574 scrollTable.frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 15, -42);
|
Zerotorescue@132
|
575 scrollTable.frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -15, 15);
|
Zerotorescue@132
|
576 -- When moving over a row, provide a tooltip for the item
|
Zerotorescue@132
|
577 scrollTable:RegisterEvents({
|
Zerotorescue@132
|
578 ["OnEnter"] = function(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...)
|
Zerotorescue@132
|
579 if row and realrow then
|
Zerotorescue@132
|
580 -- Data row
|
Zerotorescue@132
|
581
|
Zerotorescue@132
|
582 if data[realrow] and data[realrow].rowData and data[realrow].rowData.itemId then
|
Zerotorescue@132
|
583 if column == 1 then
|
Zerotorescue@132
|
584 GameTooltip:SetOwner(rowFrame, "ANCHOR_NONE");
|
Zerotorescue@132
|
585 GameTooltip:SetPoint("TOPLEFT", rowFrame, "BOTTOMLEFT");
|
Zerotorescue@132
|
586 GameTooltip:SetHyperlink(("item:%d"):format(data[realrow].rowData.itemId));
|
Zerotorescue@132
|
587 GameTooltip:Show();
|
Zerotorescue@132
|
588 else
|
Zerotorescue@132
|
589 GameTooltip:SetOwner(cellFrame, "ANCHOR_NONE");
|
Zerotorescue@132
|
590 GameTooltip:SetPoint("TOPLEFT", cellFrame, "BOTTOMLEFT");
|
Zerotorescue@132
|
591 GameTooltip:SetText(data[realrow].rowData.reason[1]);
|
Zerotorescue@132
|
592 GameTooltip:AddLine(data[realrow].rowData.reason[2], 1, 1, 1, 1);
|
Zerotorescue@132
|
593 GameTooltip:Show();
|
Zerotorescue@132
|
594 end
|
Zerotorescue@132
|
595 end
|
Zerotorescue@132
|
596 else
|
Zerotorescue@132
|
597 -- Header row
|
Zerotorescue@132
|
598
|
Zerotorescue@132
|
599 if cols[column].tooltipTitle and type(cols[column].tooltipTitle) == "string" then
|
Zerotorescue@132
|
600 cellFrame.tooltipTitle = cols[column].tooltipTitle;
|
Zerotorescue@132
|
601 if cols[column].tooltip then
|
Zerotorescue@132
|
602 cellFrame.tooltip = cols[column].tooltip; -- Optional
|
Zerotorescue@132
|
603 else
|
Zerotorescue@132
|
604 cellFrame.tooltip = nil;
|
Zerotorescue@132
|
605 end
|
Zerotorescue@132
|
606
|
Zerotorescue@132
|
607 ShowTooltip(cellFrame);
|
Zerotorescue@132
|
608 end
|
Zerotorescue@132
|
609 end
|
Zerotorescue@132
|
610 end,
|
Zerotorescue@132
|
611 ["OnLeave"] = function(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...)
|
Zerotorescue@132
|
612 HideTooltip();
|
Zerotorescue@132
|
613 end,
|
Zerotorescue@141
|
614 ["OnClick"] = function() end,
|
Zerotorescue@132
|
615 });
|
Zerotorescue@132
|
616
|
Zerotorescue@132
|
617 frame.scrollTable = scrollTable;
|
Zerotorescue@132
|
618
|
Zerotorescue@132
|
619 -- Change the amount of displayed rows based on the size of the frame
|
Zerotorescue@132
|
620 frame.AdjustScrollTableRows = function(this)
|
Zerotorescue@132
|
621 local newRows = math.floor(( this.frmMeasureDummy:GetHeight() - 5 ) / 15);
|
Zerotorescue@132
|
622 newRows = (newRows < 4 and 4) or newRows;
|
Zerotorescue@132
|
623
|
Zerotorescue@132
|
624 this.scrollTable:SetDisplayRows(newRows, 15);
|
Zerotorescue@132
|
625 end;
|
Zerotorescue@132
|
626 frame:SetScript("OnSizeChanged", frame.AdjustScrollTableRows);
|
Zerotorescue@132
|
627 end
|
Zerotorescue@132
|
628 end
|
Zerotorescue@132
|
629
|
Zerotorescue@132
|
630 function addon:SetQueueFrameData(queueable, unqueueables)
|
Zerotorescue@132
|
631 InventoriumQueuer.scrollTable:SetData(queueable);
|
Zerotorescue@132
|
632 InventoriumQueuerUnqueueables.scrollTable:SetData(unqueueables);
|
Zerotorescue@132
|
633
|
Zerotorescue@132
|
634 InventoriumQueuer:Show();
|
Zerotorescue@132
|
635 end
|
Zerotorescue@132
|
636
|
Zerotorescue@145
|
637 function addon:SetQueueFrameSettings(title, description, proceed, cancel, craft, headers, unqueueablesHeaders)
|
Zerotorescue@132
|
638 local frame = InventoriumQueuer;
|
Zerotorescue@132
|
639
|
Zerotorescue@132
|
640 frame.lblTitle:SetText(title);
|
Zerotorescue@132
|
641 -- Adjust size for the title background
|
Zerotorescue@132
|
642 frame.titleBackground:SetWidth((frame.lblTitle:GetWidth() or 0) + 10); -- 10 pixels margin
|
Zerotorescue@132
|
643
|
Zerotorescue@132
|
644 frame.lblDescription:SetText(description);
|
Zerotorescue@132
|
645
|
Zerotorescue@132
|
646 frame.btnProceed:SetText(proceed.text);
|
Zerotorescue@132
|
647 frame.btnProceed.tooltipTitle = proceed.tooltipTitle;
|
Zerotorescue@132
|
648 frame.btnProceed.tooltip = proceed.tooltip;
|
Zerotorescue@132
|
649 frame.btnProceed.OnClick = proceed.onClick;
|
Zerotorescue@132
|
650
|
Zerotorescue@132
|
651 frame.btnCancel:SetText(cancel.text);
|
Zerotorescue@132
|
652 frame.btnCancel.tooltipTitle = cancel.tooltipTitle;
|
Zerotorescue@132
|
653 frame.btnCancel.tooltip = cancel.tooltip;
|
Zerotorescue@132
|
654 frame.btnCancel.OnClick = cancel.onClick;
|
Zerotorescue@132
|
655
|
Zerotorescue@145
|
656 frame.btnCraft:SetText(craft.text);
|
Zerotorescue@145
|
657 frame.btnCraft.tooltipTitle = craft.tooltipTitle;
|
Zerotorescue@145
|
658 frame.btnCraft.tooltip = craft.tooltip;
|
Zerotorescue@145
|
659 frame.btnCraft.OnClick = craft.onClick;
|
Zerotorescue@145
|
660
|
Zerotorescue@132
|
661 frame.scrollTable:SetDisplayCols(headers);
|
Zerotorescue@132
|
662
|
Zerotorescue@132
|
663 InventoriumQueuerUnqueueables.scrollTable:SetDisplayCols(unqueueablesHeaders);
|
Zerotorescue@132
|
664 end
|