from retail
This commit is contained in:
@@ -1,30 +1,32 @@
|
||||
if not WeakAuras.IsLibsOK() then return end
|
||||
|
||||
local Type, Version = "WeakAurasInput", 1
|
||||
local Type, Version = "WeakAurasInput", 2
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
local OnEditFocusGained = function(frame)
|
||||
local self = frame.obj
|
||||
local option = self.userdata.option
|
||||
if option and option.callbacks and option.callbacks.OnEditFocusGained then
|
||||
option.callbacks.OnEditFocusGained(self)
|
||||
end
|
||||
end
|
||||
local eventCallbacks = {
|
||||
OnEditFocusGained = "OnEditFocusGained",
|
||||
OnEditFocusLost = "OnEditFocusLost",
|
||||
OnEnterPressed = "OnEnterPressed",
|
||||
OnShow = "OnShow"
|
||||
}
|
||||
|
||||
local OnShow = function(frame)
|
||||
local function EventHandler(frame, event)
|
||||
local self = frame.obj
|
||||
local option = self.userdata.option
|
||||
if option and option.callbacks and option.callbacks.OnShow then
|
||||
option.callbacks.OnShow(self)
|
||||
if option and option.callbacks and option.callbacks[event] then
|
||||
option.callbacks[event](self)
|
||||
end
|
||||
end
|
||||
|
||||
local function Constructor()
|
||||
local widget = AceGUI:Create("EditBox")
|
||||
widget.type = Type
|
||||
widget.editbox:HookScript("OnEditFocusGained", OnEditFocusGained)
|
||||
widget.editbox:HookScript("OnShow", OnShow)
|
||||
|
||||
for event, callback in pairs(eventCallbacks) do
|
||||
widget.editbox:HookScript(event, function(frame) EventHandler(frame, callback) end)
|
||||
end
|
||||
|
||||
return widget
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user