2ddc77e - Remove AceTimer
[wowui.git] / libs / AceGUI-3.0 / widgets / AceGUIWidget-Keybinding.lua
index 7dccc64..ec4cead 100644 (file)
@@ -2,7 +2,7 @@
 Keybinding Widget
 Set Keybindings in the Config UI.
 -------------------------------------------------------------------------------]]
-local Type, Version = "Keybinding", 24
+local Type, Version = "Keybinding", 25
 local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
 
@@ -17,12 +17,6 @@ local CreateFrame, UIParent = CreateFrame, UIParent
 -- List them here for Mikk's FindGlobals script
 -- GLOBALS: NOT_BOUND
 
-local wowMoP
-do
-       local _, _, _, interface = GetBuildInfo()
-       wowMoP = (interface >= 50000)
-end
-
 --[[-----------------------------------------------------------------------------
 Scripts
 -------------------------------------------------------------------------------]]
@@ -40,11 +34,13 @@ local function Keybinding_OnClick(frame, button)
                local self = frame.obj
                if self.waitingForKey then
                        frame:EnableKeyboard(false)
+                       frame:EnableMouseWheel(false)
                        self.msgframe:Hide()
                        frame:UnlockHighlight()
                        self.waitingForKey = nil
                else
                        frame:EnableKeyboard(true)
+                       frame:EnableMouseWheel(true)
                        self.msgframe:Show()
                        frame:LockHighlight()
                        self.waitingForKey = true
@@ -79,6 +75,7 @@ local function Keybinding_OnKeyDown(frame, key)
                end
 
                frame:EnableKeyboard(false)
+               frame:EnableMouseWheel(false)
                self.msgframe:Hide()
                frame:UnlockHighlight()
                self.waitingForKey = nil
@@ -103,6 +100,16 @@ local function Keybinding_OnMouseDown(frame, button)
        Keybinding_OnKeyDown(frame, button)
 end
 
+local function Keybinding_OnMouseWheel(frame, direction)
+       local button
+       if direction >= 0 then
+               button = "MOUSEWHEELUP"
+       else
+               button = "MOUSEWHEELDOWN"
+       end
+       Keybinding_OnKeyDown(frame, button)
+end
+
 --[[-----------------------------------------------------------------------------
 Methods
 -------------------------------------------------------------------------------]]
@@ -115,6 +122,7 @@ local methods = {
                self.msgframe:Hide()
                self:SetDisabled(false)
                self.button:EnableKeyboard(false)
+               self.button:EnableMouseWheel(false)
        end,
 
        -- ["OnRelease"] = nil,
@@ -180,15 +188,17 @@ local function Constructor()
        local name = "AceGUI30KeybindingButton" .. AceGUI:GetNextWidgetNum(Type)
 
        local frame = CreateFrame("Frame", nil, UIParent)
-       local button = CreateFrame("Button", name, frame, wowMoP and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2")
+       local button = CreateFrame("Button", name, frame, "UIPanelButtonTemplate")
 
        button:EnableMouse(true)
+       button:EnableMouseWheel(false)
        button:RegisterForClicks("AnyDown")
        button:SetScript("OnEnter", Control_OnEnter)
        button:SetScript("OnLeave", Control_OnLeave)
        button:SetScript("OnClick", Keybinding_OnClick)
        button:SetScript("OnKeyDown", Keybinding_OnKeyDown)
        button:SetScript("OnMouseDown", Keybinding_OnMouseDown)
+       button:SetScript("OnMouseWheel", Keybinding_OnMouseWheel)
        button:SetPoint("BOTTOMLEFT")
        button:SetPoint("BOTTOMRIGHT")
        button:SetHeight(24)