comparison Gui.lua @ 51:11f18e279229

Updating to use the new APIs
author John@Yosemite-PC
date Wed, 21 Mar 2012 23:23:31 -0400
parents 4109683c3172
children 94ae80d58903
comparison
equal deleted inserted replaced
50:b155a875de42 51:11f18e279229
74 color = string.format("%02x%02x%02x",255*color.r,255*color.g,255*color.b) 74 color = string.format("%02x%02x%02x",255*color.r,255*color.g,255*color.b)
75 end 75 end
76 if color == nil then return str end 76 if color == nil then return str end
77 return "|cff"..tostring(color or "ffffff")..str.."|r" 77 return "|cff"..tostring(color or "ffffff")..str.."|r"
78 end 78 end
79 local pull = {} 79
80 local ltemp = 0 80 PersonList:RefreshRaidList() -- todo: this should be elsewhere
81 for i,v in pairs(lists) do
82 pull[i] = v.name
83 --local entry = {value=i,text=v.name}
84 if ltemp == 0 and getn(v) > 0 then
85 ltemp = i
86 end
87 end
88
89 PopulateRaidList() -- todo: this should be elsewhere
90
91 81
92 scroller = AceGUI:Create("ScrollFrame") 82 scroller = AceGUI:Create("ScrollFrame")
93 scroller:SetLayout("List") 83 scroller:SetLayout("List")
94 scroller:SetHeight(0) -- prevents a nasty graphical bug, dont ask me why 84 scroller:SetHeight(0) -- prevents a nasty graphical bug, dont ask me why
95 scroller:SetFullHeight(true) 85 scroller:SetFullHeight(true)
107 treecontrol:SetAutoAdjustHeight(false) 97 treecontrol:SetAutoAdjustHeight(false)
108 98
109 treecontrol:AddChild(scroller) 99 treecontrol:AddChild(scroller)
110 100
111 local pulldown = AceGUI:Create("Dropdown") 101 local pulldown = AceGUI:Create("Dropdown")
102 local pull = {}
103 local ltemp = 0
104 local lids = LootLists:GetAllIds()
105 for _,v in pairs(lids) do
106 local l = LootLists:Select(v)
107 pull[l:GetId()] = l:GetName()
108 --local entry = {value=i,text=v.name}
109 if l:GetLength() > 0 then
110 pulldown:SetItemDisabled(i,true)
111 if ltemp == 0 then
112 ltemp = l:GetId()
113 end
114 end
115 end
112 pulldown:SetWidth(175) 116 pulldown:SetWidth(175)
113 pulldown:SetList(pull) 117 pulldown:SetList(pull)
114 for i,v in pairs(lists) do 118 --for i,v in pairs(lists) do
115 if getn(v) == 0 then 119 -- if getn(v) == 0 then
116 pulldown:SetItemDisabled(i,true) 120 -- pulldown:SetItemDisabled(i,true)
117 end 121 -- end
118 end 122 --end
119 local ovc = function(_,_,value) 123 local ovc = function(_,_,value)
120 --treecontrol:ReleaseChildren() 124 --treecontrol:ReleaseChildren()
121 local tree = {} 125 local tree = {}
122 for x,y in ipairs(lists[value]) do 126 local l = LootLists:Select(value)
123 local p = persons[y.id] 127 for le in l:OrderedListEntryIter() do
124 local line = {value=y.id,text=p.main,icon=[[Interface\Glues\CharacterCreate\UI-CharacterCreate-Classes]]} 128 local line = {value=le:GetId(),text=le:GetName(),icon=[[Interface\Glues\CharacterCreate\UI-CharacterCreate-Classes]]}
125 line.iconCoords=_G.CLASS_ICON_TCOORDS[p.class] 129 line.iconCoords=_G.CLASS_ICON_TCOORDS[le:GetClass()]
126 if not raidIdP[y.id] and not reserveIdP[y.id] then 130 if not PersonList:IsActive(le:GetId()) then
127 line.disabled = true 131 line.disabled = true
128 else 132 else
129 line.text=colorize(line.text,_G.RAID_CLASS_COLORS[p.class]) 133 line.text=colorize(line.text,_G.RAID_CLASS_COLORS[le:GetClass()])
130 end 134 end
131 table.insert(tree,line) 135 table.insert(tree,line)
132 end 136 end
133 treecontrol:SetTree(tree) 137 treecontrol:SetTree(tree)
134 end 138 end