Ace3 backport

This commit is contained in:
Pinya
2018-07-21 13:29:50 +03:00
parent 332d53e7f6
commit f0eac39bcd
43 changed files with 1071 additions and 846 deletions
@@ -6,7 +6,9 @@ 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 select, pairs = select, pairs
local pairs = pairs
local unpack = unpack
local getn = table.getn
-- WoW APIs
local PlaySound = PlaySound
@@ -24,26 +26,26 @@ local function AlignImage(self)
self.text:ClearAllPoints()
if not img then
self.text:SetPoint("LEFT", self.checkbg, "RIGHT")
self.text:SetPoint("RIGHT")
self.text:SetPoint("RIGHT", 0, 0)
else
self.text:SetPoint("LEFT", self.image,"RIGHT", 1, 0)
self.text:SetPoint("RIGHT")
self.text:SetPoint("RIGHT", 0, 0)
end
end
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function Control_OnEnter(frame)
frame.obj:Fire("OnEnter")
local function Control_OnEnter()
this.obj:Fire("OnEnter")
end
local function Control_OnLeave(frame)
frame.obj:Fire("OnLeave")
local function Control_OnLeave()
this.obj:Fire("OnLeave")
end
local function CheckBox_OnMouseDown(frame)
local self = frame.obj
local function CheckBox_OnMouseDown()
local self = this.obj
if not self.disabled then
if self.image:GetTexture() then
self.text:SetPoint("LEFT", self.image,"RIGHT", 2, -1)
@@ -54,8 +56,8 @@ local function CheckBox_OnMouseDown(frame)
AceGUI:ClearFocus()
end
local function CheckBox_OnMouseUp(frame)
local self = frame.obj
local function CheckBox_OnMouseUp()
local self = this.obj
if not self.disabled then
self:ToggleChecked()
@@ -226,9 +228,9 @@ local methods = {
image:SetTexture(path)
if image:GetTexture() then
local n = select("#", ...)
local n = getn(arg)
if n == 4 or n == 8 then
image:SetTexCoord(...)
image:SetTexCoord(unpack(arg))
else
image:SetTexCoord(0, 1, 0, 1)
end
@@ -253,7 +255,7 @@ local function Constructor()
local checkbg = frame:CreateTexture(nil, "ARTWORK")
checkbg:SetWidth(24)
checkbg:SetHeight(24)
checkbg:SetPoint("TOPLEFT")
checkbg:SetPoint("TOPLEFT", 0, 0)
checkbg:SetTexture("Interface\\Buttons\\UI-CheckBox-Up")
local check = frame:CreateTexture(nil, "OVERLAY")
@@ -264,7 +266,7 @@ local function Constructor()
text:SetJustifyH("LEFT")
text:SetHeight(18)
text:SetPoint("LEFT", checkbg, "RIGHT")
text:SetPoint("RIGHT")
text:SetPoint("RIGHT", 0, 0)
local highlight = frame:CreateTexture(nil, "HIGHLIGHT")
highlight:SetTexture("Interface\\Buttons\\UI-CheckBox-Highlight")