Skip to content

Commit

Permalink
Merge pull request #56 from tg123/tww
Browse files Browse the repository at this point in the history
full TWW context menu support
  • Loading branch information
tg123 authored Jul 14, 2024
2 parents 56b5246 + ff43c35 commit c05df3a
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,40 @@ local function CreateSettingMenu(opt)
}
end

local function DrawMenu(root, menuData)
for _, m in ipairs(menuData) do
if m.isTitle then
root:CreateTitle(m.text)
else
local c = root:CreateCheckbox(m.text, m.checked, function ()

end, {
arg1 = m.arg1,
arg2 = m.arg2,
})
c:SetResponder(function(data, menuInputData, menu)
m.func({
arg1 = m.arg1,
arg2 = m.arg2,
})
-- Your handler here...
return MenuResponse.Refresh;
end)

if m.menuList then
DrawMenu(c, m.menuList)
end
end
end

end

local EasyMenu = _G.EasyMenu or function (settings)
MenuUtil.CreateContextMenu(UIParent, function(ownerRegion, rootDescription)
DrawMenu(rootDescription, settings)
end)
end

-- import
do

Expand Down Expand Up @@ -408,10 +442,6 @@ do
}
})

if not EasyMenu then
ba:Hide()
end

ba:SetScript("OnClick", function(self, button)
EasyMenu(settings, menuFrame, "cursor", 0 , 0, "MENU");
end)
Expand Down Expand Up @@ -457,10 +487,6 @@ do

tAppendAll(settings, CreateSettingMenu(actionOpt))

if not EasyMenu then
ba:Hide()
end

ba:SetScript("OnClick", function(self, button)
EasyMenu(settings, menuFrame, "cursor", 0 , 0, "MENU");
end)
Expand Down

0 comments on commit c05df3a

Please sign in to comment.