Skip to content

Commit c05df3a

Browse files
authored
Merge pull request #56 from tg123/tww
full TWW context menu support
2 parents 56b5246 + ff43c35 commit c05df3a

File tree

1 file changed

+34
-8
lines changed

1 file changed

+34
-8
lines changed

gui.lua

+34-8
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,40 @@ local function CreateSettingMenu(opt)
318318
}
319319
end
320320

321+
local function DrawMenu(root, menuData)
322+
for _, m in ipairs(menuData) do
323+
if m.isTitle then
324+
root:CreateTitle(m.text)
325+
else
326+
local c = root:CreateCheckbox(m.text, m.checked, function ()
327+
328+
end, {
329+
arg1 = m.arg1,
330+
arg2 = m.arg2,
331+
})
332+
c:SetResponder(function(data, menuInputData, menu)
333+
m.func({
334+
arg1 = m.arg1,
335+
arg2 = m.arg2,
336+
})
337+
-- Your handler here...
338+
return MenuResponse.Refresh;
339+
end)
340+
341+
if m.menuList then
342+
DrawMenu(c, m.menuList)
343+
end
344+
end
345+
end
346+
347+
end
348+
349+
local EasyMenu = _G.EasyMenu or function (settings)
350+
MenuUtil.CreateContextMenu(UIParent, function(ownerRegion, rootDescription)
351+
DrawMenu(rootDescription, settings)
352+
end)
353+
end
354+
321355
-- import
322356
do
323357

@@ -408,10 +442,6 @@ do
408442
}
409443
})
410444

411-
if not EasyMenu then
412-
ba:Hide()
413-
end
414-
415445
ba:SetScript("OnClick", function(self, button)
416446
EasyMenu(settings, menuFrame, "cursor", 0 , 0, "MENU");
417447
end)
@@ -457,10 +487,6 @@ do
457487

458488
tAppendAll(settings, CreateSettingMenu(actionOpt))
459489

460-
if not EasyMenu then
461-
ba:Hide()
462-
end
463-
464490
ba:SetScript("OnClick", function(self, button)
465491
EasyMenu(settings, menuFrame, "cursor", 0 , 0, "MENU");
466492
end)

0 commit comments

Comments
 (0)