Mercurial > wow > reagentmaker
diff SecureMenu.lua @ 1:5fc29ed07094
First atempt at using secure menus, it doesn't open yet...
author | contrebasse |
---|---|
date | Mon, 28 Mar 2011 22:59:20 +0200 |
parents | eba26c900e99 |
children | 04c5b817eead |
line wrap: on
line diff
--- a/SecureMenu.lua Mon Mar 28 22:32:26 2011 +0200 +++ b/SecureMenu.lua Mon Mar 28 22:59:20 2011 +0200 @@ -16,13 +16,21 @@ bottom = 11 } }) +MenuFrame:SetWidth(70) local numActiveEntries = 0 local menuEntries = {} -function A.menuOpen() - if not InCombatLockDown() and numActiveEntries>0 then +function A.menuOpen(parent) + A.DEBUG("menuOpen") + --if not InCombatLockDown() and numActiveEntries>0 then + MenuFrame:ClearAllPoints() + MenuFrame:SetPoint("TOPLEFT",parent,"TOPRIGHT",0,0) + + MenuFrame:SetSize(50,50) + MenuFrame:SetParent(UIParent) + MenuFrame:Show() - end + --end end function A.menuClose() MenuFrame:Hide() @@ -34,6 +42,7 @@ end function A.menuAddItem(text,action,itemID) + A.DEBUG("menuAddItem "..text) local btn -- Create a button only if necessary if numActiveEntries >= #menuEntries then @@ -41,6 +50,7 @@ table.insert(menuEntries,btn) btn:SetHeight(12) + btn:SetWidth(70) -- Set its position if #menuEntries==1 then @@ -60,7 +70,7 @@ btn:SetScript("OnClick",action) btn:SetAttribute("type", nil) btn:SetAttribute("spell", nil) - btn:SetAttribute("target-item",nil) + btn:SetAttribute("target-item",itemID) elseif type(action)=="string" then btn:SetScript("OnClick",nil) btn:SetAttribute("type", "spell") @@ -69,7 +79,8 @@ end -- if -- Reposition MenuFrame - MenuFrame:SetPoint("BOTTOMRIGHT",btn,"BOTTOMRIGHT",0,0) + --MenuFrame:SetPoint("BOTTOMRIGHT",btn,"BOTTOMRIGHT",0,0) + MenuFrame:SetHeight((numActiveEntries+1)*12) -- Increase she entry number numActiveEntries = numActiveEntries + 1