yellowfive@57
|
1 --[[ $Id: AceGUIWidget-DropDown-Items.lua 996 2010-12-01 18:34:17Z nevcairiel $ ]]--
|
yellowfive@57
|
2
|
yellowfive@57
|
3 local AceGUI = LibStub("AceGUI-3.0")
|
yellowfive@57
|
4
|
yellowfive@57
|
5 -- Lua APIs
|
yellowfive@57
|
6 local select, assert = select, assert
|
yellowfive@57
|
7
|
yellowfive@57
|
8 -- WoW APIs
|
yellowfive@57
|
9 local PlaySound = PlaySound
|
yellowfive@57
|
10 local CreateFrame = CreateFrame
|
yellowfive@57
|
11
|
yellowfive@57
|
12 local function fixlevels(parent,...)
|
yellowfive@57
|
13 local i = 1
|
yellowfive@57
|
14 local child = select(i, ...)
|
yellowfive@57
|
15 while child do
|
yellowfive@57
|
16 child:SetFrameLevel(parent:GetFrameLevel()+1)
|
yellowfive@57
|
17 fixlevels(child, child:GetChildren())
|
yellowfive@57
|
18 i = i + 1
|
yellowfive@57
|
19 child = select(i, ...)
|
yellowfive@57
|
20 end
|
yellowfive@57
|
21 end
|
yellowfive@57
|
22
|
yellowfive@57
|
23 local function fixstrata(strata, parent, ...)
|
yellowfive@57
|
24 local i = 1
|
yellowfive@57
|
25 local child = select(i, ...)
|
yellowfive@57
|
26 parent:SetFrameStrata(strata)
|
yellowfive@57
|
27 while child do
|
yellowfive@57
|
28 fixstrata(strata, child, child:GetChildren())
|
yellowfive@57
|
29 i = i + 1
|
yellowfive@57
|
30 child = select(i, ...)
|
yellowfive@57
|
31 end
|
yellowfive@57
|
32 end
|
yellowfive@57
|
33
|
yellowfive@57
|
34 -- ItemBase is the base "class" for all dropdown items.
|
yellowfive@57
|
35 -- Each item has to use ItemBase.Create(widgetType) to
|
yellowfive@57
|
36 -- create an initial 'self' value.
|
yellowfive@57
|
37 -- ItemBase will add common functions and ui event handlers.
|
yellowfive@57
|
38 -- Be sure to keep basic usage when you override functions.
|
yellowfive@57
|
39
|
yellowfive@57
|
40 local ItemBase = {
|
yellowfive@57
|
41 -- NOTE: The ItemBase version is added to each item's version number
|
yellowfive@57
|
42 -- to ensure proper updates on ItemBase changes.
|
yellowfive@57
|
43 -- Use at least 1000er steps.
|
yellowfive@57
|
44 version = 1000,
|
yellowfive@57
|
45 counter = 0,
|
yellowfive@57
|
46 }
|
yellowfive@57
|
47
|
yellowfive@57
|
48 function ItemBase.Frame_OnEnter(this)
|
yellowfive@57
|
49 local self = this.obj
|
yellowfive@57
|
50
|
yellowfive@57
|
51 if self.useHighlight then
|
yellowfive@57
|
52 self.highlight:Show()
|
yellowfive@57
|
53 end
|
yellowfive@57
|
54 self:Fire("OnEnter")
|
yellowfive@57
|
55
|
yellowfive@57
|
56 if self.specialOnEnter then
|
yellowfive@57
|
57 self.specialOnEnter(self)
|
yellowfive@57
|
58 end
|
yellowfive@57
|
59 end
|
yellowfive@57
|
60
|
yellowfive@57
|
61 function ItemBase.Frame_OnLeave(this)
|
yellowfive@57
|
62 local self = this.obj
|
yellowfive@57
|
63
|
yellowfive@57
|
64 self.highlight:Hide()
|
yellowfive@57
|
65 self:Fire("OnLeave")
|
yellowfive@57
|
66
|
yellowfive@57
|
67 if self.specialOnLeave then
|
yellowfive@57
|
68 self.specialOnLeave(self)
|
yellowfive@57
|
69 end
|
yellowfive@57
|
70 end
|
yellowfive@57
|
71
|
yellowfive@57
|
72 -- exported, AceGUI callback
|
yellowfive@57
|
73 function ItemBase.OnAcquire(self)
|
yellowfive@57
|
74 self.frame:SetToplevel(true)
|
yellowfive@57
|
75 self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
yellowfive@57
|
76 end
|
yellowfive@57
|
77
|
yellowfive@57
|
78 -- exported, AceGUI callback
|
yellowfive@57
|
79 function ItemBase.OnRelease(self)
|
yellowfive@57
|
80 self:SetDisabled(false)
|
yellowfive@57
|
81 self.pullout = nil
|
yellowfive@57
|
82 self.frame:SetParent(nil)
|
yellowfive@57
|
83 self.frame:ClearAllPoints()
|
yellowfive@57
|
84 self.frame:Hide()
|
yellowfive@57
|
85 end
|
yellowfive@57
|
86
|
yellowfive@57
|
87 -- exported
|
yellowfive@57
|
88 -- NOTE: this is called by a Dropdown-Pullout.
|
yellowfive@57
|
89 -- Do not call this method directly
|
yellowfive@57
|
90 function ItemBase.SetPullout(self, pullout)
|
yellowfive@57
|
91 self.pullout = pullout
|
yellowfive@57
|
92
|
yellowfive@57
|
93 self.frame:SetParent(nil)
|
yellowfive@57
|
94 self.frame:SetParent(pullout.itemFrame)
|
yellowfive@57
|
95 self.parent = pullout.itemFrame
|
yellowfive@57
|
96 fixlevels(pullout.itemFrame, pullout.itemFrame:GetChildren())
|
yellowfive@57
|
97 end
|
yellowfive@57
|
98
|
yellowfive@57
|
99 -- exported
|
yellowfive@57
|
100 function ItemBase.SetText(self, text)
|
yellowfive@57
|
101 self.text:SetText(text or "")
|
yellowfive@57
|
102 end
|
yellowfive@57
|
103
|
yellowfive@57
|
104 -- exported
|
yellowfive@57
|
105 function ItemBase.GetText(self)
|
yellowfive@57
|
106 return self.text:GetText()
|
yellowfive@57
|
107 end
|
yellowfive@57
|
108
|
yellowfive@57
|
109 -- exported
|
yellowfive@57
|
110 function ItemBase.SetPoint(self, ...)
|
yellowfive@57
|
111 self.frame:SetPoint(...)
|
yellowfive@57
|
112 end
|
yellowfive@57
|
113
|
yellowfive@57
|
114 -- exported
|
yellowfive@57
|
115 function ItemBase.Show(self)
|
yellowfive@57
|
116 self.frame:Show()
|
yellowfive@57
|
117 end
|
yellowfive@57
|
118
|
yellowfive@57
|
119 -- exported
|
yellowfive@57
|
120 function ItemBase.Hide(self)
|
yellowfive@57
|
121 self.frame:Hide()
|
yellowfive@57
|
122 end
|
yellowfive@57
|
123
|
yellowfive@57
|
124 -- exported
|
yellowfive@57
|
125 function ItemBase.SetDisabled(self, disabled)
|
yellowfive@57
|
126 self.disabled = disabled
|
yellowfive@57
|
127 if disabled then
|
yellowfive@57
|
128 self.useHighlight = false
|
yellowfive@57
|
129 self.text:SetTextColor(.5, .5, .5)
|
yellowfive@57
|
130 else
|
yellowfive@57
|
131 self.useHighlight = true
|
yellowfive@57
|
132 self.text:SetTextColor(1, 1, 1)
|
yellowfive@57
|
133 end
|
yellowfive@57
|
134 end
|
yellowfive@57
|
135
|
yellowfive@57
|
136 -- exported
|
yellowfive@57
|
137 -- NOTE: this is called by a Dropdown-Pullout.
|
yellowfive@57
|
138 -- Do not call this method directly
|
yellowfive@57
|
139 function ItemBase.SetOnLeave(self, func)
|
yellowfive@57
|
140 self.specialOnLeave = func
|
yellowfive@57
|
141 end
|
yellowfive@57
|
142
|
yellowfive@57
|
143 -- exported
|
yellowfive@57
|
144 -- NOTE: this is called by a Dropdown-Pullout.
|
yellowfive@57
|
145 -- Do not call this method directly
|
yellowfive@57
|
146 function ItemBase.SetOnEnter(self, func)
|
yellowfive@57
|
147 self.specialOnEnter = func
|
yellowfive@57
|
148 end
|
yellowfive@57
|
149
|
yellowfive@57
|
150 function ItemBase.Create(type)
|
yellowfive@57
|
151 -- NOTE: Most of the following code is copied from AceGUI-3.0/Dropdown widget
|
yellowfive@57
|
152 local count = AceGUI:GetNextWidgetNum(type)
|
yellowfive@57
|
153 local frame = CreateFrame("Button", "AceGUI30DropDownItem"..count)
|
yellowfive@57
|
154 local self = {}
|
yellowfive@57
|
155 self.frame = frame
|
yellowfive@57
|
156 frame.obj = self
|
yellowfive@57
|
157 self.type = type
|
yellowfive@57
|
158
|
yellowfive@57
|
159 self.useHighlight = true
|
yellowfive@57
|
160
|
yellowfive@57
|
161 frame:SetHeight(17)
|
yellowfive@57
|
162 frame:SetFrameStrata("FULLSCREEN_DIALOG")
|
yellowfive@57
|
163
|
yellowfive@57
|
164 local text = frame:CreateFontString(nil,"OVERLAY","GameFontNormalSmall")
|
yellowfive@57
|
165 text:SetTextColor(1,1,1)
|
yellowfive@57
|
166 text:SetJustifyH("LEFT")
|
yellowfive@57
|
167 text:SetPoint("TOPLEFT",frame,"TOPLEFT",18,0)
|
yellowfive@57
|
168 text:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-8,0)
|
yellowfive@57
|
169 self.text = text
|
yellowfive@57
|
170
|
yellowfive@57
|
171 local highlight = frame:CreateTexture(nil, "OVERLAY")
|
yellowfive@57
|
172 highlight:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight")
|
yellowfive@57
|
173 highlight:SetBlendMode("ADD")
|
yellowfive@57
|
174 highlight:SetHeight(14)
|
yellowfive@57
|
175 highlight:ClearAllPoints()
|
yellowfive@57
|
176 highlight:SetPoint("RIGHT",frame,"RIGHT",-3,0)
|
yellowfive@57
|
177 highlight:SetPoint("LEFT",frame,"LEFT",5,0)
|
yellowfive@57
|
178 highlight:Hide()
|
yellowfive@57
|
179 self.highlight = highlight
|
yellowfive@57
|
180
|
yellowfive@57
|
181 local check = frame:CreateTexture("OVERLAY")
|
yellowfive@57
|
182 check:SetWidth(16)
|
yellowfive@57
|
183 check:SetHeight(16)
|
yellowfive@57
|
184 check:SetPoint("LEFT",frame,"LEFT",3,-1)
|
yellowfive@57
|
185 check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check")
|
yellowfive@57
|
186 check:Hide()
|
yellowfive@57
|
187 self.check = check
|
yellowfive@57
|
188
|
yellowfive@57
|
189 local sub = frame:CreateTexture("OVERLAY")
|
yellowfive@57
|
190 sub:SetWidth(16)
|
yellowfive@57
|
191 sub:SetHeight(16)
|
yellowfive@57
|
192 sub:SetPoint("RIGHT",frame,"RIGHT",-3,-1)
|
yellowfive@57
|
193 sub:SetTexture("Interface\\ChatFrame\\ChatFrameExpandArrow")
|
yellowfive@57
|
194 sub:Hide()
|
yellowfive@57
|
195 self.sub = sub
|
yellowfive@57
|
196
|
yellowfive@57
|
197 frame:SetScript("OnEnter", ItemBase.Frame_OnEnter)
|
yellowfive@57
|
198 frame:SetScript("OnLeave", ItemBase.Frame_OnLeave)
|
yellowfive@57
|
199
|
yellowfive@57
|
200 self.OnAcquire = ItemBase.OnAcquire
|
yellowfive@57
|
201 self.OnRelease = ItemBase.OnRelease
|
yellowfive@57
|
202
|
yellowfive@57
|
203 self.SetPullout = ItemBase.SetPullout
|
yellowfive@57
|
204 self.GetText = ItemBase.GetText
|
yellowfive@57
|
205 self.SetText = ItemBase.SetText
|
yellowfive@57
|
206 self.SetDisabled = ItemBase.SetDisabled
|
yellowfive@57
|
207
|
yellowfive@57
|
208 self.SetPoint = ItemBase.SetPoint
|
yellowfive@57
|
209 self.Show = ItemBase.Show
|
yellowfive@57
|
210 self.Hide = ItemBase.Hide
|
yellowfive@57
|
211
|
yellowfive@57
|
212 self.SetOnLeave = ItemBase.SetOnLeave
|
yellowfive@57
|
213 self.SetOnEnter = ItemBase.SetOnEnter
|
yellowfive@57
|
214
|
yellowfive@57
|
215 return self
|
yellowfive@57
|
216 end
|
yellowfive@57
|
217
|
yellowfive@57
|
218 -- Register a dummy LibStub library to retrieve the ItemBase, so other addons can use it.
|
yellowfive@57
|
219 local IBLib = LibStub:NewLibrary("AceGUI-3.0-DropDown-ItemBase", ItemBase.version)
|
yellowfive@57
|
220 if IBLib then
|
yellowfive@57
|
221 IBLib.GetItemBase = function() return ItemBase end
|
yellowfive@57
|
222 end
|
yellowfive@57
|
223
|
yellowfive@57
|
224 --[[
|
yellowfive@57
|
225 Template for items:
|
yellowfive@57
|
226
|
yellowfive@57
|
227 -- Item:
|
yellowfive@57
|
228 --
|
yellowfive@57
|
229 do
|
yellowfive@57
|
230 local widgetType = "Dropdown-Item-"
|
yellowfive@57
|
231 local widgetVersion = 1
|
yellowfive@57
|
232
|
yellowfive@57
|
233 local function Constructor()
|
yellowfive@57
|
234 local self = ItemBase.Create(widgetType)
|
yellowfive@57
|
235
|
yellowfive@57
|
236 AceGUI:RegisterAsWidget(self)
|
yellowfive@57
|
237 return self
|
yellowfive@57
|
238 end
|
yellowfive@57
|
239
|
yellowfive@57
|
240 AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
|
yellowfive@57
|
241 end
|
yellowfive@57
|
242 --]]
|
yellowfive@57
|
243
|
yellowfive@57
|
244 -- Item: Header
|
yellowfive@57
|
245 -- A single text entry.
|
yellowfive@57
|
246 -- Special: Different text color and no highlight
|
yellowfive@57
|
247 do
|
yellowfive@57
|
248 local widgetType = "Dropdown-Item-Header"
|
yellowfive@57
|
249 local widgetVersion = 1
|
yellowfive@57
|
250
|
yellowfive@57
|
251 local function OnEnter(this)
|
yellowfive@57
|
252 local self = this.obj
|
yellowfive@57
|
253 self:Fire("OnEnter")
|
yellowfive@57
|
254
|
yellowfive@57
|
255 if self.specialOnEnter then
|
yellowfive@57
|
256 self.specialOnEnter(self)
|
yellowfive@57
|
257 end
|
yellowfive@57
|
258 end
|
yellowfive@57
|
259
|
yellowfive@57
|
260 local function OnLeave(this)
|
yellowfive@57
|
261 local self = this.obj
|
yellowfive@57
|
262 self:Fire("OnLeave")
|
yellowfive@57
|
263
|
yellowfive@57
|
264 if self.specialOnLeave then
|
yellowfive@57
|
265 self.specialOnLeave(self)
|
yellowfive@57
|
266 end
|
yellowfive@57
|
267 end
|
yellowfive@57
|
268
|
yellowfive@57
|
269 -- exported, override
|
yellowfive@57
|
270 local function SetDisabled(self, disabled)
|
yellowfive@57
|
271 ItemBase.SetDisabled(self, disabled)
|
yellowfive@57
|
272 if not disabled then
|
yellowfive@57
|
273 self.text:SetTextColor(1, 1, 0)
|
yellowfive@57
|
274 end
|
yellowfive@57
|
275 end
|
yellowfive@57
|
276
|
yellowfive@57
|
277 local function Constructor()
|
yellowfive@57
|
278 local self = ItemBase.Create(widgetType)
|
yellowfive@57
|
279
|
yellowfive@57
|
280 self.SetDisabled = SetDisabled
|
yellowfive@57
|
281
|
yellowfive@57
|
282 self.frame:SetScript("OnEnter", OnEnter)
|
yellowfive@57
|
283 self.frame:SetScript("OnLeave", OnLeave)
|
yellowfive@57
|
284
|
yellowfive@57
|
285 self.text:SetTextColor(1, 1, 0)
|
yellowfive@57
|
286
|
yellowfive@57
|
287 AceGUI:RegisterAsWidget(self)
|
yellowfive@57
|
288 return self
|
yellowfive@57
|
289 end
|
yellowfive@57
|
290
|
yellowfive@57
|
291 AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
|
yellowfive@57
|
292 end
|
yellowfive@57
|
293
|
yellowfive@57
|
294 -- Item: Execute
|
yellowfive@57
|
295 -- A simple button
|
yellowfive@57
|
296 do
|
yellowfive@57
|
297 local widgetType = "Dropdown-Item-Execute"
|
yellowfive@57
|
298 local widgetVersion = 1
|
yellowfive@57
|
299
|
yellowfive@57
|
300 local function Frame_OnClick(this, button)
|
yellowfive@57
|
301 local self = this.obj
|
yellowfive@57
|
302 if self.disabled then return end
|
yellowfive@57
|
303 self:Fire("OnClick")
|
yellowfive@57
|
304 if self.pullout then
|
yellowfive@57
|
305 self.pullout:Close()
|
yellowfive@57
|
306 end
|
yellowfive@57
|
307 end
|
yellowfive@57
|
308
|
yellowfive@57
|
309 local function Constructor()
|
yellowfive@57
|
310 local self = ItemBase.Create(widgetType)
|
yellowfive@57
|
311
|
yellowfive@57
|
312 self.frame:SetScript("OnClick", Frame_OnClick)
|
yellowfive@57
|
313
|
yellowfive@57
|
314 AceGUI:RegisterAsWidget(self)
|
yellowfive@57
|
315 return self
|
yellowfive@57
|
316 end
|
yellowfive@57
|
317
|
yellowfive@57
|
318 AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
|
yellowfive@57
|
319 end
|
yellowfive@57
|
320
|
yellowfive@57
|
321 -- Item: Toggle
|
yellowfive@57
|
322 -- Some sort of checkbox for dropdown menus.
|
yellowfive@57
|
323 -- Does not close the pullout on click.
|
yellowfive@57
|
324 do
|
yellowfive@57
|
325 local widgetType = "Dropdown-Item-Toggle"
|
yellowfive@57
|
326 local widgetVersion = 3
|
yellowfive@57
|
327
|
yellowfive@57
|
328 local function UpdateToggle(self)
|
yellowfive@57
|
329 if self.value then
|
yellowfive@57
|
330 self.check:Show()
|
yellowfive@57
|
331 else
|
yellowfive@57
|
332 self.check:Hide()
|
yellowfive@57
|
333 end
|
yellowfive@57
|
334 end
|
yellowfive@57
|
335
|
yellowfive@57
|
336 local function OnRelease(self)
|
yellowfive@57
|
337 ItemBase.OnRelease(self)
|
yellowfive@57
|
338 self:SetValue(nil)
|
yellowfive@57
|
339 end
|
yellowfive@57
|
340
|
yellowfive@57
|
341 local function Frame_OnClick(this, button)
|
yellowfive@57
|
342 local self = this.obj
|
yellowfive@57
|
343 if self.disabled then return end
|
yellowfive@57
|
344 self.value = not self.value
|
yellowfive@57
|
345 if self.value then
|
yellowfive@57
|
346 PlaySound("igMainMenuOptionCheckBoxOn")
|
yellowfive@57
|
347 else
|
yellowfive@57
|
348 PlaySound("igMainMenuOptionCheckBoxOff")
|
yellowfive@57
|
349 end
|
yellowfive@57
|
350 UpdateToggle(self)
|
yellowfive@57
|
351 self:Fire("OnValueChanged", self.value)
|
yellowfive@57
|
352 end
|
yellowfive@57
|
353
|
yellowfive@57
|
354 -- exported
|
yellowfive@57
|
355 local function SetValue(self, value)
|
yellowfive@57
|
356 self.value = value
|
yellowfive@57
|
357 UpdateToggle(self)
|
yellowfive@57
|
358 end
|
yellowfive@57
|
359
|
yellowfive@57
|
360 -- exported
|
yellowfive@57
|
361 local function GetValue(self)
|
yellowfive@57
|
362 return self.value
|
yellowfive@57
|
363 end
|
yellowfive@57
|
364
|
yellowfive@57
|
365 local function Constructor()
|
yellowfive@57
|
366 local self = ItemBase.Create(widgetType)
|
yellowfive@57
|
367
|
yellowfive@57
|
368 self.frame:SetScript("OnClick", Frame_OnClick)
|
yellowfive@57
|
369
|
yellowfive@57
|
370 self.SetValue = SetValue
|
yellowfive@57
|
371 self.GetValue = GetValue
|
yellowfive@57
|
372 self.OnRelease = OnRelease
|
yellowfive@57
|
373
|
yellowfive@57
|
374 AceGUI:RegisterAsWidget(self)
|
yellowfive@57
|
375 return self
|
yellowfive@57
|
376 end
|
yellowfive@57
|
377
|
yellowfive@57
|
378 AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
|
yellowfive@57
|
379 end
|
yellowfive@57
|
380
|
yellowfive@57
|
381 -- Item: Menu
|
yellowfive@57
|
382 -- Shows a submenu on mouse over
|
yellowfive@57
|
383 -- Does not close the pullout on click
|
yellowfive@57
|
384 do
|
yellowfive@57
|
385 local widgetType = "Dropdown-Item-Menu"
|
yellowfive@57
|
386 local widgetVersion = 2
|
yellowfive@57
|
387
|
yellowfive@57
|
388 local function OnEnter(this)
|
yellowfive@57
|
389 local self = this.obj
|
yellowfive@57
|
390 self:Fire("OnEnter")
|
yellowfive@57
|
391
|
yellowfive@57
|
392 if self.specialOnEnter then
|
yellowfive@57
|
393 self.specialOnEnter(self)
|
yellowfive@57
|
394 end
|
yellowfive@57
|
395
|
yellowfive@57
|
396 self.highlight:Show()
|
yellowfive@57
|
397
|
yellowfive@57
|
398 if not self.disabled and self.submenu then
|
yellowfive@57
|
399 self.submenu:Open("TOPLEFT", self.frame, "TOPRIGHT", self.pullout:GetRightBorderWidth(), 0, self.frame:GetFrameLevel() + 100)
|
yellowfive@57
|
400 end
|
yellowfive@57
|
401 end
|
yellowfive@57
|
402
|
yellowfive@57
|
403 local function OnHide(this)
|
yellowfive@57
|
404 local self = this.obj
|
yellowfive@57
|
405 if self.submenu then
|
yellowfive@57
|
406 self.submenu:Close()
|
yellowfive@57
|
407 end
|
yellowfive@57
|
408 end
|
yellowfive@57
|
409
|
yellowfive@57
|
410 -- exported
|
yellowfive@57
|
411 local function SetMenu(self, menu)
|
yellowfive@57
|
412 assert(menu.type == "Dropdown-Pullout")
|
yellowfive@57
|
413 self.submenu = menu
|
yellowfive@57
|
414 end
|
yellowfive@57
|
415
|
yellowfive@57
|
416 -- exported
|
yellowfive@57
|
417 local function CloseMenu(self)
|
yellowfive@57
|
418 self.submenu:Close()
|
yellowfive@57
|
419 end
|
yellowfive@57
|
420
|
yellowfive@57
|
421 local function Constructor()
|
yellowfive@57
|
422 local self = ItemBase.Create(widgetType)
|
yellowfive@57
|
423
|
yellowfive@57
|
424 self.sub:Show()
|
yellowfive@57
|
425
|
yellowfive@57
|
426 self.frame:SetScript("OnEnter", OnEnter)
|
yellowfive@57
|
427 self.frame:SetScript("OnHide", OnHide)
|
yellowfive@57
|
428
|
yellowfive@57
|
429 self.SetMenu = SetMenu
|
yellowfive@57
|
430 self.CloseMenu = CloseMenu
|
yellowfive@57
|
431
|
yellowfive@57
|
432 AceGUI:RegisterAsWidget(self)
|
yellowfive@57
|
433 return self
|
yellowfive@57
|
434 end
|
yellowfive@57
|
435
|
yellowfive@57
|
436 AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
|
yellowfive@57
|
437 end
|
yellowfive@57
|
438
|
yellowfive@57
|
439 -- Item: Separator
|
yellowfive@57
|
440 -- A single line to separate items
|
yellowfive@57
|
441 do
|
yellowfive@57
|
442 local widgetType = "Dropdown-Item-Separator"
|
yellowfive@57
|
443 local widgetVersion = 1
|
yellowfive@57
|
444
|
yellowfive@57
|
445 -- exported, override
|
yellowfive@57
|
446 local function SetDisabled(self, disabled)
|
yellowfive@57
|
447 ItemBase.SetDisabled(self, disabled)
|
yellowfive@57
|
448 self.useHighlight = false
|
yellowfive@57
|
449 end
|
yellowfive@57
|
450
|
yellowfive@57
|
451 local function Constructor()
|
yellowfive@57
|
452 local self = ItemBase.Create(widgetType)
|
yellowfive@57
|
453
|
yellowfive@57
|
454 self.SetDisabled = SetDisabled
|
yellowfive@57
|
455
|
yellowfive@57
|
456 local line = self.frame:CreateTexture(nil, "OVERLAY")
|
yellowfive@57
|
457 line:SetHeight(1)
|
yellowfive@57
|
458 line:SetTexture(.5, .5, .5)
|
yellowfive@57
|
459 line:SetPoint("LEFT", self.frame, "LEFT", 10, 0)
|
yellowfive@57
|
460 line:SetPoint("RIGHT", self.frame, "RIGHT", -10, 0)
|
yellowfive@57
|
461
|
yellowfive@57
|
462 self.text:Hide()
|
yellowfive@57
|
463
|
yellowfive@57
|
464 self.useHighlight = false
|
yellowfive@57
|
465
|
yellowfive@57
|
466 AceGUI:RegisterAsWidget(self)
|
yellowfive@57
|
467 return self
|
yellowfive@57
|
468 end
|
yellowfive@57
|
469
|
yellowfive@57
|
470 AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion + ItemBase.version)
|
yellowfive@57
|
471 end
|