comparison Gui.lua @ 60:dcf7c835d0a7

Not leaking resources is better ...
author John@Yosemite-PC
date Sun, 25 Mar 2012 18:07:00 -0400
parents c7330bc4a9ea
children 00cb497201d0
comparison
equal deleted inserted replaced
59:c7330bc4a9ea 60:dcf7c835d0a7
65 local f 65 local f
66 local escapeButton = 66 local escapeButton =
67 { 67 {
68 shown = false, 68 shown = false,
69 ["IsShown"] = function(self) return self.shown end, 69 ["IsShown"] = function(self) return self.shown end,
70 ["Hide"] = function(self) if f then bsk.print("Release!");AceGUI:Release(f); self.shown=false end end 70 ["Hide"] = function(self) if f then AceGUI:Release(f); self.shown=false end end
71 } 71 }
72 72
73 function CreateGUI() 73 function CreateGUI()
74 -- special registration procedure to be closable with the escape button 74 -- special registration procedure to be closable with the escape button
75 --escapeButton.shown = true 75 --escapeButton.shown = true
76 --_G["BSK_ESCAPEBUTTON"] = escapeButton 76 --_G["BSK_ESCAPEBUTTON"] = escapeButton
77 --table.insert(_G.UISpecialFrames, "BSK_ESCAPEBUTTON") 77 --table.insert(_G.UISpecialFrames, "BSK_ESCAPEBUTTON")
78 78
79 local admin = bsk.admin 79 if f then return end -- no second gui please
80 local admin = bsk.admin or true
80 f = AceGUI:Create("Frame") 81 f = AceGUI:Create("Frame")
81 82
82 f:SetCallback("OnClose",function(widget) escapeButton.shown = false; AceGUI:Release(widget) end) 83 f:SetCallback("OnClose",function(widget) escapeButton.shown = false; AceGUI:Release(widget); f=nil end)
83 f:SetTitle("BSK") 84 f:SetTitle("BSK")
84 f:SetLayout("Flow") 85 f:SetLayout("Flow")
85 f:SetHeight(680) 86 f:SetHeight(680)
86 f:SetWidth(580) 87 f:SetWidth(580)
87
88 88
89 local left = AceGUI:Create("InlineGroup") 89 local left = AceGUI:Create("InlineGroup")
90 left:SetLayout("List") 90 left:SetLayout("List")
91 left:SetWidth(175) 91 left:SetWidth(175)
92 left:SetFullHeight(true) 92 left:SetFullHeight(true)
142 text = "|cffff8000|Hitem:19019:0:0:0:0:0:0:0:85:0|h[Thunderfury, Blessed Blade of the Windseeker]|h|r", 142 text = "|cffff8000|Hitem:19019:0:0:0:0:0:0:0:85:0|h[Thunderfury, Blessed Blade of the Windseeker]|h|r",
143 link = "|cffff8000|Hitem:19019:0:0:0:0:0:0:0:85:0|h[Thunderfury, Blessed Blade of the Windseeker]|h|r" 143 link = "|cffff8000|Hitem:19019:0:0:0:0:0:0:0:85:0|h[Thunderfury, Blessed Blade of the Windseeker]|h|r"
144 }, 144 },
145 }) 145 })
146 146
147 local alb1 = AceGUI:Create("Button") 147 local alb1, alb2, alb3
148 alb1:SetWidth(100) 148 if admin then
149 alb1:SetText("Open Bids") 149 alb1 = AceGUI:Create("Button")
150 local alb2 = AceGUI:Create("Button") 150 alb1:SetWidth(100)
151 alb2:SetWidth(100) 151 alb1:SetText("Open Bids")
152 alb2:SetText("Assign") 152
153 local alb3 = AceGUI:Create("Button") 153 alb2 = AceGUI:Create("Button")
154 alb3:SetWidth(100) 154 alb2:SetWidth(100)
155 alb3:SetText("Suicide") 155 alb2:SetText("Assign")
156
157 alb3 = AceGUI:Create("Button")
158 alb3:SetWidth(100)
159 alb3:SetText("Suicide")
160 end
156 161
157 local spacer = AceGUI:Create("Label") 162 local spacer = AceGUI:Create("Label")
158 spacer:SetText(" ") 163 spacer:SetText(" ")
159 spacer:SetFullWidth(true) 164 spacer:SetFullWidth(true)
160 local spacer2 = AceGUI:Create("Label") 165 local spacer2 = AceGUI:Create("Label")
189 bidRetractButton:SetWidth(100) 194 bidRetractButton:SetWidth(100)
190 local rollButton = AceGUI:Create("Button") 195 local rollButton = AceGUI:Create("Button")
191 rollButton:SetText("Offset Roll") 196 rollButton:SetText("Offset Roll")
192 rollButton:SetWidth(100) 197 rollButton:SetWidth(100)
193 198
194 b1.alignoffset = 0.25 -- or else g1 won't align well 199 local g1, suicideSelected, undo
195 local g1 = AceGUI:Create("SimpleGroup") 200 if admin then
196 g1.alignoffset = 0.25 201 b1.alignoffset = 0.25 -- or else g1 won't align well
197 g1:SetWidth(120) 202 g1 = AceGUI:Create("SimpleGroup")
198 g1:SetLayout("List") 203 g1.alignoffset = 0.25
199 local adminForce = AceGUI:Create("Button") 204 g1:SetWidth(120)
200 adminForce:SetText("Force bid") 205 g1:SetLayout("List")
201 adminForce:SetWidth(100) 206
202 local adminRetract = AceGUI:Create("Button") 207 adminForce = AceGUI:Create("Button")
203 adminRetract:SetText("Retract bid") 208 adminForce:SetText("Force bid")
204 adminRetract:SetWidth(100) 209 adminForce:SetWidth(100)
205 g1:AddChildren(adminForce,adminRetract) 210
206 211 adminRetract = AceGUI:Create("Button")
207 212 adminRetract:SetText("Retract bid")
208 213 adminRetract:SetWidth(100)
209 local suicideSelected = AceGUI:Create("Button") 214
210 suicideSelected:SetFullWidth(true) 215 g1:AddChildren(adminForce,adminRetract)
211 suicideSelected:SetText("Suicide") 216
212 local undo = AceGUI:Create("Button") 217 suicideSelected = AceGUI:Create("Button")
213 undo:SetText("Undo") 218 suicideSelected:SetFullWidth(true)
214 undo:SetFullWidth(true) 219 suicideSelected:SetText("Suicide")
220
221 undo = AceGUI:Create("Button")
222 undo:SetText("Undo")
223 undo:SetFullWidth(true)
224 end
225
226
215 local filter = AceGUI:Create("CheckBox") 227 local filter = AceGUI:Create("CheckBox")
216 filter:SetLabel("Only show active") 228 filter:SetLabel("Only show active")
217 filter:SetFullWidth(true) 229 filter:SetFullWidth(true)
218 230
219 left:AddChildren(filter) 231 left:AddChildren(filter)