Mercurial > wow > breuesk
changeset 40:90622848932b
Converted the tree to a dropdown + tree and the results are pretty good
author | John@Doomsday |
---|---|
date | Wed, 14 Mar 2012 10:13:48 -0400 |
parents | ecef0cba2913 |
children | dc9bfacca238 |
files | Gui.lua |
diffstat | 1 files changed, 64 insertions(+), 41 deletions(-) [+] |
line wrap: on
line diff
--- a/Gui.lua Wed Mar 14 10:13:30 2012 -0400 +++ b/Gui.lua Wed Mar 14 10:13:48 2012 -0400 @@ -66,56 +66,79 @@ if color == nil then return str end return "|cff"..tostring(color or "ffffff")..str.."|r" end - local tree = {} + local pull = {} + local ltemp = 0 for i,v in pairs(bsk.lists) do - local entry = {value=i,text=v.name} - if getn(v) > 0 then - entry.children = {} - for x,y in ipairs(v) do - local p = bsk.persons[y.id] - local line = {value=y.id,text=p.main,icon=[[Interface\Glues\CharacterCreate\UI-CharacterCreate-Classes]]} - line.iconCoords=CLASS_ICON_TCOORDS[p.class] - bsk:PopulateRaidList() -- todo: this should be elsewhere - if not bsk.raidIdP[y.id] and not bsk.reserveIdP[y.id] then - line.disabled = true - else - line.text=colorize(line.text,RAID_CLASS_COLORS[p.class]) - end - table.insert(entry.children,line) - end - else - entry.disabled=true + pull[i] = v.name + --local entry = {value=i,text=v.name} + if ltemp == 0 and getn(v) > 0 then + ltemp = i end - table.insert(tree,entry) end - local treegroup = AceGUI:Create("TreeGroup") - treegroup:SetTree(tree) - treegroup:EnableButtonTooltips(false) - treegroup:SetFullWidth(true) - treegroup:SetFullHeight(true) - treegroup:SetAutoAdjustHeight(false) - treegroup:SetCallback("OnGroupSelected", function(widget,_,uniquevalue) bsk:Print("OGS: uniquevalue: "..uniquevalue) - end) - treegroup:SetCallback("OnClick", function(widget,_,uniquevalue) bsk:Print("Onclick: uniquevalue: " .. uniquevalue) end) - treegroup:SetCallback("OnButtonEnter", function(widget,_,value) bsk:Print("OnButtonEnter: value: " .. value) end) + bsk:PopulateRaidList() -- todo: this should be elsewhere - container:AddChild(treegroup) - local scroller = AceGUI:Create("ScrollFrame") - scroller:SetLayout("List") - scroller:SetHeight(0) -- prevents a nasty graphical bug, dont ask me why - scroller:SetFullHeight(true) - scroller:SetFullWidth(true) + bsk.scroller = AceGUI:Create("ScrollFrame") + bsk.scroller:SetLayout("List") + bsk.scroller:SetHeight(0) -- prevents a nasty graphical bug, dont ask me why + bsk.scroller:SetFullHeight(true) + bsk.scroller:SetFullWidth(true) local label = AceGUI:Create("InteractiveLabel") label:SetText("fucking hell\n") - scroller:AddChild(label) - scroller:AddChild(rightGroup) - --widget:ReleaseChildren() - --widget:SetLayout("List") - --widget:AddChild(scroller) - treegroup:AddChild(scroller) + bsk.scroller:AddChild(label) + bsk.scroller:AddChild(rightGroup) + + bsk.treecontrol = AceGUI:Create("TreeGroup") + bsk.treecontrol:EnableButtonTooltips(false) + bsk.treecontrol:SetFullWidth(true) + bsk.treecontrol:SetFullHeight(true) + bsk.treecontrol:SetAutoAdjustHeight(false) + + bsk.treecontrol:AddChild(bsk.scroller) + + local pulldown = AceGUI:Create("Dropdown") + pulldown:SetWidth(175) + pulldown:SetList(pull) + for i,v in pairs(bsk.lists) do + if getn(v) == 0 then + pulldown:SetItemDisabled(i,true) + end + end + local ovc = function(_,_,value) + --bsk.treecontrol:ReleaseChildren() + local tree = {} + for x,y in ipairs(bsk.lists[value]) do + local p = bsk.persons[y.id] + local line = {value=y.id,text=p.main,icon=[[Interface\Glues\CharacterCreate\UI-CharacterCreate-Classes]]} + line.iconCoords=CLASS_ICON_TCOORDS[p.class] + if not bsk.raidIdP[y.id] and not bsk.reserveIdP[y.id] then + line.disabled = true + else + line.text=colorize(line.text,RAID_CLASS_COLORS[p.class]) + end + table.insert(tree,line) + end + bsk.treecontrol:SetTree(tree) + end + pulldown:SetCallback("OnValueChanged", ovc) + if ltemp > 0 then pulldown:SetValue(ltemp); ovc(nil,nil,ltemp) end -- sadly, SetValue doesn't fire a OnValueChanged + + container:AddChild(pulldown) + container:AddChild(bsk.treecontrol) + + --pulldown:EnableButtonTooltips(false) + --pulldown:SetFullWidth(true) + --pulldown:SetFullHeight(true) + --pulldown:SetAutoAdjustHeight(false) + + --pulldown:SetCallback("OnGroupSelected", function(widget,_,uniquevalue) bsk:Print("OGS: uniquevalue: "..uniquevalue) + --end) + --pulldown:SetCallback("OnClick", function(widget,_,uniquevalue) bsk:Print("Onclick: uniquevalue: " .. uniquevalue) end) + --pulldown:SetCallback("OnButtonEnter", function(widget,_,value) bsk:Print("OnButtonEnter: value: " .. value) end) + + end end