Mercurial > wow > reagentmaker
comparison ReagentMaker.lua @ 2:04c5b817eead
The try to build my own secure menu continues...
| author | contrebasse | 
|---|---|
| date | Tue, 29 Mar 2011 22:06:36 +0200 | 
| parents | 5fc29ed07094 | 
| children | ed0582126cae | 
   comparison
  equal
  deleted
  inserted
  replaced
| 1:5fc29ed07094 | 2:04c5b817eead | 
|---|---|
| 44 if toInitialize then | 44 if toInitialize then | 
| 45 | 45 | 
| 46 -- Register clics on reagent's buttons | 46 -- Register clics on reagent's buttons | 
| 47 for i=1,7 do | 47 for i=1,7 do | 
| 48 local button = _G["TradeSkillReagent"..i]; | 48 local button = _G["TradeSkillReagent"..i]; | 
| 49 button:HookScript("OnClick", function() self:ToggleMenu(button, i) end); | 49 button:HookScript("OnClick", function(btn) A.ToggleMenu(btn, i) end); | 
| 50 --button:HookScript("OnEnter", function() self:Entered(button, i) end) | 50 --button:HookScript("OnEnter", function() self:Entered(button, i) end) | 
| 51 --button:HookScript("OnLeave", function() self:Left(button, i) end) | 51 --button:HookScript("OnLeave", function() self:Left(button, i) end) | 
| 52 end -- for | 52 end -- for | 
| 53 | 53 | 
| 54 toInitialize = nil | 54 toInitialize = nil | 
| 140 | 140 | 
| 141 -- WoW functions | 141 -- WoW functions | 
| 142 local IsModifierKeyDown = IsModifierKeyDown | 142 local IsModifierKeyDown = IsModifierKeyDown | 
| 143 local GetTradeSkillReagentItemLink = GetTradeSkillReagentItemLink | 143 local GetTradeSkillReagentItemLink = GetTradeSkillReagentItemLink | 
| 144 local GetTradeSkillSelectionIndex = GetTradeSkillSelectionIndex | 144 local GetTradeSkillSelectionIndex = GetTradeSkillSelectionIndex | 
| 145 local ToggleDropDownMenu = ToggleDropDownMenu | |
| 146 | 145 | 
| 147 -- Toggles the reagent's menu | 146 -- Toggles the reagent's menu | 
| 148 function A:ToggleMenu(button, index) | 147 function A.ToggleMenu(button, index) | 
| 149 -- We want no modifiers | 148 -- We want no modifiers | 
| 150 if IsModifierKeyDown() then return end | 149 if IsModifierKeyDown() then return end | 
| 151 | 150 | 
| 152 local itemID = A.link2ID(GetTradeSkillReagentItemLink(GetTradeSkillSelectionIndex(), index)) | 151 if A.menuIsOpen(button) then | 
| 153 if itemID and A.data[itemID] then | 152 A.menuClose() | 
| 154 A.FillMenu(itemID) | 153 else | 
| 155 A.menuOpen(button) | 154 local itemID = A.link2ID(GetTradeSkillReagentItemLink(GetTradeSkillSelectionIndex(), index)) | 
| 155 if itemID and A.data[itemID] then | |
| 156 A.FillMenu(itemID) | |
| 157 A.menuOpen(button) | |
| 158 else | |
| 159 if A.menuIsOpen() then | |
| 160 A.menuClose() | |
| 161 end | |
| 162 end -- if | |
| 156 end -- if | 163 end -- if | 
| 157 end -- function | 164 end -- function | 
| 158 end -- do | 165 end -- do | 
| 159 | 166 | 
| 160 do | 167 do | 
