comparison Libs/AceGUI-3.0/widgets/AceGUIWidget-EditBox.lua @ 124:e31b02b24488

Updated for 8.0 pre-patch and BfA.
author yellowfive
date Tue, 17 Jul 2018 09:57:39 -0700
parents e635cd648e01
children
comparison
equal deleted inserted replaced
123:7a6364917f86 124:e31b02b24488
1 --[[----------------------------------------------------------------------------- 1 --[[-----------------------------------------------------------------------------
2 EditBox Widget 2 EditBox Widget
3 -------------------------------------------------------------------------------]] 3 -------------------------------------------------------------------------------]]
4 local Type, Version = "EditBox", 26 4 local Type, Version = "EditBox", 28
5 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 5 local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
6 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 6 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
7 7
8 -- Lua APIs 8 -- Lua APIs
9 local tostring, pairs = tostring, pairs 9 local tostring, pairs = tostring, pairs
71 local function EditBox_OnEnterPressed(frame) 71 local function EditBox_OnEnterPressed(frame)
72 local self = frame.obj 72 local self = frame.obj
73 local value = frame:GetText() 73 local value = frame:GetText()
74 local cancel = self:Fire("OnEnterPressed", value) 74 local cancel = self:Fire("OnEnterPressed", value)
75 if not cancel then 75 if not cancel then
76 PlaySound("igMainMenuOptionCheckBoxOn") 76 PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
77 HideButton(self) 77 HideButton(self)
78 end 78 end
79 end 79 end
80 80
81 local function EditBox_OnReceiveDrag(frame) 81 local function EditBox_OnReceiveDrag(frame)
82 local self = frame.obj 82 local self = frame.obj
83 local type, id, info = GetCursorInfo() 83 local type, id, info = GetCursorInfo()
84 local name
84 if type == "item" then 85 if type == "item" then
85 self:SetText(info) 86 name = info
86 self:Fire("OnEnterPressed", info)
87 ClearCursor()
88 elseif type == "spell" then 87 elseif type == "spell" then
89 local name = GetSpellInfo(id, info) 88 name = GetSpellInfo(id, info)
89 elseif type == "macro" then
90 name = GetMacroInfo(id)
91 end
92 if name then
90 self:SetText(name) 93 self:SetText(name)
91 self:Fire("OnEnterPressed", name) 94 self:Fire("OnEnterPressed", name)
92 ClearCursor() 95 ClearCursor()
93 elseif type == "macro" then 96 HideButton(self)
94 local name = GetMacroInfo(id) 97 AceGUI:ClearFocus()
95 self:SetText(name) 98 end
96 self:Fire("OnEnterPressed", name)
97 ClearCursor()
98 end
99 HideButton(self)
100 AceGUI:ClearFocus()
101 end 99 end
102 100
103 local function EditBox_OnTextChanged(frame) 101 local function EditBox_OnTextChanged(frame)
104 local self = frame.obj 102 local self = frame.obj
105 local value = frame:GetText() 103 local value = frame:GetText()