comparison SecureMenu.lua @ 19:f7b23db7bcc6

Correct tooltips for external tradeskills like milling
author contrebasse
date Fri, 08 Apr 2011 19:58:08 +0200
parents 2716889648bd
children 4ea38bae4174
comparison
equal deleted inserted replaced
18:c37c2a46723c 19:f7b23db7bcc6
8 MenuFrame:EnableMouse(true) 8 MenuFrame:EnableMouse(true)
9 MenuFrame:SetPoint("CENTER") 9 MenuFrame:SetPoint("CENTER")
10 tinsert(UISpecialFrames,"ReagentMaker_ExternalFrame") -- make it closable with escape 10 tinsert(UISpecialFrames,"ReagentMaker_ExternalFrame") -- make it closable with escape
11 11
12 MenuFrame:SetScript("OnEvent",function(self,event,...) 12 MenuFrame:SetScript("OnEvent",function(self,event,...)
13 if event == "TRADE_SKILL_CLOSE" or event == "PLAYER_REGEN_DISABLED" then 13 if event == "TRADE_SKILL_UPDATE" then
14 MenuFrame.updateCounts()
15 elseif event == "TRADE_SKILL_CLOSE" or event == "PLAYER_REGEN_DISABLED" then
14 MenuFrame:Hide() 16 MenuFrame:Hide()
15 end 17 end
16 end) 18 end)
17 MenuFrame:RegisterEvent("TRADE_SKILL_CLOSE") 19 MenuFrame:RegisterEvent("TRADE_SKILL_CLOSE")
18 MenuFrame:RegisterEvent("PLAYER_REGEN_ENABLED") 20 MenuFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
21 MenuFrame:RegisterEvent("TRADE_SKILL_UPDATE")
19 A.MenuFrame = MenuFrame 22 A.MenuFrame = MenuFrame
20 23
21 -- Background adaptable vertically 24 -- Background adaptable vertically
22 local bg_top = MenuFrame:CreateTexture(nil,"BACKGROUND",nil,0) 25 local bg_top = MenuFrame:CreateTexture(nil,"BACKGROUND",nil,0)
23 bg_top:SetTexture("Interface\\LootFrame\\UI-LootPanel") 26 bg_top:SetTexture("Interface\\LootFrame\\UI-LootPanel")
151 154
152 local function menuCraftItem() 155 local function menuCraftItem()
153 action(itemID,reagentIndex,IsShiftKeyDown()) 156 action(itemID,reagentIndex,IsShiftKeyDown())
154 end 157 end
155 158
156 local function updateCounts() 159 function MenuFrame.updateCounts()
157 local anyMakable 160 local anyMakable
158 for i=1,numActiveEntries do 161 for i=1,numActiveEntries do
159 btn = menuEntries[i] 162 btn = menuEntries[i]
160 local itemCount = GetItemCount(btn.reagentID) 163 local itemCount = GetItemCount(btn.reagentID)
161 164
283 MenuFrame:SetHeight(89 + numActiveEntries*(MENU_ENTRY_HEIGHT+2)) 286 MenuFrame:SetHeight(89 + numActiveEntries*(MENU_ENTRY_HEIGHT+2))
284 287
285 MenuFrame:ClearAllPoints() 288 MenuFrame:ClearAllPoints()
286 MenuFrame:SetPoint("TOPLEFT",TradeSkillFrame,"TOPRIGHT",-2,14) 289 MenuFrame:SetPoint("TOPLEFT",TradeSkillFrame,"TOPRIGHT",-2,14)
287 290
288 updateCounts() 291 MenuFrame.updateCounts()
289 292
290 MenuFrame:Show() 293 MenuFrame:Show()
291 end 294 end