comparison Libs/AceGUI-3.0/widgets/AceGUIWidget-MultiLineEditBox.lua @ 106:e635cd648e01 v49

7.2 update
author yellowfive
date Tue, 28 Mar 2017 16:10:00 -0700
parents 01b63b8ed811
children
comparison
equal deleted inserted replaced
105:3ce266c86bd3 106:e635cd648e01
1 local Type, Version = "MultiLineEditBox", 27 1 local Type, Version = "MultiLineEditBox", 28
2 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) 2 local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
3 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end 3 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
4 4
5 -- Lua APIs 5 -- Lua APIs
6 local pairs = pairs 6 local pairs = pairs
11 local _G = _G 11 local _G = _G
12 12
13 -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded 13 -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
14 -- List them here for Mikk's FindGlobals script 14 -- List them here for Mikk's FindGlobals script
15 -- GLOBALS: ACCEPT, ChatFontNormal 15 -- GLOBALS: ACCEPT, ChatFontNormal
16
17 local wowMoP
18 do
19 local _, _, _, interface = GetBuildInfo()
20 wowMoP = (interface >= 50000)
21 end
22 16
23 --[[----------------------------------------------------------------------------- 17 --[[-----------------------------------------------------------------------------
24 Support functions 18 Support functions
25 -------------------------------------------------------------------------------]] 19 -------------------------------------------------------------------------------]]
26 20
249 self.editBox:SetFocus() 243 self.editBox:SetFocus()
250 if not self.frame:IsShown() then 244 if not self.frame:IsShown() then
251 self.frame:SetScript("OnShow", OnShowFocus) 245 self.frame:SetScript("OnShow", OnShowFocus)
252 end 246 end
253 end, 247 end,
254 248
249 ["HighlightText"] = function(self, from, to)
250 self.editBox:HighlightText(from, to)
251 end,
252
255 ["GetCursorPosition"] = function(self) 253 ["GetCursorPosition"] = function(self)
256 return self.editBox:GetCursorPosition() 254 return self.editBox:GetCursorPosition()
257 end, 255 end,
258 256
259 ["SetCursorPosition"] = function(self, ...) 257 ["SetCursorPosition"] = function(self, ...)
283 label:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, -4) 281 label:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, -4)
284 label:SetJustifyH("LEFT") 282 label:SetJustifyH("LEFT")
285 label:SetText(ACCEPT) 283 label:SetText(ACCEPT)
286 label:SetHeight(10) 284 label:SetHeight(10)
287 285
288 local button = CreateFrame("Button", ("%s%dButton"):format(Type, widgetNum), frame, wowMoP and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2") 286 local button = CreateFrame("Button", ("%s%dButton"):format(Type, widgetNum), frame, "UIPanelButtonTemplate")
289 button:SetPoint("BOTTOMLEFT", 0, 4) 287 button:SetPoint("BOTTOMLEFT", 0, 4)
290 button:SetHeight(22) 288 button:SetHeight(22)
291 button:SetWidth(label:GetStringWidth() + 24) 289 button:SetWidth(label:GetStringWidth() + 24)
292 button:SetText(ACCEPT) 290 button:SetText(ACCEPT)
293 button:SetScript("OnClick", OnClick) 291 button:SetScript("OnClick", OnClick)