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@42
|
6 local ipairs=ipairs
|
John@42
|
7 local string=string
|
John@42
|
8 local tostring=tostring
|
John@42
|
9 local type=type
|
John@42
|
10 local getn=getn
|
John@42
|
11 setfenv(1,bsk)
|
John@1
|
12
|
John@1
|
13 local ChangeTab = function(container, event, group)
|
John@1
|
14 container:ReleaseChildren()
|
John@1
|
15 if group == "tab2" then
|
John@1
|
16 local desc = AceGUI:Create("Label")
|
John@1
|
17 desc:SetText("This is Tab 1")
|
John@1
|
18 desc:SetFullWidth(true)
|
John@1
|
19 container:AddChild(desc)
|
John@1
|
20
|
John@1
|
21 local button = AceGUI:Create("Button")
|
John@1
|
22 button:SetText("Tab 1 Button")
|
John@1
|
23 button:SetWidth(200)
|
John@1
|
24 container:AddChild(button)
|
John@1
|
25 elseif group == "tab1" then
|
John@38
|
26 --local leftGroup = AceGUI:Create("InlineGroup")
|
John@38
|
27 --leftGroup:SetFullHeight()
|
John@38
|
28 --leftGroup:SetWidth(200)
|
John@38
|
29
|
John@38
|
30 local rightGroup = AceGUI:Create("InlineGroup")
|
John@38
|
31 rightGroup:SetTitle("title")
|
John@38
|
32 --rightGroup:SetWidth(600)
|
John@38
|
33 --rightGroup:SetHeight(200)
|
John@38
|
34 rightGroup.width = 'fill'
|
John@38
|
35 --rightGroup:SetFullWidth()
|
John@38
|
36 --rightGroup.alignoffset = 25
|
John@38
|
37 rightGroup:SetLayout("Flow")
|
John@38
|
38
|
John@38
|
39 --local desc = AceGUI:Create("Label")
|
John@38
|
40 --desc:SetText("This is Tab 1")
|
John@38
|
41 --desc:SetFullWidth(true)
|
John@38
|
42 --container:AddChild(desc)
|
John@38
|
43 local icon = AceGUI:Create("Icon")
|
John@38
|
44 icon:SetImage([[Interface\Icons\INV_Misc_PocketWatch_01]])
|
John@38
|
45 local sz = 64 * icon.frame:GetEffectiveScale() -- 64 matches the character frame icon size
|
John@38
|
46 icon:SetWidth(sz,sz)
|
John@38
|
47 icon:SetHeight(sz,sz)
|
John@38
|
48 icon:SetImageSize(sz,sz)
|
John@42
|
49 icon:SetCallback("OnEnter", function(widget) _G.GameTooltip:SetOwner(widget.frame,"ANCHOR_RIGHT"); _G.GameTooltip:SetHyperlink("item:16846:0:0:0:0:0:0:0"); _G.GameTooltip:Show() end )
|
John@42
|
50 icon:SetCallback("OnLeave", function(widget) _G.GameTooltip:Hide() end )
|
John@38
|
51 rightGroup:AddChild(icon)
|
John@38
|
52
|
John@38
|
53 for i=1,12 do
|
John@38
|
54 icon = AceGUI:Create("Icon")
|
John@38
|
55 icon:SetImage([[Interface\Icons\INV_Misc_PocketWatch_01]])
|
John@38
|
56 local sz = 64 * icon.frame:GetEffectiveScale() -- 64 matches the character frame icon size
|
John@38
|
57 icon:SetWidth(sz,sz)
|
John@38
|
58 icon:SetHeight(sz,sz)
|
John@38
|
59 icon:SetImageSize(sz,sz)
|
John@42
|
60 icon:SetCallback("OnEnter", function(widget) _G.GameTooltip:SetOwner(widget.frame,"ANCHOR_RIGHT"); _G.GameTooltip:SetHyperlink("item:16846:0:0:0:0:0:0:0"); _G.GameTooltip:Show() end )
|
John@42
|
61 icon:SetCallback("OnLeave", function(widget) _G.GameTooltip:Hide() end )
|
John@38
|
62 rightGroup:AddChild(icon)
|
John@38
|
63 end
|
John@38
|
64
|
John@1
|
65 local item2 = {string="item2!", color = {r=1,g=0,b=0.5} }
|
John@38
|
66 local itemList = {"Item1", "item2", "Item3", "Item4"}
|
John@38
|
67 for i=5,29 do
|
John@38
|
68 table.insert(itemList,"Item"..i)
|
John@38
|
69 end
|
John@1
|
70
|
John@38
|
71 local colorize = function(str,color)
|
John@38
|
72 if str==nil or str=="" then return "" end
|
John@38
|
73 if type(color) == "table" then
|
John@38
|
74 color = string.format("%02x%02x%02x",255*color.r,255*color.g,255*color.b)
|
John@38
|
75 end
|
John@38
|
76 if color == nil then return str end
|
John@38
|
77 return "|cff"..tostring(color or "ffffff")..str.."|r"
|
John@38
|
78 end
|
John@38
|
79
|
John@51
|
80 PersonList:RefreshRaidList() -- todo: this should be elsewhere
|
John@38
|
81
|
John@42
|
82 scroller = AceGUI:Create("ScrollFrame")
|
John@42
|
83 scroller:SetLayout("List")
|
John@42
|
84 scroller:SetHeight(0) -- prevents a nasty graphical bug, dont ask me why
|
John@42
|
85 scroller:SetFullHeight(true)
|
John@42
|
86 scroller:SetFullWidth(true)
|
John@38
|
87
|
John@38
|
88 local label = AceGUI:Create("InteractiveLabel")
|
John@38
|
89 label:SetText("fucking hell\n")
|
John@42
|
90 scroller:AddChild(label)
|
John@42
|
91 scroller:AddChild(rightGroup)
|
John@40
|
92
|
John@42
|
93 treecontrol = AceGUI:Create("TreeGroup")
|
John@42
|
94 treecontrol:EnableButtonTooltips(false)
|
John@42
|
95 treecontrol:SetFullWidth(true)
|
John@42
|
96 treecontrol:SetFullHeight(true)
|
John@42
|
97 treecontrol:SetAutoAdjustHeight(false)
|
John@40
|
98
|
John@42
|
99 treecontrol:AddChild(scroller)
|
John@40
|
100
|
John@40
|
101 local pulldown = AceGUI:Create("Dropdown")
|
John@51
|
102 local pull = {}
|
John@51
|
103 local ltemp = 0
|
John@51
|
104 local lids = LootLists:GetAllIds()
|
John@51
|
105 for _,v in pairs(lids) do
|
John@51
|
106 local l = LootLists:Select(v)
|
John@51
|
107 pull[l:GetId()] = l:GetName()
|
John@51
|
108 --local entry = {value=i,text=v.name}
|
John@51
|
109 if l:GetLength() > 0 then
|
John@51
|
110 pulldown:SetItemDisabled(i,true)
|
John@51
|
111 if ltemp == 0 then
|
John@51
|
112 ltemp = l:GetId()
|
John@51
|
113 end
|
John@51
|
114 end
|
John@51
|
115 end
|
John@40
|
116 pulldown:SetWidth(175)
|
John@40
|
117 pulldown:SetList(pull)
|
John@51
|
118 --for i,v in pairs(lists) do
|
John@51
|
119 -- if getn(v) == 0 then
|
John@51
|
120 -- pulldown:SetItemDisabled(i,true)
|
John@51
|
121 -- end
|
John@51
|
122 --end
|
John@40
|
123 local ovc = function(_,_,value)
|
John@42
|
124 --treecontrol:ReleaseChildren()
|
John@40
|
125 local tree = {}
|
John@51
|
126 local l = LootLists:Select(value)
|
John@51
|
127 for le in l:OrderedListEntryIter() do
|
John@51
|
128 local line = {value=le:GetId(),text=le:GetName(),icon=[[Interface\Glues\CharacterCreate\UI-CharacterCreate-Classes]]}
|
John@51
|
129 line.iconCoords=_G.CLASS_ICON_TCOORDS[le:GetClass()]
|
John@51
|
130 if not PersonList:IsActive(le:GetId()) then
|
John@40
|
131 line.disabled = true
|
John@40
|
132 else
|
John@51
|
133 line.text=colorize(line.text,_G.RAID_CLASS_COLORS[le:GetClass()])
|
John@40
|
134 end
|
John@40
|
135 table.insert(tree,line)
|
John@40
|
136 end
|
John@42
|
137 treecontrol:SetTree(tree)
|
John@40
|
138 end
|
John@40
|
139 pulldown:SetCallback("OnValueChanged", ovc)
|
John@40
|
140 if ltemp > 0 then pulldown:SetValue(ltemp); ovc(nil,nil,ltemp) end -- sadly, SetValue doesn't fire a OnValueChanged
|
John@40
|
141
|
John@40
|
142 container:AddChild(pulldown)
|
John@42
|
143 container:AddChild(treecontrol)
|
John@40
|
144
|
John@40
|
145 --pulldown:EnableButtonTooltips(false)
|
John@40
|
146 --pulldown:SetFullWidth(true)
|
John@40
|
147 --pulldown:SetFullHeight(true)
|
John@40
|
148 --pulldown:SetAutoAdjustHeight(false)
|
John@40
|
149
|
John@43
|
150 --pulldown:SetCallback("OnGroupSelected", function(widget,_,uniquevalue) print("OGS: uniquevalue: "..uniquevalue)
|
John@40
|
151 --end)
|
John@43
|
152 --pulldown:SetCallback("OnClick", function(widget,_,uniquevalue) print("Onclick: uniquevalue: " .. uniquevalue) end)
|
John@43
|
153 --pulldown:SetCallback("OnButtonEnter", function(widget,_,value) print("OnButtonEnter: value: " .. value) end)
|
John@40
|
154
|
John@40
|
155
|
John@1
|
156 end
|
John@1
|
157 end
|
John@1
|
158
|
John@38
|
159 --local myhook = function(tooltip, spellid)
|
John@38
|
160 --tooltip:AddLine("MSS was here", 1, 1, 1)
|
John@38
|
161 --tooltip:Show()
|
John@38
|
162 --end
|
John@38
|
163 --if GameTooltip:GetScript("OnTooltipSetSpell") then
|
John@38
|
164 --GameTooltip:HookScript("OnTooltipSetSpell", myhook)
|
John@38
|
165 --else
|
John@38
|
166 --GameTooltip:SetScript("OnTooltipSetSpell", myhook)
|
John@38
|
167 --end
|
John@38
|
168
|
John@42
|
169 function CreateGUI()
|
John@1
|
170
|
John@1
|
171 -- Create a container frame
|
John@42
|
172 frame = AceGUI:Create("Frame")
|
John@42
|
173 frame:SetCallback("OnClose",function(widget) AceGUI:Release(widget) end)
|
John@42
|
174 frame:SetTitle("BSK")
|
John@42
|
175 frame:SetLayout("Flow")
|
John@42
|
176 frame:SetHeight(700)
|
John@42
|
177 frame:SetWidth(700)
|
John@1
|
178
|
John@38
|
179 --local opts =
|
John@38
|
180 --{
|
John@38
|
181
|
John@38
|
182 --}
|
John@1
|
183
|
John@38
|
184
|
John@38
|
185
|
John@38
|
186
|
John@38
|
187
|
John@38
|
188
|
John@38
|
189 --local tab = AceGUI:Create("TabGroup")
|
John@38
|
190 --tab:SetLayout("Flow")
|
John@38
|
191 --tab:SetTabs(
|
John@38
|
192 -- {
|
John@38
|
193 -- {
|
John@38
|
194 -- text="Tab 1",
|
John@38
|
195 -- value="tab1"
|
John@38
|
196 -- },
|
John@38
|
197
|
John@38
|
198 -- {
|
John@38
|
199 -- text="Tab 2",
|
John@38
|
200 -- value="tab2"
|
John@38
|
201 -- },
|
John@38
|
202 -- {
|
John@38
|
203 -- text="Tab 3",
|
John@38
|
204 -- value="tab3"
|
John@38
|
205 -- },
|
John@38
|
206 -- {
|
John@38
|
207 -- text="Tab 4",
|
John@38
|
208 -- value="tab4"
|
John@38
|
209 -- }
|
John@38
|
210 -- }
|
John@38
|
211 --)
|
John@38
|
212 --tab.width = "fill"
|
John@38
|
213 --tab.height = "fill"
|
John@38
|
214
|
John@38
|
215 --tab:SetCallback("OnGroupSelected",ChangeTab)
|
John@38
|
216 --tab:SelectTab("tab1")
|
John@42
|
217 --frame:AddChild(tab)
|
John@42
|
218 ChangeTab(frame,0,"tab1")
|
John@1
|
219
|
John@1
|
220 -- Create a button
|
John@1
|
221 --local btn = AceGUI:Create("Button")
|
John@1
|
222 --btn:SetWidth(170)
|
John@1
|
223 --btn:SetText("Button !")
|
John@43
|
224 --btn:SetCallback("OnClick", function() Print("Click!") end)
|
John@1
|
225 -- Add the button to the container
|
John@42
|
226 --frame:AddChild(btn)
|
John@1
|
227 end
|
John@1
|
228
|
John@1
|
229
|