/trunk
--$Id$ |
-- Simplified Menu Display System |
-- This is a basic system for displaying a menu from a structure table. |
-- |
-- autoHideDelay - how long until the menu disappears |
-- |
-- |
-- ---------------------------------------------------------------------------- |
-- Localized Lua globals. |
-- ---------------------------------------------------------------------------- |
local _G = getfenv(0) |
-- ---------------------------------------------------------------------------- |
local MAJOR_VERSION = "NoTaint_EasyMenu-7.2.0" |
local MINOR_VERSION = 90000 + tonumber(("$Rev$"):match("%d+")) |
local LibStub = _G.LibStub |
if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end |
local Lib = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION) |
if not Lib then return end |
function Lib_EasyMenu(menuList, menuFrame, anchor, x, y, displayMode, autoHideDelay ) |
if ( displayMode == "MENU" ) then |
menuFrame.displayMode = displayMode; |
== About == |
Standard UIDropDownMenu global functions using protected frames and causing taints |
when used by third-party addons. But it is possible to avoid taints by using same |
functionality with that library. |
* constants (typed with all CAPS): "LIB_" added at the start |
* functions: "Lib_" added at the start |
== How to use it (for addon developer) == |
* Add UIDropDownMenu.xml to your toc. |
* If your addon doesn't embed LibStub, you will need it. |
* Like ordinal code for UIDropDownMenu with "Lib_" instead. |
== Constants == |
* LIB_UIDROPDOWNMENU_MINBUTTONS |
* LIB_UIDROPDOWNMENU_MAXBUTTONS |
* Lib_UIDropDownMenu_IsEnabled |
* Lib_UIDropDownMenu_GetValue |
== How to use it == |
* Add UIDropDownMenu.xml to your toc. |
* Like ordinal code for UIDropDownMenu with "Lib_" instead. |
Revision History: |
================= |
v7.2.0.24015-r2 (2017/05/19) |
---------------------------- |
- added version number to EasyMenu |
- increased LIB_UIDROPDOWNMENU_MAXBUTTONS to 24 |
- renamed packaged folder name to !NoTaint_UIDropDownMenu |
- No impact to addons which embedded this lib |
- For users who installed this lib separately, please remove the old "NoTaint_UIDropDownMenu" folder |
v7.2.0.24015 (2017/05/12) |
------------------------- |
- added UIDropDownMenu.xml; |
<!-- $Id$ --> |
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ |
..\FrameXML\UI.xsd"> |
<Button name="Lib_UIDropDownMenuButtonTemplate" virtual="true"> |
<Button name="$parentButton6" inherits="Lib_UIDropDownMenuButtonTemplate" id="6"/> |
<Button name="$parentButton7" inherits="Lib_UIDropDownMenuButtonTemplate" id="7"/> |
<Button name="$parentButton8" inherits="Lib_UIDropDownMenuButtonTemplate" id="8"/> |
<Button name="$parentButton9" inherits="Lib_UIDropDownMenuButtonTemplate" id="9"/> |
<Button name="$parentButton10" inherits="Lib_UIDropDownMenuButtonTemplate" id="10"/> |
<Button name="$parentButton11" inherits="Lib_UIDropDownMenuButtonTemplate" id="11"/> |
<Button name="$parentButton12" inherits="Lib_UIDropDownMenuButtonTemplate" id="12"/> |
<Button name="$parentButton13" inherits="Lib_UIDropDownMenuButtonTemplate" id="13"/> |
<Button name="$parentButton14" inherits="Lib_UIDropDownMenuButtonTemplate" id="14"/> |
<Button name="$parentButton15" inherits="Lib_UIDropDownMenuButtonTemplate" id="15"/> |
<Button name="$parentButton16" inherits="Lib_UIDropDownMenuButtonTemplate" id="16"/> |
<Button name="$parentButton17" inherits="Lib_UIDropDownMenuButtonTemplate" id="17"/> |
<Button name="$parentButton18" inherits="Lib_UIDropDownMenuButtonTemplate" id="18"/> |
<Button name="$parentButton19" inherits="Lib_UIDropDownMenuButtonTemplate" id="19"/> |
<Button name="$parentButton20" inherits="Lib_UIDropDownMenuButtonTemplate" id="20"/> |
<Button name="$parentButton21" inherits="Lib_UIDropDownMenuButtonTemplate" id="21"/> |
<Button name="$parentButton22" inherits="Lib_UIDropDownMenuButtonTemplate" id="22"/> |
<Button name="$parentButton23" inherits="Lib_UIDropDownMenuButtonTemplate" id="23"/> |
<Button name="$parentButton24" inherits="Lib_UIDropDownMenuButtonTemplate" id="24"/> |
</Frames> |
<Scripts> |
<OnClick> |
<!-- $Id$ --> |
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ |
..\FrameXML\UI.xsd"> |
<Script file="UIDropDownMenu.lua"/> |
-- ////////////////////////////////////////////////////////////// |
LIB_UIDROPDOWNMENU_MINBUTTONS = 8; |
LIB_UIDROPDOWNMENU_MAXBUTTONS = 8; |
LIB_UIDROPDOWNMENU_MAXBUTTONS = 24; |
LIB_UIDROPDOWNMENU_MAXLEVELS = 2; |
LIB_UIDROPDOWNMENU_BUTTON_HEIGHT = 16; |
LIB_UIDROPDOWNMENU_BORDER_HEIGHT = 15; |
button:SetPoint("RIGHT", name.."Text", "RIGHT", 6, 0); |
frame.displayMode = "MENU"; |
end |
end |
function Lib_UIDropDownMenu_SetInitializeFunction(frame, initFunction) |