vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 idChat2_Scroll = idChat2:NewModule('scroll')
2  
3 function idChat2_Scroll:OnInitialize()
4 local db = idChat2.db.profile
5  
6 if not db.Scroll then
7 db.Scroll = {
8 on = true
9 }
10 end
11  
12 idChat2.Options.args.scroll = {
13 name = 'Scroll',
14 desc = 'Scroll',
15 type = 'group',
16 args = {
17 toggle = {
18 name = 'Toggle',
19 desc = 'Toggle the module on and off',
20 type = 'toggle',
21 get = function() return db.Scroll.on end,
22 set = function(v)
23 if v then
24 self:OnEnable()
25 else
26 self:OnDisable()
27 end
28 db.Scroll.on = v
29 end
30 }
31 }
32 }
33 end
34  
35 function idChat2_Scroll:OnEnable()
36 for i = 1, 7 do
37 local cf = getglobal('ChatFrame'..i)
38 cf:SetScript('OnMouseWheel', function() self:Scroll() end)
39 cf:EnableMouseWheel(true)
40 end
41 end
42  
43 function idChat2_Scroll:OnDisable()
44 for i = 1, 7 do
45 local cf = getglobal('ChatFrame'..i)
46 cf:SetScript('OnMouseWheel', nil)
47 cf:EnableMouseWheel(false)
48 end
49 end
50  
51 function idChat2_Scroll:Scroll()
52 if arg1 > 0 then
53 if IsShiftKeyDown() then
54 this:ScrollToTop()
55 else
56 this:ScrollUp()
57 end
58 elseif arg1 < 0 then
59 if IsShiftKeyDown() then
60 this:ScrollToBottom()
61 else
62 this:ScrollDown()
63 end
64 end
65 end
66