Change Log:
--------------------
Version 1.0.4 (12/25/2013)
- Menus opened at the cursor will now stay put when refreshed
Version 1.0.3 (10/06/2012)
- Rewrote the menu method Refresh to better handle major changes to a menu
- Added the ability to open directly to a sub-menu with the menu method Open
Version 1.0.2 (10/01/2012)
- Added the menu method RemoveAllFocusFrames
- The menu methods AddFocusFrame, RemoveAllFocusFrames, and RemovFocusFrame now all call UpdateAutoHide if menu is open
Version 1.0.1 (11/13/2010)
- Initial public release
Description:
--------------------
An alternative to using Blizzard's UIDropDownMenuTemplate and EasyMenu.
Example usage:
local menu = LibStub('LibMenuAssist-1.0'):New()
menu:SetAnchor(0, 0, 'TOP', myAddon.button, 'BOTTOM')
menu.initialize = function(self, level)
-- Do stuff
end
myAddon.button:SetScript('OnClick', function()
menu:Open()
end)
Example using the built-in initialize function:
local menu = LibStub('LibMenuAssist-1.0'):New()
menu:SetAnchor(0, 0, 'TOP', myAddon.button, 'BOTTOM')
menu = function(self, level)
-- Called first each time menu.initialize is called
end
menu = function(self, level)
-- Called when menu.initialize is called and level == 1 (*)
end
menu = function(self, level)
-- Called when menu.initialize is called and level == 2 (*)
end
myAddon.button:SetScript('OnClick', function()
menu:Open()
end)
(*) - menu can be assigned a table instead, which will be processed via EasyMenu_Initialize.
API
menu = lib:New()
Create a new menu object.
Returns:
menu - (table) The menu object to be used by the calling code (see Menu Objects below).
Menu Objects
Any menu created by lib:New() is a normal table that emulates certain frame behaviors to allow it to work with the Blizzard's UIDropDownMenu code. A metatable provides the following frame-like methods: GetScript, HasScript, Hide, IsShown, IsVisible, SetScript, and Show. The only scripts supported by a menu are OnHide and OnShow. The metatable also defaults the field displayMode to 'MENU', set it to false to override. Menus also have the following additional methods:
menu:AddFocusFrame(frame)
Add a frame that is to be considered a part of the menu when calling the methods HasMouseFocus and UpdateAutoHide.
Arguments:
frame - (table[/I...
--------------------
Version 1.0.4 (12/25/2013)
- Menus opened at the cursor will now stay put when refreshed
Version 1.0.3 (10/06/2012)
- Rewrote the menu method Refresh to better handle major changes to a menu
- Added the ability to open directly to a sub-menu with the menu method Open
Version 1.0.2 (10/01/2012)
- Added the menu method RemoveAllFocusFrames
- The menu methods AddFocusFrame, RemoveAllFocusFrames, and RemovFocusFrame now all call UpdateAutoHide if menu is open
Version 1.0.1 (11/13/2010)
- Initial public release
Description:
--------------------
An alternative to using Blizzard's UIDropDownMenuTemplate and EasyMenu.
Example usage:
local menu = LibStub('LibMenuAssist-1.0'):New()
menu:SetAnchor(0, 0, 'TOP', myAddon.button, 'BOTTOM')
menu.initialize = function(self, level)
-- Do stuff
end
myAddon.button:SetScript('OnClick', function()
menu:Open()
end)
Example using the built-in initialize function:
local menu = LibStub('LibMenuAssist-1.0'):New()
menu:SetAnchor(0, 0, 'TOP', myAddon.button, 'BOTTOM')
menu = function(self, level)
-- Called first each time menu.initialize is called
end
menu = function(self, level)
-- Called when menu.initialize is called and level == 1 (*)
end
menu = function(self, level)
-- Called when menu.initialize is called and level == 2 (*)
end
myAddon.button:SetScript('OnClick', function()
menu:Open()
end)
(*) - menu can be assigned a table instead, which will be processed via EasyMenu_Initialize.
API
menu = lib:New()
Create a new menu object.
Returns:
menu - (table) The menu object to be used by the calling code (see Menu Objects below).
Menu Objects
Any menu created by lib:New() is a normal table that emulates certain frame behaviors to allow it to work with the Blizzard's UIDropDownMenu code. A metatable provides the following frame-like methods: GetScript, HasScript, Hide, IsShown, IsVisible, SetScript, and Show. The only scripts supported by a menu are OnHide and OnShow. The metatable also defaults the field displayMode to 'MENU', set it to false to override. Menus also have the following additional methods:
menu:AddFocusFrame(frame)
Add a frame that is to be considered a part of the menu when calling the methods HasMouseFocus and UpdateAutoHide.
Arguments:
frame - (table[/I...