diff Libs/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua @ 106:e635cd648e01 v49

7.2 update
author yellowfive
date Tue, 28 Mar 2017 16:10:00 -0700
parents 01b63b8ed811
children
line wrap: on
line diff
--- a/Libs/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua	Wed Nov 16 00:03:40 2016 -0800
+++ b/Libs/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua	Tue Mar 28 16:10:00 2017 -0700
@@ -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 @@
 -- 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 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 @@
 		end
 
 		frame:EnableKeyboard(false)
+		frame:EnableMouseWheel(false)
 		self.msgframe:Hide()
 		frame:UnlockHighlight()
 		self.waitingForKey = nil
@@ -103,6 +100,16 @@
 	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 @@
 		self.msgframe:Hide()
 		self:SetDisabled(false)
 		self.button:EnableKeyboard(false)
+		self.button:EnableMouseWheel(false)
 	end,
 
 	-- ["OnRelease"] = nil,
@@ -180,15 +188,17 @@
 	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)