diff --git a/Annotations/Interface/Blizzard_Menu/Menu.lua b/Annotations/Interface/Blizzard_Menu/Menu.lua new file mode 100644 index 00000000..fb7a3d8a --- /dev/null +++ b/Annotations/Interface/Blizzard_Menu/Menu.lua @@ -0,0 +1,37 @@ +---@meta _ + +Menu = {} + +---[FrameXML](https://www.townlong-yak.com/framexml/go/Menu.GetManager) +---@return MenuManagerProxy +function Menu.GetManager() end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/Menu.CreateRootMenuDescription) +---@generic M: table +---@param menuMixin M +---@return RootMenuDescriptionProxy|M rootMenuDescription +function Menu.CreateRootMenuDescription(menuMixin) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/Menu.CreateMenuElementDescription) +---@return ElementMenuDescriptionProxy +function Menu.CreateMenuElementDescription() end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/Menu.PopulateDescription) +---@param menuGenerator fun(ownerRegion: Region, description: RootMenuDescriptionProxy, ...) +---@param ownerRegion Region +---@param description RootMenuDescriptionProxy +---@param ... any? # passed to the generator +function Menu.PopulateDescription(menuGenerator, ownerRegion, description, ...) end + +---Can be used by addons to modify blizzard's menus in a taint-safe manner +---[FrameXML](https://www.townlong-yak.com/framexml/go/Menu.ModifyMenu) +---@param tag string +---@param callback fun(ownerRegion: Region, description: RootMenuDescriptionProxy, contextData: any?) +function Menu.ModifyMenu(tag, callback) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/Menu.GetOpenMenuTags) +---@return string[] tags +function Menu.GetOpenMenuTags() end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/Menu.PrintOpenMenuTags) +function Menu.PrintOpenMenuTags() end diff --git a/Annotations/Interface/Blizzard_Menu/MenuTypes.lua b/Annotations/Interface/Blizzard_Menu/MenuTypes.lua new file mode 100644 index 00000000..b2ae2132 --- /dev/null +++ b/Annotations/Interface/Blizzard_Menu/MenuTypes.lua @@ -0,0 +1,24 @@ +---@meta _ + +---@alias MenuResponder fun(data: any, menuInputData: MenuInputData, menu: MenuProxy): MenuResponse # data = element:GetData() + +---@alias MenuDescriptionInitializer fun(frame: Frame, elementDescription: ElementMenuDescriptionProxy, menu: MenuProxy) + +---@class MenuInputData +---@field context MenuInputContext +---@field buttonName mouseButton? + +---@alias MenuResponse +---| 1 # `MenuResponse.Open` - Menu remains open and unchanged +---| 2 # `MenuResponse.Refresh` - All frames in the menu are reinitialized +---| 3 # `MenuResponse.Close` - Parent menus remain open but this menu closes +---| 4 # `MenuResponse.CloseAll` - All menus close + +---@alias MenuInputContext +---| 1 # `MenuInputContext.None` +---| 2 # `MenuInputContext.MouseButton` +---| 3 # `MenuInputContext.MouseWheel` + +---@alias MenuGridDirection +---| 2 # `MenuConstants.VerticalGridDirection` +---| 3 # `MenuConstants.HorizontalGridDirection` diff --git a/Annotations/Interface/Blizzard_Menu/MenuUtil.lua b/Annotations/Interface/Blizzard_Menu/MenuUtil.lua new file mode 100644 index 00000000..7253c185 --- /dev/null +++ b/Annotations/Interface/Blizzard_Menu/MenuUtil.lua @@ -0,0 +1,172 @@ +---@meta _ + +MenuUtil = {} + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.TraverseMenu) +---@param elementDescription RootMenuDescriptionProxy|ElementMenuDescriptionProxy +---@param op fun(elementDescription: ElementMenuDescriptionProxy): boolean? # return true to stop traversal +---@param condition nil|fun(elementDescription: ElementMenuDescriptionProxy): boolean # return true to apply `op` to the element description; if nil, all elements are processed +---@return boolean stopped # true if the traversal was stopped by `op` returning true +function MenuUtil.TraverseMenu(elementDescription, op, condition) end + +---Return a list of all selected elements, optionally filtered by a condition +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.GetSelections) +---@param elementDescription RootMenuDescriptionProxy|ElementMenuDescriptionProxy +---@param condition nil|fun(elementDescription: ElementMenuDescriptionProxy): boolean # return true to include the element description +function MenuUtil.GetSelections(elementDescription, condition) end + +---Sets up a tooltip anchored to the right of the owner, applying the given function to it, and showing it +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.ShowTooltip) +---@param owner Region +---@param func fun(tooltip: GameTooltip, ...) +---@param ... any? +function MenuUtil.ShowTooltip(owner, func, ...) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.HideTooltip) +---@param owner Region +function MenuUtil.HideTooltip(owner) end + +---Hooks OnEnter and OnLeave for a reagion, configures a tooltip, calls the given function, and shows the tooltip +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.HookTooltipScripts) +---@param owner Region +---@param func fun(tooltip: GameTooltip) # called both in OnEnter and OnLeave +function MenuUtil.HookTooltipScripts(owner, func) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.CreateRootMenuDescription) +---@generic M: table +---@param menuMixin M +---@return RootMenuDescriptionProxy|M rootMenuDescription +function MenuUtil.CreateRootMenuDescription(menuMixin) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.CreateContextMenu) +---@param ownerRegion Region? # if nil, defaults to UIParent +---@param generator fun(ownerRegion: Region, description: RootMenuDescriptionProxy, ...) +---@param ... any? # passed to the generator +---@return MenuProxy? menu +function MenuUtil.CreateContextMenu(ownerRegion, generator, ...) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.SetElementText) +---@param elementDescription ElementMenuDescriptionProxy +---@param text string +function MenuUtil.SetElementText(elementDescription, text) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.GetElementText) +---@param elementDescription ElementMenuDescriptionProxy +---@return string text +function MenuUtil.GetElementText(elementDescription) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.CreateFrame) +---@return ElementMenuDescriptionProxy +function MenuUtil.CreateFrame() end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.CreateTemplate) +---@param template Template +---@return ElementMenuDescriptionProxy +function MenuUtil.CreateTemplate(template) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.CreateTitle) +---@param text string +---@param color ColorMixin? # defaults to NORMAL_FONT_COLOR +---@return ElementMenuDescriptionProxy +function MenuUtil.CreateTitle(text, color) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.CreateButton) +---@param text string +---@param callback MenuResponder +---@param data any? # stored as element's data +---@return ElementMenuDescriptionProxy +function MenuUtil.CreateButton(text, callback, data) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.CreateCheckbox) +---@param text string +---@param isSelected fun(data: any): boolean # data = data param -> element:GetData() +---@param setSelected MenuResponder +---@param data any? # stored as element's data +---@return ElementMenuDescriptionProxy +function MenuUtil.CreateCheckbox(text, isSelected, setSelected, data) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.CreateRadio) +---@param text string +---@param isSelected fun(data: any): boolean # data = data param -> element:GetData() +---@param setSelected MenuResponder +---@param data any? # stored as element's data +---@return ElementMenuDescriptionProxy +function MenuUtil.CreateRadio(text, isSelected, setSelected, data) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.CreateColorSwatch) +---@param text string +---@param callback MenuResponder +---@param colorInfo ColorMixin # stored as element's data +---@return ElementMenuDescriptionProxy +function MenuUtil.CreateColorSwatch(text, callback, colorInfo) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuTemplates.CreateDivider) +---@return ElementMenuDescriptionProxy # some inserters and utility functions are missing +function MenuUtil.CreateDivider() end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuTemplates.CreateSpacer) +---@param extend number? # height of the spacer, default = 10 +---@return ElementMenuDescriptionProxy # some inserters and utility functions are missing +function MenuUtil.CreateSpacer(extend) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.CreateButtonMenu) +---@param dropdown DropdownButton +---@param ... {[1]:string, [2]: MenuResponder, [3]: any?} # list of {text, callback, data} +function MenuUtil.CreateButtonMenu(dropdown, ...) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.CreateButtonContextMenu) +---@param ownerRegion Region? # if nil, defaults to UIParent +---@param ... {[1]:string, [2]: MenuResponder, [3]: any?} # list of {text, callback, data} +---@return MenuProxy? menu +function MenuUtil.CreateButtonContextMenu(ownerRegion, ...) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.CreateCheckboxMenu) +---@param dropdown DropdownButton +---@param isSelected fun(data: any): boolean # shared between all menu items +---@param setSelected MenuResponder # shared between all menu items +---@param ... {[1]:string, [2]: any?} # list of {text, data} +function MenuUtil.CreateCheckboxMenu(dropdown, isSelected, setSelected, ...) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.CreateCheckboxContextMenu) +---@param ownerRegion Region? # if nil, defaults to UIParent +---@param isSelected fun(data: any): boolean # shared between all menu items +---@param setSelected MenuResponder # shared between all menu items +---@param ... {[1]:string, [2]: any?} # list of {text, data} +---@return MenuProxy? menu +function MenuUtil.CreateCheckboxContextMenu(ownerRegion, isSelected, setSelected, ...) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.CreateRadioMenu) +---@param dropdown DropdownButton +---@param isSelected fun(data: any): boolean # shared between all menu items +---@param setSelected MenuResponder # shared between all menu items +---@param ... {[1]:string, [2]: any?} # list of {text, data} +function MenuUtil.CreateRadioMenu(dropdown, isSelected, setSelected, ...) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.CreateRadioContextMenu) +---@param ownerRegion Region? # if nil, defaults to UIParent +---@param isSelected fun(data: any): boolean # shared between all menu items +---@param setSelected MenuResponder # shared between all menu items +---@param ... {[1]:string, [2]: any?} # list of {text, data} +---@return MenuProxy? menu +function MenuUtil.CreateRadioContextMenu(ownerRegion, isSelected, setSelected, ...) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.CreateEnumRadioMenu) +---@generic V +---@param dropdown DropdownButton +---@param enum table # a list of values; the value is saved as the element's data +---@param enumTranslator fun(enumValue: V): string # translate the enum value into the text to display +---@param isSelected fun(data: any): boolean # data = enum value +---@param setSelected MenuResponder +---@param orderTbl table? # optional table to specify the order of the menu buttons, defaults to ordering by enum value +function MenuUtil.CreateEnumRadioMenu(dropdown, enum, enumTranslator, isSelected, setSelected, orderTbl) end + +---[FrameXML](https://www.townlong-yak.com/framexml/go/MenuUtil.CreateEnumRadioContextMenu) +---@generic V +---@param dropdown Region? # if nil, defaults to UIParent +---@param enum table # a list of values; the value is saved as the element's data +---@param enumTranslator fun(enumValue: V): string # translate the enum value into the text to display +---@param isSelected fun(data: any): boolean # data = enum value +---@param setSelected MenuResponder +---@param orderTbl table? # optional table to specify the order of the menu buttons, defaults to ordering by enum value +---@return MenuProxy? menu +function MenuUtil.CreateEnumRadioContextMenu(dropdown, enum, enumTranslator, isSelected, setSelected, orderTbl) end diff --git a/Annotations/Interface/Blizzard_Menu/Proxies/ElementMenuDescriptionProxy.lua b/Annotations/Interface/Blizzard_Menu/Proxies/ElementMenuDescriptionProxy.lua new file mode 100644 index 00000000..44225a85 --- /dev/null +++ b/Annotations/Interface/Blizzard_Menu/Proxies/ElementMenuDescriptionProxy.lua @@ -0,0 +1,118 @@ +---@meta _ + +---@class ElementMenuDescriptionProxy: SharedMenuDescriptionProxy +local ElementMenuDescriptionProxy = {} + +function ElementMenuDescriptionProxy:SetSelectionIgnored() end + +---@return boolean +function ElementMenuDescriptionProxy:IsSelectionIgnored() end + +---@param data any +function ElementMenuDescriptionProxy:SetData(data) end + +---@return any data # from SetData or element creation +function ElementMenuDescriptionProxy:GetData() end + +---simulates selecting/clicking a dropdown option +---@param menuInputContext MenuInputContext +---@param menuInputButtonName mouseButton? +function ElementMenuDescriptionProxy:Pick(menuInputContext, menuInputButtonName) end + +---@param isEnabled boolean|fun(elementDescription: ElementMenuDescriptionProxy): boolean +function ElementMenuDescriptionProxy:SetEnabled(isEnabled) end + +---@return boolean +function ElementMenuDescriptionProxy:IsEnabled() end + +---@return boolean # true if a function was passed to SetEnabled() +function ElementMenuDescriptionProxy:ShouldPollEnabled() end + +---@param onLeave fun(frame: Frame, elementDescription: ElementMenuDescriptionProxy) +function ElementMenuDescriptionProxy:SetOnLeave(onLeave) end + +---hooks OnLeave if it exists, else calls SetOnLeave +---@param onLeave fun(frame: Frame, elementDescription: ElementMenuDescriptionProxy) +function ElementMenuDescriptionProxy:HookOnLeave(onLeave) end + +---@return nil|fun(frame: Frame, elementDescription: ElementMenuDescriptionProxy) onLeave +function ElementMenuDescriptionProxy:GetOnLeave() end + +---@param frame Frame # frame:OnLeave(elementDescription) is called if it exists, otherwise the onLeave callback is called +function ElementMenuDescriptionProxy:HandleOnLeave(frame) end + +---@param onEnter fun(frame: Frame, elementDescription: ElementMenuDescriptionProxy) +function ElementMenuDescriptionProxy:SetOnEnter(onEnter) end + +---hooks OnEnter if it exists, else calls SetOnEnter +---@param onEnter fun(frame: Frame, elementDescription: ElementMenuDescriptionProxy) +function ElementMenuDescriptionProxy:HookOnEnter(onEnter) end + +---@return nil|fun(frame: Frame, elementDescription: ElementMenuDescriptionProxy) onEnter +function ElementMenuDescriptionProxy:GetOnEnter() end + +---@param frame Frame # frame:OnEnter(elementDescription) is called if it exists, otherwise the onEnter callback is called +function ElementMenuDescriptionProxy:HandleOnEnter(frame) end + +---@param canSelect boolean +function ElementMenuDescriptionProxy:SetCanSelect(canSelect) end + +---@return boolean +function ElementMenuDescriptionProxy:CanSelect() end + +---@param isSelected fun(data: any): boolean # data = element:GetData() +function ElementMenuDescriptionProxy:SetIsSelected(isSelected) end + +---@return boolean isSelected # calls the isSelected callback with the element's data; if no callback is set, returns false +function ElementMenuDescriptionProxy:IsSelected() end + +---@param isRadio boolean +function ElementMenuDescriptionProxy:SetRadio(isRadio) end + +---@return boolean +function ElementMenuDescriptionProxy:IsRadio() end + +---@param defaultResponse MenuResponse|fun(menuInputContext: MenuInputContext, menuInputButtonName: mouseButton): MenuResponse +function ElementMenuDescriptionProxy:SetResponse(defaultResponse) end + +---@param menuInputContext MenuInputContext +---@param menuInputButtonName mouseButton +---@return MenuResponse +function ElementMenuDescriptionProxy:GetDefaultResponse(menuInputContext, menuInputButtonName) end + +---@param responder MenuResponder +function ElementMenuDescriptionProxy:SetResponder(responder) end + +---hooks responder if it exists, else calls SetResponder +---@param responder MenuResponder +function ElementMenuDescriptionProxy:HookResponder(responder) end + +function ElementMenuDescriptionProxy:SetElementFactory(callback) end + +---@param soundKit number|fun(elementDescription: ElementMenuDescriptionProxy): number +function ElementMenuDescriptionProxy:SetSoundKit(soundKit) end + +---@return number soundKit +function ElementMenuDescriptionProxy:GetSoundKit() end + +---@param canPlay boolean +function ElementMenuDescriptionProxy:SetShouldPlaySoundOnSubmenuClick(canPlay) end + +---@return boolean +function ElementMenuDescriptionProxy:ShouldPlaySoundOnSubmenuClick() end + +function ElementMenuDescriptionProxy:DeactivateSubmenu() end + +---@param canRespond boolean +function ElementMenuDescriptionProxy:SetShouldRespondIfSubmenu(canRespond) end + +---@return boolean +function ElementMenuDescriptionProxy:ShouldRespondIfSubmenu() end + +---@return boolean canOpenSubmenu # true if there are subItems and opening submenus isn't blocked +function ElementMenuDescriptionProxy:CanOpenSubmenu() end + +function ElementMenuDescriptionProxy:ForceOpenSubmenu() end + +---@param callback fun(frame: Frame, descriptionProxy: ElementMenuDescriptionProxy, menuFrame: Frame, finalColumns: number, finalRows: number) +function ElementMenuDescriptionProxy:SetFinalizeGridLayout(callback) end diff --git a/Annotations/Interface/Blizzard_Menu/Proxies/MenuManagerProxy.lua b/Annotations/Interface/Blizzard_Menu/Proxies/MenuManagerProxy.lua new file mode 100644 index 00000000..9f92359f --- /dev/null +++ b/Annotations/Interface/Blizzard_Menu/Proxies/MenuManagerProxy.lua @@ -0,0 +1,41 @@ +---@meta _ + +---@see MenuManagerProxyMixin +---@class MenuManagerProxy +local MenuManagerProxy = {} + +---@see MenuManagerProxyMixin.GetOpenMenu +---@return MenuProxy? +function MenuManagerProxy:GetOpenMenu() end + +---@see MenuManagerProxyMixin.CloseMenu +---@param menu MenuProxy +function MenuManagerProxy:CloseMenu(menu) end + +---@see MenuManagerProxyMixin.CloseMenus +function MenuManagerProxy:CloseMenus() end + +---@see MenuManagerProxyMixin.IsAnyMenuOpen +---@return boolean +function MenuManagerProxy:IsAnyMenuOpen() end + +---@see MenuManagerProxyMixin.OpenMenu +---@param ownerRegion Region +---@param menuDescriptionProxy RootMenuDescriptionProxy +---@param anchor AnchorMixin +---@return MenuProxy? menu +function MenuManagerProxy:OpenMenu(ownerRegion, menuDescriptionProxy, anchor) end + +---@see MenuManagerProxyMixin.OpenContextMenu +---@param ownerRegion Region +---@param menuDescriptionProxy RootMenuDescriptionProxy +---@return MenuProxy? menu +function MenuManagerProxy:OpenContextMenu(ownerRegion, menuDescriptionProxy) end + +---@see MenuManagerMixin.HandleESC +function MenuManagerProxy:HandleESC() end + +---@see MenuManagerMixin.HandleGlobalMouseEvent +---@param buttonName mouseButton +---@param event FrameEvent +function MenuManagerProxy:HandleGlobalMouseEvent(buttonName, event) end diff --git a/Annotations/Interface/Blizzard_Menu/Proxies/MenuProxy.lua b/Annotations/Interface/Blizzard_Menu/Proxies/MenuProxy.lua new file mode 100644 index 00000000..1efd68f3 --- /dev/null +++ b/Annotations/Interface/Blizzard_Menu/Proxies/MenuProxy.lua @@ -0,0 +1,38 @@ +---@meta _ + +---@see MenuProxyMixin +---@class MenuProxy: Frame, MenuTemplateBase +local MenuProxy = {} + +---@see MenuProxyMixin.Close +function MenuProxy:Close() end + +---@see MenuMixin.ReinitializeAll # proxied +function MenuProxy:ReinitializeAll() end + +---@see MenuProxyMixin.GetOwnerRegion +---@return Frame +function MenuProxy:GetOwnerRegion() end + +---@see MenuProxyMixin.SendResponse +function MenuProxy:SendResponse(descriptionProxy, response) end + +---@see MenuProxyMixin.SetMenuDescription +function MenuProxy:SetMenuDescription(descriptionProxy) end + +---@see MenuMixin.SetClosedCallback # proxied +---@param onCloseCallback fun(menu: MenuProxy) +function MenuProxy:SetClosedCallback(onCloseCallback) end + +---usually you want to use SharedMenuDescriptionProxy:SetScrollMode instead +---@see MenuProxyMixin.InitScrollLayout +---@param childWidth number +---@param maxScrollExtent number # item height * number of items +function MenuProxy:InitScrollLayout(childWidth, maxScrollExtent) end + +---@see MenuProxyMixin.ClearScrollLayout +function MenuProxy:ClearScrollLayout() end + +---usually there's no need to call it manually +---@see MenuProxyMixin.OnLoad +function MenuProxy:OnLoad() end diff --git a/Annotations/Interface/Blizzard_Menu/Proxies/RootMenuDescriptionProxy.lua b/Annotations/Interface/Blizzard_Menu/Proxies/RootMenuDescriptionProxy.lua new file mode 100644 index 00000000..e3f5729f --- /dev/null +++ b/Annotations/Interface/Blizzard_Menu/Proxies/RootMenuDescriptionProxy.lua @@ -0,0 +1,21 @@ +---@meta _ + +---@class RootMenuDescriptionProxy: SharedMenuDescriptionProxy +local RootMenuDescriptionProxy = {} + +---@param callback fun(menu: MenuProxy) +function RootMenuDescriptionProxy:AddMenuAcquiredCallback(callback) end + +---@param callback fun() +function RootMenuDescriptionProxy:AddMenuChangedCallback(callback) end + +---@param callback fun(menu: MenuProxy, description: SharedMenuDescriptionProxy) +function RootMenuDescriptionProxy:AddMenuResponseCallback(callback) end + +---@param callback fun(rootDescription: RootMenuDescriptionProxy) +function RootMenuDescriptionProxy:AddMenuReleasedCallback(callback) end + +function RootMenuDescriptionProxy:DisableCompositor() end + +function RootMenuDescriptionProxy:DisableReacquireFrames() end + diff --git a/Annotations/Interface/Blizzard_Menu/Proxies/SharedMenuDescriptionProxy.lua b/Annotations/Interface/Blizzard_Menu/Proxies/SharedMenuDescriptionProxy.lua new file mode 100644 index 00000000..d441a781 --- /dev/null +++ b/Annotations/Interface/Blizzard_Menu/Proxies/SharedMenuDescriptionProxy.lua @@ -0,0 +1,136 @@ +---@meta _ +---@ +---@class SharedMenuDescriptionProxy +local SharedMenuDescriptionProxy = {} + +---@return boolean +function SharedMenuDescriptionProxy:HasElements() end + +---@return fun(): ElementMenuDescriptionProxy +function SharedMenuDescriptionProxy:EnumerateElementDescriptions() end + +---@param elementDescription ElementMenuDescriptionProxy +---@param index number? # allows inserting at a specific index, default is last +function SharedMenuDescriptionProxy:Insert(elementDescription, index) end + +---@see MenuUtil.CreateTitle +---@param text string +---@param color ColorMixin? # defaults to NORMAL_FONT_COLOR +---@return ElementMenuDescriptionProxy +function SharedMenuDescriptionProxy:CreateTitle(text, color) end + +---@see MenuUtil.CreateDivider +---@return ElementMenuDescriptionProxy # some inserters and utility functions are missing +function SharedMenuDescriptionProxy:CreateDivider() end + +---@see MenuUtil.CreateSpacer +---@param extend number? # height of the spacer, default = 10 +---@return ElementMenuDescriptionProxy # some inserters and utility functions are missing +function SharedMenuDescriptionProxy:CreateSpacer(extend) end + +---@see MenuUtil.CreateButton +---@param text string +---@param callback MenuResponder +---@param data any? # stored as element's data +---@return ElementMenuDescriptionProxy +function SharedMenuDescriptionProxy:CreateButton(text, callback, data) end + +---@see MenuUtil.CreateCheckbox +---@param text string +---@param isSelected fun(data: any): boolean # data = data param -> element:GetData() +---@param setSelected MenuResponder +---@param data any? # stored as element's data +---@return ElementMenuDescriptionProxy +function SharedMenuDescriptionProxy:CreateCheckbox(text, isSelected, setSelected, data) end + +---@see MenuUtil.CreateRadio +---@param text string +---@param isSelected fun(data: any): boolean # data = data param -> element:GetData() +---@param setSelected MenuResponder +---@param data any? # stored as element's data +---@return ElementMenuDescriptionProxy +function SharedMenuDescriptionProxy:CreateRadio(text, isSelected, setSelected, data) end + +---@see MenuUtil.CreateColorSwatch +---@param text string +---@param callback MenuResponder +---@param colorInfo ColorMixin # stored as element's data +---@return ElementMenuDescriptionProxy +function SharedMenuDescriptionProxy:CreateColorSwatch(text, callback, colorInfo) end + +---@see MenuUtil.CreateFrame +---@return ElementMenuDescriptionProxy +function SharedMenuDescriptionProxy:CreateFrame() end + +---@see MenuUtil.CreateTemplate +---@param template Template +---@return ElementMenuDescriptionProxy +function SharedMenuDescriptionProxy:CreateTemplate(template) end + +---@see RootMenuDescriptionProxyMixin.AddQueuedDescription +---@param queuedDescription ElementMenuDescriptionProxy +function SharedMenuDescriptionProxy:AddQueuedDescription(queuedDescription) end + +---@see RootMenuDescriptionProxyMixin.ClearQueueDescriptions +function SharedMenuDescriptionProxy:ClearQueueDescriptions() end + +---@see MenuUtilPrivate.Utilities.QueueTitle +---@param text string +---@param color ColorMixin? # defaults to NORMAL_FONT_COLOR +---@param clearQueue boolean? # if true, all previously queued descriptions are cleared +function SharedMenuDescriptionProxy:QueueTitle(text, color, clearQueue) end + +---@see MenuUtilPrivate.Utilities.QueueDivider +---@param clearQueue boolean? # if true, all previously queued descriptions are cleared +function SharedMenuDescriptionProxy:QueueDivider(clearQueue) end + +---@see MenuUtilPrivate.Utilities.QueueSpacer +---@param extend number? # height of the spacer, default = 10 +---@param clearQueue boolean? # if true, all previously queued descriptions are cleared +function SharedMenuDescriptionProxy:QueueSpacer(extend, clearQueue) end + +---@see MenuUtilPrivate.Utilities.SetTitleAndTextTooltip +---@param title string +---@param text string +function SharedMenuDescriptionProxy:SetTitleAndTextTooltip(title, text) end + +---@see MenuUtilPrivate.Utilities.SetTooltip +---@param initializer fun(tooltip: GameTooltip, elementDescription: ElementMenuDescriptionProxy) +function SharedMenuDescriptionProxy:SetTooltip(initializer) end + +---@param initializer MenuDescriptionInitializer +---@param index number? # allows specifying an insert order, to run before / after some other initializer; default is last +function SharedMenuDescriptionProxy:AddInitializer(initializer, index) end + +---@param initializer MenuDescriptionInitializer +function SharedMenuDescriptionProxy:SetFinalInitializer(initializer) end + +---@see RootMenuDescriptionProxyMixin.GetTag +---@return string? tag +---@return any? contextData +function SharedMenuDescriptionProxy:GetTag() end + +---@see RootMenuDescriptionProxyMixin.SetTag +---@param tag string +---@param contextData any? +function SharedMenuDescriptionProxy:SetTag(tag, contextData) end + +---@return number +function SharedMenuDescriptionProxy:GetMinimumWidth() end + +---@param width number +function SharedMenuDescriptionProxy:SetMinimumWidth(width) end + +---@param width number +function SharedMenuDescriptionProxy:SetMaximumWidth(width) end + +function SharedMenuDescriptionProxy:ClearQueuedDescriptions() end + +---@param direction MenuGridDirection +---@param columns number? # if not specified, determines the number of columns based on the number of elements +---@param padding number? # defaults to 0 +---@param compactionMargin number? # defaults to disabled +function SharedMenuDescriptionProxy:SetGridMode(direction, columns, padding, compactionMargin) end + +---@param maxScrollExtent number? # item height * number of items, defaults to 200 +function SharedMenuDescriptionProxy:SetScrollMode(maxScrollExtent) end diff --git a/CHANGELOG.md b/CHANGELOG.md index 70f39304..2f1e1e7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Change Log +## [0.17.9] - 2024-11-28 +- Added Blizzard_Menu annotations (by Numy) + ## [0.17.8] - 2024-11-27 - Added ChatThrottleLib @@ -156,6 +159,7 @@ To avoid loading for Lua projects not related to World of Warcraft, all settings - PR [#123](https://github.com/Ketho/vscode-wow-api/pull/123) Make childGroups optional in AceConfig.OptionsTable - PR [#120](https://github.com/Ketho/vscode-wow-api/pull/120) Add definition for tostringall() +[0.17.9]: https://github.com/Ketho/vscode-wow-api/releases/tag/0.17.9 [0.17.8]: https://github.com/Ketho/vscode-wow-api/releases/tag/0.17.8 [0.17.7]: https://github.com/Ketho/vscode-wow-api/releases/tag/0.17.7 [0.17.6]: https://github.com/Ketho/vscode-wow-api/releases/tag/0.17.6 diff --git a/LuaScripts/Tests/FrameXML/Menu.lua b/LuaScripts/Tests/FrameXML/Menu.lua new file mode 100644 index 00000000..b2f5b29f --- /dev/null +++ b/LuaScripts/Tests/FrameXML/Menu.lua @@ -0,0 +1,9 @@ +local dropdown = CreateFrame("DropdownButton", nil, UIParent, "WowStyle1DropdownTemplate"); +dropdown:SetDefaultText("My Dropdown"); +dropdown:SetPoint("CENTER", 0, -250); + +MenuUtil.CreateButtonMenu(dropdown, + {"My Button 1", OnClick, 1}, + {"My Button 2", OnClick, 2}, + {"My Button 3", OnClick, 3} +); diff --git a/README.md b/README.md index 7613869a..9a30ea79 100644 --- a/README.md +++ b/README.md @@ -112,9 +112,9 @@ function UnitLevel(unit) end - [Wowprogramming](https://wowprogramming.com/) - [jnwhiteh](https://twitter.com/jnwhiteh) - [WoW.tools](https://wow.tools/) - [Marlamin](https://github.com/Marlamin)   -- **Annotations**: [Kozoaku](https://github.com/Kozoaku), [Oppzippy](https://github.com/Oppzippy), [Snakybo](https://github.com/Snakybo), [Torhal](https://github.com/Torhal), [Wutname](https://github.com/Wutname1) +- **Annotations**: [Kozoaku](https://github.com/Kozoaku), [Numy](https://github.com/Numynum), [Oppzippy](https://github.com/Oppzippy), [Snakybo](https://github.com/Snakybo), [Torhal](https://github.com/Torhal), [Wutname](https://github.com/Wutname1) - **FrameXML**: [funkydude](https://github.com/funkydude), [Gethe](https://github.com/Gethe), [Tekkub](https://github.com/tekkub) -- **LuaLS**: [Sumneko](https://github.com/Sumneko) +- **LuaLS**: [Sumneko](https://github.com/Sumneko), [carsakiller](https://github.com/carsakiller) - **VS Code extension**: [ChrisKader](https://github.com/ChrisKader), [DakJaniels](https://github.com/DakJaniels), [thatnerdjosh](https://github.com/thatnerdjosh), [Yuyuli](https://www.curseforge.com/members/yuyuli) - **Wiki**: [DahkCeles](https://www.curseforge.com/members/dahkceles/projects), [Foxlit](https://www.townlong-yak.com/), [Iriel](https://warcraft.wiki.gg/wiki/Iriel), [Xelnath](https://warcraft.wiki.gg/wiki/Alexander_Brazie)