public
Description: WoW Addon - Generic reminder framework
Homepage: http://www.tekkub.net/
Clone URL: git://github.com/tekkub/cork.git
Click here to lend your support to: cork and make a donation at www.pledgie.com !
cork / Mousewheel.lua
100644 27 lines (20 sloc) 0.859 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
-- Dynamic mousewheel binding module, originally created by Adirelle <gperreal@free.fr>
 
local function ClearBindings()
  if InCombatLockdown() then return end
  ClearOverrideBindings(CorkFrame)
end
 
function Cork:UpdateMouseBinding(event, unit)
  if InCombatLockdown() then return end
  if Cork.db.bindwheel and (event ~= "PLAYER_REGEN_DISABLED") and Corkboard:IsVisible() then
    SetOverrideBindingClick(CorkFrame, true, 'MOUSEWHEELUP', 'CorkFrame')
    SetOverrideBindingClick(CorkFrame, true, 'MOUSEWHEELDOWN', 'CorkFrame')
  else
    ClearOverrideBindings(CorkFrame)
  end
end
 
 
local frame = CreateFrame('Frame', nil, Corkboard)
frame:SetScript('OnShow', Cork.UpdateMouseBinding)
frame:SetScript('OnHide', ClearBindings)
 
frame:SetScript("OnEvent", Cork.UpdateMouseBinding)
frame:RegisterEvent('PLAYER_REGEN_ENABLED')
frame:RegisterEvent('PLAYER_REGEN_DISABLED')