This is a converted version of Blizzards UIDropDownMenu from WoW Retail into a library accessable by LibStub. I update it from time to time to current retail version.
XML Errors in Retail
Since Blizzards new xml error handling it is a problem to use xml templates in libraries. I've converted the templates into lua functions.
Since version r24 this library has a little extra i've missed in original. I like to use easymenu but the original has no option to add a separator by menuList table.
local menuList = {
{ text="Some text", isTitle = true },
{ separator = true }, -- new in r24
{ text="More text", func=function() end}
}
@Blizzard feel free to add it to the original 🤓
UIDropDownMenuButtonTemplate into <lib>.Create_DropDownMenuButton(<name>[,<parent>[,<optsTable>]]>
UIDropDownListTemplate into <lib>.Create_DropDownMenuList(<name>[,<parent>[,<optsTable>]]>
UIDropDownMenuTemplate into <lib>.Create_DropDownMenu(<name>[,<parent>[,<optsTable>]]>
Currently the optsTable can contain only one usable entry. { id= }
local lib = LibStub("LibDropDownMenu");
local menuFrame = lib.Create_DropDownMenu("MyAddOn_DropDownMenu",UIParent); -- instead of template UIDropDownMenuTemplate
local menuList = {
{ text="TestTitle", isTitle=true },
{ text="TestFunction", isNotRadio=true, notCheckable=false }
};
lib.EasyMenu(menuList,menuFrame,"cursor",0,0,"MENU");
externals:
libs/LibDropDownMenu:
url: https://github.com/HizurosWoWAddOns/LibDropDownMenu
tag: latest
World of Warcraft© and Blizzard Entertainment© are all trademarks or registered trademarks of Blizzard Entertainment in the United States and/or other countries. These terms and all related materials, logos, and images are copyright © Blizzard Entertainment.