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
-- List them here for Mikk's FindGlobals script
-- GLOBALS: NOT_BOUND
-local wowMoP
-do
- local _, _, _, interface = GetBuildInfo()
- wowMoP = (interface >= 50000)
-end
-
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
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
end
frame:EnableKeyboard(false)
+ frame:EnableMouseWheel(false)
self.msgframe:Hide()
frame:UnlockHighlight()
self.waitingForKey = nil
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
-------------------------------------------------------------------------------]]
self.msgframe:Hide()
self:SetDisabled(false)
self.button:EnableKeyboard(false)
+ self.button:EnableMouseWheel(false)
end,
-- ["OnRelease"] = nil,
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)