Mercurial > wow > breuesk
comparison Gui.lua @ 88:f844309a0e35
Clear out a few GUI bugs.
Re-integrate the escape button
author | John@Yosemite-PC |
---|---|
date | Mon, 16 Apr 2012 07:05:37 -0400 |
parents | db7e4ee34dce |
children |
comparison
equal
deleted
inserted
replaced
87:6035541e47dd | 88:f844309a0e35 |
---|---|
9 local sformat=string.format | 9 local sformat=string.format |
10 local tostring=tostring | 10 local tostring=tostring |
11 local type=type | 11 local type=type |
12 local getn=getn | 12 local getn=getn |
13 setfenv(1,bsk) | 13 setfenv(1,bsk) |
14 | |
15 -- todo: switching lists should close a presently-open bid | |
16 | 14 |
17 local copy = function(t) | 15 local copy = function(t) |
18 local c = {} | 16 local c = {} |
19 if not t then return c end | 17 if not t then return c end |
20 for i,v in pairs(t) do c[i] = v end | 18 for i,v in pairs(t) do c[i] = v end |
35 local pull = {} | 33 local pull = {} |
36 local lids = LootLists:GetAllIds() | 34 local lids = LootLists:GetAllIds() |
37 for _,v in pairs(lids) do | 35 for _,v in pairs(lids) do |
38 local l = LootLists:Select(v) | 36 local l = LootLists:Select(v) |
39 pull[l:GetId()] = l:GetName() | 37 pull[l:GetId()] = l:GetName() |
40 --local entry = {value=i,text=v.name} | |
41 if l:GetLength() > 0 then | 38 if l:GetLength() > 0 then |
42 pulldown:SetItemDisabled(i,true) | 39 pulldown:SetItemDisabled(i,true) |
43 end | 40 end |
44 end | 41 end |
45 pulldown:SetWidth(175) | 42 pulldown:SetWidth(175) |
53 local f, right -- important gui elements | 50 local f, right -- important gui elements |
54 local escapeButton = | 51 local escapeButton = |
55 { | 52 { |
56 shown = false, | 53 shown = false, |
57 ["IsShown"] = function(self) return self.shown end, | 54 ["IsShown"] = function(self) return self.shown end, |
58 ["Hide"] = function(self) if f then AceGUI:Release(f); self.shown=false end end | 55 ["Hide"] = function(self) if f then AceGUI:Release(f); self.shown=false; f=nil end end |
59 } | 56 } |
60 | 57 |
61 SelectorListEventDispatcher = | 58 SelectorListEventDispatcher = |
62 { | 59 { |
63 listeners = nil, | 60 listeners = nil, |
301 -- if dummydata[2] then dummydata[2].text = dummydata[2].text .. " (roll 73)" end | 298 -- if dummydata[2] then dummydata[2].text = dummydata[2].text .. " (roll 73)" end |
302 -- self.data = dummydata | 299 -- self.data = dummydata |
303 --end | 300 --end |
304 self:Redraw() | 301 self:Redraw() |
305 end, | 302 end, |
306 ["Force"] = function(self,who) -- todo: remove this and the horse it rode in on | |
307 local new = self.Convert(who,72) | |
308 InitiateBid(new) | |
309 --self:Redraw() | |
310 end, | |
311 ["Retract"] = function(self,who) -- todo: remove this and the horse it rode in on | |
312 -- todo | |
313 --for i,v in pairs(self.data) do | |
314 -- if who.value == v.value then | |
315 -- table.remove(self.data,i) | |
316 -- end | |
317 --end | |
318 InitiateRetract(copy(who)) | |
319 --self:Redraw() | |
320 end, | |
321 ["Convert"] = function(who,roll) -- convert an LE object into one suitable to put in a SelectorList | 303 ["Convert"] = function(who,roll) -- convert an LE object into one suitable to put in a SelectorList |
322 local new = copy(who) | 304 local new = copy(who) |
323 new.disabled = false -- todo: should be unnessary - they can't get on the list like this | 305 new.disabled = false -- todo: should be unnessary - they can't get on the list like this |
324 if roll then | 306 if roll then |
325 new.text = new.text .. " (roll 73)" | 307 new.text = new.text .. " (roll 73)" |
426 widget = adminRetract, | 408 widget = adminRetract, |
427 ["Redraw"] = function(self,_) self.widget:SetDisabled(true); self.widget:SetText("Retract bid") end, | 409 ["Redraw"] = function(self,_) self.widget:SetDisabled(true); self.widget:SetText("Retract bid") end, |
428 ["OnSelection"] = function(self,_) self.widget:SetDisabled(false); self.widget:SetText(sformat("Retract bid (%s)",RListEventDispatch:LatestValue().textPlain)) end, | 410 ["OnSelection"] = function(self,_) self.widget:SetDisabled(false); self.widget:SetText(sformat("Retract bid (%s)",RListEventDispatch:LatestValue().textPlain)) end, |
429 ["OnSelectionCleared"] = function(self) self.widget:SetDisabled(true); self.widget:SetText("Retract bid") end | 411 ["OnSelectionCleared"] = function(self) self.widget:SetDisabled(true); self.widget:SetText("Retract bid") end |
430 } | 412 } |
431 adminRetract:SetCallback("OnClick",function(widget) RListPopulator:Retract(RListEventDispatch:LatestValue()) end) | 413 adminRetract:SetCallback("OnClick",function(widget) InitiateRetract(RListEventDispatch:LatestValue()) end) |
432 RListEventDispatch:RegisterListener(adminRetract.userdata) | 414 RListEventDispatch:RegisterListener(adminRetract.userdata) |
433 adminRetract:SetDisabled(true) | 415 adminRetract:SetDisabled(true) |
434 | 416 |
435 g1:AddChildren(adminForce,adminRetract) | 417 g1:AddChildren(adminForce,adminRetract) |
436 end | 418 end |
571 end | 553 end |
572 end | 554 end |
573 | 555 |
574 function CreateGUI() | 556 function CreateGUI() |
575 -- special registration procedure to be closable with the escape button | 557 -- special registration procedure to be closable with the escape button |
576 --escapeButton.shown = true | 558 escapeButton.shown = true |
577 --_G["BSK_ESCAPEBUTTON"] = escapeButton | 559 _G["BSK_ESCAPEBUTTON"] = escapeButton |
578 --table.insert(_G.UISpecialFrames, "BSK_ESCAPEBUTTON") | 560 table.insert(_G.UISpecialFrames, "BSK_ESCAPEBUTTON") |
579 | 561 |
580 if f then return end -- no second gui please | 562 if f then return end -- no second gui please |
581 f = AceGUI:Create("Frame") | 563 f = AceGUI:Create("Frame") |
582 | 564 |
583 f:SetCallback("OnClose",function(widget) escapeButton.shown = false; AceGUI:Release(widget); f=nil; right=nil; SListEventDispatch:Release(); LListEventDispatch:Release(); SListPopulator:Release(); RListEventDispatch:Release(); LListPopulator:Release(); RListPopulator:Release(); BZPopulator:Release(); AdminLootButtons:Release() end) | 565 f:SetCallback("OnClose",function(widget) escapeButton.shown = false; AceGUI:Release(widget); f=nil; right=nil; SListEventDispatch:Release(); LListEventDispatch:Release(); SListPopulator:Release(); RListEventDispatch:Release(); LListPopulator:Release(); RListPopulator:Release(); BZPopulator:Release(); AdminLootButtons:Release() end) |