chore(libs): sync Ace3 to coa-ace3 (WoWUIDev master @ 52e5f2c)
Bring every embedded Ace3 / CallbackHandler / LibStub copy in line with the canonical Exiles/coa-ace3 bundle so LibStub resolution is predictable across all Exiles forks regardless of which addons are enabled. Libraries updated in this fork: AceAddon-3.0 13 (5 → 13) AceConfig-3.0 3 (2 → 3) AceConfigCmd-3.0 14 (12 → 14) AceConfigDialog-3.0 92 (43 → 92) AceConfigRegistry-3.0 22 (11 → 22) AceConsole-3.0 7 AceDB-3.0 33 (19 → 33) AceDBOptions-3.0 15 (11 → 15) AceEvent-3.0 4 (3 → 4) AceGUI-3.0 41 (30 → 41) AceLocale-3.0 6 (2 → 6) AceTimer-3.0 17 (5 → 17) CallbackHandler-1.0 8 (3 → 8) LibStub 2
This commit is contained in:
@@ -1,104 +1,103 @@
|
||||
local AceGUI = LibStub("AceGUI-3.0")
|
||||
|
||||
-- WoW APIs
|
||||
local _G = _G
|
||||
local CreateFrame, UIParent = CreateFrame, UIParent
|
||||
|
||||
--------------------------
|
||||
-- Button --
|
||||
--------------------------
|
||||
do
|
||||
local Type = "Button"
|
||||
local Version = 12
|
||||
|
||||
local function OnAcquire(self)
|
||||
-- restore default values
|
||||
self:SetHeight(24)
|
||||
self:SetWidth(200)
|
||||
end
|
||||
|
||||
local function OnRelease(self)
|
||||
self.frame:ClearAllPoints()
|
||||
self.frame:Hide()
|
||||
self:SetDisabled(false)
|
||||
end
|
||||
|
||||
local function Button_OnClick(this, ...)
|
||||
this.obj:Fire("OnClick", ...)
|
||||
AceGUI:ClearFocus()
|
||||
end
|
||||
|
||||
local function Button_OnEnter(this)
|
||||
this.obj:Fire("OnEnter")
|
||||
end
|
||||
|
||||
local function Button_OnLeave(this)
|
||||
this.obj:Fire("OnLeave")
|
||||
end
|
||||
|
||||
local function SetText(self, text)
|
||||
self.text:SetText(text or "")
|
||||
end
|
||||
|
||||
local function SetDisabled(self, disabled)
|
||||
self.disabled = disabled
|
||||
if disabled then
|
||||
self.frame:Disable()
|
||||
else
|
||||
self.frame:Enable()
|
||||
end
|
||||
end
|
||||
|
||||
local function Constructor()
|
||||
local num = AceGUI:GetNextWidgetNum(Type)
|
||||
local name = "AceGUI30Button"..num
|
||||
local frame = CreateFrame("Button",name,UIParent,"UIPanelButtonTemplate2")
|
||||
local self = {}
|
||||
self.num = num
|
||||
self.type = Type
|
||||
self.frame = frame
|
||||
|
||||
local left = _G[name .. "Left"]
|
||||
local right = _G[name .. "Right"]
|
||||
local middle = _G[name .. "Middle"]
|
||||
|
||||
left:SetPoint("TOP", frame, "TOP", 0, 0)
|
||||
left:SetPoint("BOTTOM", frame, "BOTTOM", 0, 0)
|
||||
|
||||
right:SetPoint("TOP", frame, "TOP", 0, 0)
|
||||
right:SetPoint("BOTTOM", frame, "BOTTOM", 0, 0)
|
||||
|
||||
middle:SetPoint("TOP", frame, "TOP", 0, 0)
|
||||
middle:SetPoint("BOTTOM", frame, "BOTTOM", 0, 0)
|
||||
|
||||
local text = frame:GetFontString()
|
||||
self.text = text
|
||||
text:ClearAllPoints()
|
||||
text:SetPoint("TOPLEFT",frame,"TOPLEFT", 15, -1)
|
||||
text:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT", -15, 1)
|
||||
text:SetJustifyV("MIDDLE")
|
||||
|
||||
frame:SetScript("OnClick",Button_OnClick)
|
||||
frame:SetScript("OnEnter",Button_OnEnter)
|
||||
frame:SetScript("OnLeave",Button_OnLeave)
|
||||
|
||||
self.SetText = SetText
|
||||
self.SetDisabled = SetDisabled
|
||||
|
||||
frame:EnableMouse(true)
|
||||
|
||||
frame:SetHeight(24)
|
||||
frame:SetWidth(200)
|
||||
|
||||
self.OnRelease = OnRelease
|
||||
self.OnAcquire = OnAcquire
|
||||
|
||||
self.frame = frame
|
||||
frame.obj = self
|
||||
|
||||
AceGUI:RegisterAsWidget(self)
|
||||
return self
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type,Constructor,Version)
|
||||
end
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Button Widget
|
||||
Graphical Button.
|
||||
-------------------------------------------------------------------------------]]
|
||||
local Type, Version = "Button", 24
|
||||
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
|
||||
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
|
||||
|
||||
-- Lua APIs
|
||||
local pairs = pairs
|
||||
|
||||
-- WoW APIs
|
||||
local _G = _G
|
||||
local PlaySound, CreateFrame, UIParent = PlaySound, CreateFrame, UIParent
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Scripts
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Button_OnClick(frame, ...)
|
||||
AceGUI:ClearFocus()
|
||||
PlaySound(852) -- SOUNDKIT.IG_MAINMENU_OPTION
|
||||
frame.obj:Fire("OnClick", ...)
|
||||
end
|
||||
|
||||
local function Control_OnEnter(frame)
|
||||
frame.obj:Fire("OnEnter")
|
||||
end
|
||||
|
||||
local function Control_OnLeave(frame)
|
||||
frame.obj:Fire("OnLeave")
|
||||
end
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Methods
|
||||
-------------------------------------------------------------------------------]]
|
||||
local methods = {
|
||||
["OnAcquire"] = function(self)
|
||||
-- restore default values
|
||||
self:SetHeight(24)
|
||||
self:SetWidth(200)
|
||||
self:SetDisabled(false)
|
||||
self:SetAutoWidth(false)
|
||||
self:SetText()
|
||||
end,
|
||||
|
||||
-- ["OnRelease"] = nil,
|
||||
|
||||
["SetText"] = function(self, text)
|
||||
self.text:SetText(text)
|
||||
if self.autoWidth then
|
||||
self:SetWidth(self.text:GetStringWidth() + 30)
|
||||
end
|
||||
end,
|
||||
|
||||
["SetAutoWidth"] = function(self, autoWidth)
|
||||
self.autoWidth = autoWidth
|
||||
if self.autoWidth then
|
||||
self:SetWidth(self.text:GetStringWidth() + 30)
|
||||
end
|
||||
end,
|
||||
|
||||
["SetDisabled"] = function(self, disabled)
|
||||
self.disabled = disabled
|
||||
if disabled then
|
||||
self.frame:Disable()
|
||||
else
|
||||
self.frame:Enable()
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
--[[-----------------------------------------------------------------------------
|
||||
Constructor
|
||||
-------------------------------------------------------------------------------]]
|
||||
local function Constructor()
|
||||
local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type)
|
||||
local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate")
|
||||
frame:Hide()
|
||||
|
||||
frame:EnableMouse(true)
|
||||
frame:SetScript("OnClick", Button_OnClick)
|
||||
frame:SetScript("OnEnter", Control_OnEnter)
|
||||
frame:SetScript("OnLeave", Control_OnLeave)
|
||||
|
||||
local text = frame:GetFontString()
|
||||
text:ClearAllPoints()
|
||||
text:SetPoint("TOPLEFT", 15, -1)
|
||||
text:SetPoint("BOTTOMRIGHT", -15, 1)
|
||||
text:SetJustifyV("MIDDLE")
|
||||
|
||||
local widget = {
|
||||
text = text,
|
||||
frame = frame,
|
||||
type = Type
|
||||
}
|
||||
for method, func in pairs(methods) do
|
||||
widget[method] = func
|
||||
end
|
||||
|
||||
return AceGUI:RegisterAsWidget(widget)
|
||||
end
|
||||
|
||||
AceGUI:RegisterWidgetType(Type, Constructor, Version)
|
||||
|
||||
Reference in New Issue
Block a user