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
@@ -9,6 +9,7 @@ if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local pairs, assert, type = pairs, assert, type
local min, max, floor, abs = math.min, math.max, math.floor, math.abs
local format = string.format
-- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent
@@ -16,24 +17,24 @@ local CreateFrame, UIParent = CreateFrame, UIParent
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
local function FixScrollOnUpdate(frame)
frame:SetScript("OnUpdate", nil)
frame.obj:FixScroll()
local function FixScrollOnUpdate()
this:SetScript("OnUpdate", nil)
this.obj:FixScroll()
end
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function ScrollFrame_OnMouseWheel(frame, value)
frame.obj:MoveScroll(value)
local function ScrollFrame_OnMouseWheel()
this.obj:MoveScroll(arg1)
end
local function ScrollFrame_OnSizeChanged(frame)
frame:SetScript("OnUpdate", FixScrollOnUpdate)
local function ScrollFrame_OnSizeChanged()
this:SetScript("OnUpdate", FixScrollOnUpdate)
end
local function ScrollBar_OnScrollValueChanged(frame, value)
frame.obj:SetScroll(value)
local function ScrollBar_OnScrollValueChanged()
this.obj:SetScroll(arg1)
end
--[[-----------------------------------------------------------------------------
@@ -50,7 +51,7 @@ local methods = {
for k in pairs(self.localstatus) do
self.localstatus[k] = nil
end
self.scrollframe:SetPoint("BOTTOMRIGHT")
self.scrollframe:SetPoint("BOTTOMRIGHT", 0, 0)
self.scrollbar:Hide()
self.scrollBarShown = nil
self.content.height, self.content.width = nil, nil
@@ -102,7 +103,7 @@ local methods = {
self.scrollBarShown = nil
self.scrollbar:Hide()
self.scrollbar:SetValue(0)
self.scrollframe:SetPoint("BOTTOMRIGHT")
self.scrollframe:SetPoint("BOTTOMRIGHT", 0, 0)
self:DoLayout()
end
else
@@ -157,13 +158,13 @@ local function Constructor()
local num = AceGUI:GetNextWidgetNum(Type)
local scrollframe = CreateFrame("ScrollFrame", nil, frame)
scrollframe:SetPoint("TOPLEFT")
scrollframe:SetPoint("BOTTOMRIGHT")
scrollframe:SetPoint("TOPLEFT", 0, 0)
scrollframe:SetPoint("BOTTOMRIGHT", 0, 0)
scrollframe:EnableMouseWheel(true)
scrollframe:SetScript("OnMouseWheel", ScrollFrame_OnMouseWheel)
scrollframe:SetScript("OnSizeChanged", ScrollFrame_OnSizeChanged)
local scrollbar = CreateFrame("Slider", ("AceConfigDialogScrollFrame%dScrollBar"):format(num), scrollframe, "UIPanelScrollBarTemplate")
local scrollbar = CreateFrame("Slider", format("AceConfigDialogScrollFrame%dScrollBar", num), scrollframe, "UIPanelScrollBarTemplate")
scrollbar:SetPoint("TOPLEFT", scrollframe, "TOPRIGHT", 4, -16)
scrollbar:SetPoint("BOTTOMLEFT", scrollframe, "BOTTOMRIGHT", 4, 16)
scrollbar:SetMinMaxValues(0, 1000)
@@ -180,8 +181,8 @@ local function Constructor()
--Container Support
local content = CreateFrame("Frame", nil, scrollframe)
content:SetPoint("TOPLEFT")
content:SetPoint("TOPRIGHT")
content:SetPoint("TOPLEFT", 0, 0)
content:SetPoint("TOPRIGHT", 0, 0)
content:SetHeight(400)
scrollframe:SetScrollChild(content)