John@38
|
1 local AceGUI = LibStub("AceGUI-3.0")
|
John@42
|
2 local bsk=bsk
|
John@42
|
3 local _G=_G
|
John@42
|
4 local table=table
|
John@42
|
5 local pairs=pairs
|
John@65
|
6 local setmetatable=setmetatable
|
John@42
|
7 local ipairs=ipairs
|
John@42
|
8 local string=string
|
John@67
|
9 local sformat=string.format
|
John@42
|
10 local tostring=tostring
|
John@42
|
11 local type=type
|
John@42
|
12 local getn=getn
|
John@42
|
13 setfenv(1,bsk)
|
John@1
|
14
|
John@56
|
15 local copy = function(t)
|
John@56
|
16 local c = {}
|
John@56
|
17 if not t then return c end
|
John@56
|
18 for i,v in pairs(t) do c[i] = v end
|
John@56
|
19 return c
|
John@56
|
20 end
|
John@56
|
21 local colorize = function(str,color)
|
John@56
|
22 if str==nil or str=="" then return "" end
|
John@56
|
23 if type(color) == "table" then
|
John@56
|
24 color = string.format("%02x%02x%02x",255*color.r,255*color.g,255*color.b)
|
John@56
|
25 end
|
John@56
|
26 if color == nil then return str end
|
John@56
|
27 return "|cff"..tostring(color or "ffffff")..str.."|r"
|
John@56
|
28 end
|
John@1
|
29
|
John@63
|
30 local CreateListSelector = function(SListPopulator)
|
John@56
|
31 PersonList:RefreshRaidList()
|
John@56
|
32 local pulldown = AceGUI:Create("Dropdown")
|
John@56
|
33 local pull = {}
|
John@56
|
34 local ltemp = 0
|
John@56
|
35 local lids = LootLists:GetAllIds()
|
John@56
|
36 for _,v in pairs(lids) do
|
John@56
|
37 local l = LootLists:Select(v)
|
John@56
|
38 pull[l:GetId()] = l:GetName()
|
John@56
|
39 --local entry = {value=i,text=v.name}
|
John@56
|
40 if l:GetLength() > 0 then
|
John@56
|
41 pulldown:SetItemDisabled(i,true)
|
John@56
|
42 if ltemp == 0 then
|
John@56
|
43 ltemp = l:GetId()
|
John@51
|
44 end
|
John@51
|
45 end
|
John@1
|
46 end
|
John@56
|
47 pulldown:SetWidth(175)
|
John@56
|
48 pulldown:SetList(pull)
|
John@63
|
49 pulldown:SetCallback("OnValueChanged", function(_,_,value) SListPopulator:SetList(value) end)
|
John@63
|
50 if ltemp > 0 then pulldown:SetValue(ltemp); SListPopulator:SetList(ltemp) end -- sadly, SetValue doesn't fire a OnValueChanged
|
John@56
|
51 return pulldown
|
John@1
|
52 end
|
John@1
|
53
|
John@65
|
54 local f, right
|
John@59
|
55 local escapeButton =
|
John@59
|
56 {
|
John@59
|
57 shown = false,
|
John@59
|
58 ["IsShown"] = function(self) return self.shown end,
|
John@60
|
59 ["Hide"] = function(self) if f then AceGUI:Release(f); self.shown=false end end
|
John@59
|
60 }
|
John@38
|
61
|
John@63
|
62
|
John@65
|
63 SelectorListEventDispatcher =
|
John@63
|
64 {
|
John@65
|
65 listeners = nil,
|
John@63
|
66 target = nil,
|
John@67
|
67 line = nil,
|
John@63
|
68 ["SetTarget"] = function(self,other)
|
John@63
|
69 self.target = other
|
John@65
|
70 self.target:SetCallback("OnSelectionCleared",function(...) self:OnSelectionCleared(...) end)
|
John@65
|
71 self.target:SetCallback("OnSelection",function(...) self:OnSelection(...) end)
|
John@63
|
72 end,
|
John@63
|
73 ["RegisterListener"] = function(self,other) table.insert(self.listeners,other) end,
|
John@63
|
74 ["OnSelectionCleared"] = function(self,_)
|
John@67
|
75 self.line = nil
|
John@63
|
76 self:Event("OnSelectionCleared")
|
John@63
|
77 end,
|
John@65
|
78 ["OnSelection"] = function(self,_,_,line)
|
John@67
|
79 self.line = line
|
John@63
|
80 self:Event("OnSelection",line)
|
John@63
|
81 end,
|
John@63
|
82 ["Event"] = function(self,event,arg)
|
John@63
|
83 if not self.target then error("Event called with no listener...") end
|
John@63
|
84 if not self.listeners then return end
|
John@63
|
85 for i,v in pairs(self.listeners) do
|
John@67
|
86 --bsk.print("listener")
|
John@63
|
87 if type(v) == "table" then
|
John@63
|
88 if v[event] then
|
John@63
|
89 v[event](v,arg)
|
John@63
|
90 end
|
John@63
|
91 elseif type(v) == "function" then
|
John@63
|
92 v(event,arg)
|
John@63
|
93 elseif type(v) ~= "nil" then -- allow nils to pass quietly
|
John@63
|
94 _G.error("Bad listener - "..type(v))
|
John@63
|
95 end
|
John@63
|
96 end
|
John@63
|
97 end,
|
John@67
|
98 ["Release"] = function(self) self.listeners = {}; self.target=nil; self.line=nil end,
|
John@67
|
99 ["LatestValue"] = function(self) return self.line end
|
John@63
|
100 }
|
John@65
|
101 function SelectorListEventDispatcher:new()
|
John@65
|
102 local t = {}
|
John@65
|
103 setmetatable(t,SelectorListEventDispatcher)
|
John@65
|
104 self.__index = self
|
John@65
|
105 t.listeners = {}
|
John@65
|
106 return t
|
John@63
|
107 end
|
John@65
|
108
|
John@65
|
109 SListEventDispatch = SelectorListEventDispatcher:new()
|
John@65
|
110 LListEventDispatch = SelectorListEventDispatcher:new()
|
John@67
|
111 RListEventDispatch = SelectorListEventDispatcher:new()
|
John@65
|
112
|
John@65
|
113 local AdminLootEventCollector =
|
John@65
|
114 {
|
John@65
|
115 listeners = {},
|
John@65
|
116 target1 =
|
John@65
|
117 {
|
John@65
|
118 },
|
John@65
|
119 target2 =
|
John@65
|
120 {
|
John@65
|
121 },
|
John@65
|
122
|
John@65
|
123
|
John@65
|
124 }
|
John@65
|
125
|
John@63
|
126 local SListPopulator =
|
John@63
|
127 {
|
John@63
|
128 filtered = false,
|
John@63
|
129 widget = nil,
|
John@63
|
130 data = nil,
|
John@63
|
131 lref = nil,
|
John@63
|
132
|
John@63
|
133 ["Release"] = function(self) self.filtered, self.widget, self.data, self.lref = false, nil, nil, nil end,
|
John@63
|
134 ["Redraw"] = function(self)
|
John@63
|
135 if self.lref == nil or self.widget == nil then return end -- don't do work if not fully initialized
|
John@63
|
136 self.data = {}
|
John@63
|
137 for le in self.lref:OrderedListEntryIter() do
|
John@63
|
138 local disabled = not PersonList:IsActive(le:GetId())
|
John@63
|
139 if not self.filtered or not disabled then
|
John@63
|
140 local line = {value=le:GetId(),text=le:GetName(),icon=[[Interface\Glues\CharacterCreate\UI-CharacterCreate-Classes]]}
|
John@63
|
141 line.iconCoords=_G.CLASS_ICON_TCOORDS[le:GetClass()]
|
John@67
|
142 line.textPlain = line.text
|
John@63
|
143 line.text=colorize(line.text,_G.RAID_CLASS_COLORS[le:GetClass()])
|
John@63
|
144 line.disabled = disabled
|
John@63
|
145 table.insert(self.data,line)
|
John@63
|
146 end
|
John@63
|
147 end
|
John@63
|
148 self.widget:SetList(self.data)
|
John@65
|
149 SListEventDispatch:Event("Redraw")
|
John@63
|
150 end,
|
John@63
|
151 ["SetWidget"] = function(self,w)
|
John@65
|
152 if type(w) ~= "table" or type(w.SetList) ~= "function" then
|
John@63
|
153 _G.error("Bad SetWidget")
|
John@63
|
154 end
|
John@63
|
155 self.widget = w
|
John@63
|
156 end,
|
John@63
|
157 ["SetFiltered"] = function(self,value)
|
John@63
|
158 self.filtered = value
|
John@63
|
159 self:Redraw()
|
John@63
|
160 end,
|
John@63
|
161 ["SetList"] = function(self,value)
|
John@63
|
162 self.lref = LootLists:Select(value)
|
John@63
|
163 self:Redraw()
|
John@63
|
164 end
|
John@63
|
165 }
|
John@63
|
166
|
John@42
|
167 function CreateGUI()
|
John@59
|
168 -- special registration procedure to be closable with the escape button
|
John@59
|
169 --escapeButton.shown = true
|
John@59
|
170 --_G["BSK_ESCAPEBUTTON"] = escapeButton
|
John@59
|
171 --table.insert(_G.UISpecialFrames, "BSK_ESCAPEBUTTON")
|
John@59
|
172
|
John@60
|
173 if f then return end -- no second gui please
|
John@60
|
174 local admin = bsk.admin or true
|
John@59
|
175 f = AceGUI:Create("Frame")
|
John@1
|
176
|
John@67
|
177 f:SetCallback("OnClose",function(widget) escapeButton.shown = false; AceGUI:Release(widget); f=nil; right=nil; SListEventDispatch:Release(); LListEventDispatch:Release(); SListPopulator:Release(); RListEventDispatch:Release() end)
|
John@56
|
178 f:SetTitle("BSK")
|
John@56
|
179 f:SetLayout("Flow")
|
John@56
|
180 f:SetHeight(680)
|
John@56
|
181 f:SetWidth(580)
|
John@1
|
182
|
John@56
|
183 local left = AceGUI:Create("InlineGroup")
|
John@56
|
184 left:SetLayout("List")
|
John@56
|
185 left:SetWidth(175)
|
John@56
|
186 left:SetFullHeight(true)
|
John@56
|
187 left.alignoffset=0.25 -- hack, as per http://forums.wowace.com/showthread.php?t=17114
|
John@1
|
188
|
John@65
|
189 right = AceGUI:Create("InlineGroup")
|
John@56
|
190 right:SetLayout("Flow")
|
John@56
|
191 right:SetWidth(700-175-160)
|
John@56
|
192 right:SetFullHeight(true)
|
John@56
|
193 right.alignoffset=0.25
|
John@38
|
194
|
John@56
|
195 local t1 = AceGUI:Create("SelectorList")
|
John@56
|
196 t1:SetNumLines(25)
|
John@56
|
197 t1:SetFullWidth(true)
|
John@56
|
198 t1:SetInteractive(admin)
|
John@63
|
199 SListPopulator:SetWidget(t1)
|
John@63
|
200 SListEventDispatch:SetTarget(t1)
|
John@38
|
201
|
John@63
|
202 local p1 = CreateListSelector(SListPopulator)
|
John@56
|
203 p1:SetFullWidth(true)
|
John@38
|
204
|
John@56
|
205 left:AddChild(p1)
|
John@56
|
206 left:AddChild(t1)
|
John@38
|
207
|
John@56
|
208 local t2 = AceGUI:Create("SelectorList")
|
John@56
|
209 t2:SetNumLines(7)
|
John@56
|
210 t2:SetFullWidth(true)
|
John@56
|
211 t2:EnableButtonTooltips(true)
|
John@56
|
212 t2:SetList({
|
John@56
|
213 {
|
John@56
|
214 value=1,
|
John@56
|
215 text = "|cffa335ee|Hitem:77109:4080:4009:0:0:0:0:0:85:0|h[Band of Reconstruction]|h|r",
|
John@56
|
216 link = "|cffa335ee|Hitem:77109:4080:4009:0:0:0:0:0:85:0|h[Band of Reconstruction]|h|r",
|
John@56
|
217 },
|
John@56
|
218 {
|
John@56
|
219 value=2,
|
John@56
|
220 text = "|cffa335ee|Hitem:19351:0:0:0:0:0:0:0:85:0|h[Maladath, Runed Blade of the Black Flight]|h|r",
|
John@56
|
221 link = "|cffa335ee|Hitem:19351:0:0:0:0:0:0:0:85:0|h[Maladath, Runed Blade of the Black Flight]|h|r"
|
John@56
|
222 },
|
John@56
|
223 {
|
John@56
|
224 value=3,
|
John@56
|
225 text = "|cffa335ee|Hitem:31986:0:0:0:0:0:0:0:85:0|h[Merciless Gladiator's Crossbow of the Phoenix]|h|r",
|
John@56
|
226 link = "|cffa335ee|Hitem:31986:0:0:0:0:0:0:0:85:0|h[Merciless Gladiator's Crossbow of the Phoenix]|h|r"
|
John@56
|
227 },
|
John@56
|
228 {
|
John@56
|
229 value=4,
|
John@56
|
230 text = "|cffa335ee|Hitem:65003:0:0:0:0:0:0:0:85:0|h[Reclaimed Ashkandi, Greatsword of the Brotherhood]|h|r",
|
John@56
|
231 link = "|cffa335ee|Hitem:65003:0:0:0:0:0:0:0:85:0|h[Reclaimed Ashkandi, Greatsword of the Brotherhood]|h|r"
|
John@56
|
232 },
|
John@56
|
233 {
|
John@56
|
234 value=5,
|
John@56
|
235 text = "|cffff8000|Hitem:19019:0:0:0:0:0:0:0:85:0|h[Thunderfury, Blessed Blade of the Windseeker]|h|r",
|
John@56
|
236 link = "|cffff8000|Hitem:19019:0:0:0:0:0:0:0:85:0|h[Thunderfury, Blessed Blade of the Windseeker]|h|r"
|
John@56
|
237 },
|
John@56
|
238 })
|
John@65
|
239 LListEventDispatch:SetTarget(t2)
|
John@65
|
240
|
John@65
|
241 local biddingZone = AceGUI:Create("SimpleGroup")
|
John@65
|
242 biddingZone:SetLayout("Flow")
|
John@65
|
243 biddingZone:SetFullWidth(true)
|
John@38
|
244
|
John@60
|
245 local alb1, alb2, alb3
|
John@60
|
246 if admin then
|
John@60
|
247 alb1 = AceGUI:Create("Button")
|
John@60
|
248 alb1:SetWidth(100)
|
John@60
|
249 alb1:SetText("Open Bids")
|
John@65
|
250 alb1.userdata =
|
John@65
|
251 {
|
John@65
|
252 state = false,
|
John@65
|
253 widget = alb1,
|
John@65
|
254 ["Redraw"] = function(self,_) self.widget:SetDisabled(true); self.item = nil end,
|
John@65
|
255 ["OnSelection"] = function(self,value) self.widget:SetDisabled(false); self.item = value end,
|
John@65
|
256 ["OnSelectionCleared"] = function(self) self.widget:SetDisabled(true); self.item = nil end
|
John@65
|
257 }
|
John@65
|
258 alb1:SetDisabled(true)
|
John@65
|
259 LListEventDispatch:RegisterListener(alb1.userdata)
|
John@65
|
260 alb1:SetCallback("OnClick",
|
John@65
|
261 function(widget)
|
John@65
|
262 if widget.userdata.state then -- we were bidding when the button was pressed
|
John@65
|
263 biddingZone:ReleaseChildren()
|
John@67
|
264 RListEventDispatch:Release()
|
John@65
|
265 else
|
John@65
|
266 local spacer = AceGUI:Create("Label")
|
John@65
|
267 spacer:SetText(" ")
|
John@65
|
268 spacer:SetFullWidth(true)
|
John@65
|
269 local spacer2 = AceGUI:Create("Label")
|
John@65
|
270 spacer2:SetText(" ")
|
John@65
|
271 spacer2:SetFullWidth(true)
|
John@65
|
272
|
John@65
|
273 local label = AceGUI:Create("Label")
|
John@65
|
274 label:SetText("Bidding now open for ...")
|
John@65
|
275 local biddingOn = AceGUI:Create("InteractiveLabel")
|
John@67
|
276 biddingOn.userdata = { LListEventDispatch:LatestValue().link }
|
John@65
|
277 biddingOn:SetText(biddingOn.userdata[1])
|
John@65
|
278 biddingOn:SetFullWidth(true)
|
John@65
|
279 biddingOn:SetCallback("OnEnter", function(widget) _G.GameTooltip:SetOwner(widget.frame,"ANCHOR_RIGHT"); _G.GameTooltip:SetHyperlink(widget.userdata[1]); _G.GameTooltip:Show() end )
|
John@65
|
280 biddingOn:SetCallback("OnLeave", function(widget) _G.GameTooltip:Hide() end )
|
John@65
|
281 local b1 = AceGUI:Create("SelectorList")
|
John@65
|
282 b1:SetNumLines(6)
|
John@65
|
283 b1:SetInteractive(admin)
|
John@65
|
284 local bidTitle = AceGUI:Create("Label")
|
John@65
|
285 bidTitle:SetText("Current bids")
|
John@65
|
286 bidTitle:SetFullWidth(true)
|
John@65
|
287
|
John@65
|
288 local bidRetractButton = AceGUI:Create("Button")
|
John@65
|
289 bidRetractButton:SetText("Place Bid")
|
John@65
|
290 bidRetractButton:SetWidth(100)
|
John@65
|
291 local rollButton = AceGUI:Create("Button")
|
John@65
|
292 rollButton:SetText("Offset Roll")
|
John@65
|
293 rollButton:SetWidth(100)
|
John@65
|
294
|
John@67
|
295 local dummydata= {}
|
John@67
|
296 local tree =SListPopulator.data
|
John@67
|
297 for i,v in pairs(tree) do dummydata[i] = copy(v); dummydata[i].disabled = false end
|
John@67
|
298 if dummydata[2] then dummydata[2].text = dummydata[2].text .. " (roll 73)" end
|
John@67
|
299 b1:SetList(dummydata)
|
John@67
|
300
|
John@65
|
301 local g1
|
John@65
|
302 if admin then
|
John@67
|
303 RListEventDispatch:SetTarget(b1)
|
John@65
|
304 b1.alignoffset = 0.25 -- or else g1 won't align well
|
John@65
|
305 g1 = AceGUI:Create("SimpleGroup")
|
John@65
|
306 g1.alignoffset = 0.25
|
John@65
|
307 g1:SetWidth(120)
|
John@65
|
308 g1:SetLayout("List")
|
John@65
|
309
|
John@67
|
310 -- todo: convoluted and repetitive - surely there's a
|
John@67
|
311 -- better way than this ...
|
John@65
|
312 adminForce = AceGUI:Create("Button")
|
John@67
|
313 if SListEventDispatch:LatestValue() then
|
John@67
|
314 adminForce:SetText(sformat("Force bid (%s)",SListEventDispatch:LatestValue().textPlain))
|
John@67
|
315 adminForce:SetDisabled(false)
|
John@67
|
316 else
|
John@67
|
317 adminForce:SetText("Force bid")
|
John@67
|
318 adminForce:SetDisabled(true)
|
John@67
|
319 end
|
John@67
|
320 adminForce:SetWidth(160)
|
John@67
|
321 adminForce.userdata =
|
John@67
|
322 {
|
John@67
|
323 widget = adminForce,
|
John@67
|
324 ["Redraw"] = function(self,_) self.widget:SetDisabled(true); self.widget:SetText("Force bid") end,
|
John@67
|
325 ["OnSelection"] = function(self,_) self.widget:SetDisabled(false); self.widget:SetText(sformat("Force bid (%s)",SListEventDispatch:LatestValue().textPlain)) end,
|
John@67
|
326 ["OnSelectionCleared"] = function(self) self.widget:SetDisabled(true); self.widget:SetText("Force bid") end
|
John@67
|
327 }
|
John@67
|
328 SListEventDispatch:RegisterListener(adminForce.userdata)
|
John@65
|
329
|
John@65
|
330 adminRetract = AceGUI:Create("Button")
|
John@67
|
331 if RListEventDispatch:LatestValue() then
|
John@67
|
332 adminRetract:SetText(sformat("Retract bid (%s)",RListEventDispatch:LatestValue().textPlain))
|
John@67
|
333 adminRetract:SetDisabled(false)
|
John@67
|
334 else
|
John@67
|
335 adminRetract:SetText("Retract bid")
|
John@67
|
336 adminRetract:SetDisabled(true)
|
John@67
|
337 end
|
John@67
|
338 adminRetract:SetWidth(160)
|
John@67
|
339 adminRetract.userdata =
|
John@67
|
340 {
|
John@67
|
341 widget = adminRetract,
|
John@67
|
342 ["Redraw"] = function(self,_) self.widget:SetDisabled(true); self.widget:SetText("Retract bid") end,
|
John@67
|
343 ["OnSelection"] = function(self,_) self.widget:SetDisabled(false); self.widget:SetText(sformat("Retract bid (%s)",RListEventDispatch:LatestValue().textPlain)) end,
|
John@67
|
344 ["OnSelectionCleared"] = function(self) self.widget:SetDisabled(true); self.widget:SetText("Retract bid") end
|
John@67
|
345 }
|
John@67
|
346 RListEventDispatch:RegisterListener(adminRetract.userdata)
|
John@67
|
347 adminRetract:SetDisabled(true)
|
John@65
|
348
|
John@65
|
349 g1:AddChildren(adminForce,adminRetract)
|
John@65
|
350 end
|
John@65
|
351
|
John@65
|
352 biddingZone:AddChildren(spacer,label,biddingOn,bidRetractButton,rollButton,spacer2,bidTitle,b1)
|
John@65
|
353 if admin then biddingZone:AddChildren(g1) end
|
John@65
|
354 end
|
John@65
|
355 widget.userdata.state = not widget.userdata.state
|
John@65
|
356 end
|
John@65
|
357 )
|
John@60
|
358
|
John@60
|
359 alb2 = AceGUI:Create("Button")
|
John@60
|
360 alb2:SetWidth(100)
|
John@60
|
361 alb2:SetText("Assign")
|
John@65
|
362 alb2.userdata =
|
John@65
|
363 {
|
John@65
|
364 widget = alb2,
|
John@65
|
365 ["OnUpdate"] = function(self) self.widget:SetDisabled(not (self.slist.checked and self.llist.checked)) end,
|
John@65
|
366 }
|
John@65
|
367 alb2.userdata.slist =
|
John@65
|
368 {
|
John@65
|
369 parent = alb2.userdata,
|
John@65
|
370 checked = false,
|
John@65
|
371 ["Redraw"] = function(self) self.checked = false; self.parent:OnUpdate() end,
|
John@65
|
372 ["OnSelection"] = function(self) self.checked = true; self.parent:OnUpdate() end,
|
John@65
|
373 ["OnSelectionCleared"] = function(self) self.checked = false; self.parent:OnUpdate() end,
|
John@65
|
374 }
|
John@65
|
375 alb2.userdata.llist =
|
John@65
|
376 {
|
John@65
|
377 parent = alb2.userdata,
|
John@65
|
378 checked = false,
|
John@65
|
379 ["Redraw"] = function(self) self.checked = false; self.parent:OnUpdate() end,
|
John@65
|
380 ["OnSelection"] = function(self) self.checked = true; self.parent:OnUpdate() end,
|
John@65
|
381 ["OnSelectionCleared"] = function(self) self.checked = false; self.parent:OnUpdate() end,
|
John@65
|
382 }
|
John@65
|
383 SListEventDispatch:RegisterListener(alb2.userdata.slist)
|
John@65
|
384 LListEventDispatch:RegisterListener(alb2.userdata.llist)
|
John@60
|
385
|
John@60
|
386 alb3 = AceGUI:Create("Button")
|
John@60
|
387 alb3:SetWidth(100)
|
John@60
|
388 alb3:SetText("Suicide")
|
John@65
|
389 alb3.userdata = -- TODO: holy hell, come up with a pattern or something for this ....
|
John@65
|
390 {
|
John@65
|
391 widget = alb3,
|
John@65
|
392 ["OnUpdate"] = function(self) self.widget:SetDisabled(not (self.slist.checked and self.llist.checked)) end,
|
John@65
|
393 }
|
John@65
|
394 alb3.userdata.slist =
|
John@65
|
395 {
|
John@65
|
396 parent = alb3.userdata,
|
John@65
|
397 checked = false,
|
John@65
|
398 ["Redraw"] = function(self) self.checked = false; self.parent:OnUpdate() end,
|
John@65
|
399 ["OnSelection"] = function(self) self.checked = true; self.parent:OnUpdate() end,
|
John@65
|
400 ["OnSelectionCleared"] = function(self) self.checked = false; self.parent:OnUpdate() end,
|
John@65
|
401 }
|
John@65
|
402 alb3.userdata.llist =
|
John@65
|
403 {
|
John@65
|
404 parent = alb3.userdata,
|
John@65
|
405 checked = false,
|
John@65
|
406 ["Redraw"] = function(self) self.checked = false; self.parent:OnUpdate() end,
|
John@65
|
407 ["OnSelection"] = function(self) self.checked = true; self.parent:OnUpdate() end,
|
John@65
|
408 ["OnSelectionCleared"] = function(self) self.checked = false; self.parent:OnUpdate() end,
|
John@65
|
409 }
|
John@65
|
410 SListEventDispatch:RegisterListener(alb3.userdata.slist)
|
John@65
|
411 LListEventDispatch:RegisterListener(alb3.userdata.llist)
|
John@60
|
412 end
|
John@38
|
413
|
John@65
|
414 local suicideSelected, undo
|
John@60
|
415 if admin then
|
John@60
|
416
|
John@60
|
417 suicideSelected = AceGUI:Create("Button")
|
John@60
|
418 suicideSelected:SetFullWidth(true)
|
John@60
|
419 suicideSelected:SetText("Suicide")
|
John@63
|
420 -- use userdata + SListEventDispatch to toggle state
|
John@63
|
421 suicideSelected.userdata =
|
John@63
|
422 {
|
John@63
|
423 widget = suicideSelected,
|
John@65
|
424 ["Redraw"] = function(self,_) self.widget:SetDisabled(true) end,
|
John@63
|
425 ["OnSelection"] = function(self,_) self.widget:SetDisabled(false) end,
|
John@63
|
426 ["OnSelectionCleared"] = function(self) self.widget:SetDisabled(true) end
|
John@63
|
427 }
|
John@63
|
428 SListEventDispatch:RegisterListener(suicideSelected.userdata)
|
John@60
|
429
|
John@60
|
430 undo = AceGUI:Create("Button")
|
John@63
|
431 undo:SetText("Undo / out of order")
|
John@60
|
432 undo:SetFullWidth(true)
|
John@63
|
433 undo:SetDisabled(true)
|
John@60
|
434 end
|
John@60
|
435
|
John@56
|
436 local filter = AceGUI:Create("CheckBox")
|
John@56
|
437 filter:SetLabel("Only show active")
|
John@56
|
438 filter:SetFullWidth(true)
|
John@63
|
439 filter:SetValue(false)
|
John@63
|
440 SListPopulator:SetFiltered(false)
|
John@63
|
441 filter:SetCallback("OnValueChanged",function(widget,_,value) SListPopulator:SetFiltered(value) end)
|
John@56
|
442
|
John@56
|
443 left:AddChildren(filter)
|
John@56
|
444 if admin then left:AddChildren(suicideSelected,undo) end
|
John@56
|
445 right:AddChildren(t2)
|
John@56
|
446 if admin then right:AddChildren(alb1,alb2,alb3) end
|
John@56
|
447 right:AddChildren(biddingZone)
|
John@56
|
448 f:AddChildren(left,right)
|
John@58
|
449
|
John@58
|
450
|
John@1
|
451 end
|