/trunk/Libs/AceGUI-3.0
--[[----------------------------------------------------------------------------- |
Checkbox Widget |
-------------------------------------------------------------------------------]] |
local Type, Version = "CheckBox", 24 |
local Type, Version = "CheckBox", 26 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
self.text:SetPoint("LEFT", self.checkbg, "RIGHT") |
self.text:SetPoint("RIGHT") |
else |
self.text:SetPoint("LEFT", self.checkbg, "RIGHT", self.image:GetWidth() + 2, 0) |
self.text:SetPoint("LEFT", self.image, "RIGHT", 1, 0) |
self.text:SetPoint("RIGHT") |
end |
end |
if self.desc then |
self.desc:SetWidth(width - 30) |
if self.desc:GetText() and self.desc:GetText() ~= "" then |
self:SetHeight(28 + self.desc:GetHeight()) |
self:SetHeight(28 + self.desc:GetStringHeight()) |
end |
end |
end, |
end |
end, |
["SetValue"] = function(self,value) |
["SetValue"] = function(self, value) |
local check = self.check |
self.checked = value |
if value then |
SetDesaturation(self.check, false) |
self.check:Show() |
SetDesaturation(check, false) |
check:Show() |
else |
--Nil is the unknown tristate value |
if self.tristate and value == nil then |
SetDesaturation(self.check, true) |
self.check:Show() |
SetDesaturation(check, true) |
check:Show() |
else |
SetDesaturation(self.check, false) |
self.check:Hide() |
SetDesaturation(check, false) |
check:Hide() |
end |
end |
self:SetDisabled(self.disabled) |
local size |
if type == "radio" then |
size = 16 |
checkbg:SetTexture("Interface\\Buttons\\UI-RadioButton") |
checkbg:SetTexture(130843) -- Interface\\Buttons\\UI-RadioButton |
checkbg:SetTexCoord(0, 0.25, 0, 1) |
check:SetTexture("Interface\\Buttons\\UI-RadioButton") |
check:SetTexture(130843) -- Interface\\Buttons\\UI-RadioButton |
check:SetTexCoord(0.25, 0.5, 0, 1) |
check:SetBlendMode("ADD") |
highlight:SetTexture("Interface\\Buttons\\UI-RadioButton") |
highlight:SetTexture(130843) -- Interface\\Buttons\\UI-RadioButton |
highlight:SetTexCoord(0.5, 0.75, 0, 1) |
else |
size = 24 |
checkbg:SetTexture("Interface\\Buttons\\UI-CheckBox-Up") |
checkbg:SetTexture(130755) -- Interface\\Buttons\\UI-CheckBox-Up |
checkbg:SetTexCoord(0, 1, 0, 1) |
check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") |
check:SetTexture(130751) -- Interface\\Buttons\\UI-CheckBox-Check |
check:SetTexCoord(0, 1, 0, 1) |
check:SetBlendMode("BLEND") |
highlight:SetTexture("Interface\\Buttons\\UI-CheckBox-Highlight") |
highlight:SetTexture(130753) -- Interface\\Buttons\\UI-CheckBox-Highlight |
highlight:SetTexCoord(0, 1, 0, 1) |
end |
checkbg:SetHeight(size) |
self.desc:Show() |
--self.text:SetFontObject(GameFontNormal) |
self.desc:SetText(desc) |
self:SetHeight(28 + self.desc:GetHeight()) |
self:SetHeight(28 + self.desc:GetStringHeight()) |
else |
if self.desc then |
self.desc:SetText("") |
checkbg:SetWidth(24) |
checkbg:SetHeight(24) |
checkbg:SetPoint("TOPLEFT") |
checkbg:SetTexture("Interface\\Buttons\\UI-CheckBox-Up") |
checkbg:SetTexture(130755) -- Interface\\Buttons\\UI-CheckBox-Up |
local check = frame:CreateTexture(nil, "OVERLAY") |
check:SetAllPoints(checkbg) |
check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") |
check:SetTexture(130751) -- Interface\\Buttons\\UI-CheckBox-Check |
local text = frame:CreateFontString(nil, "OVERLAY", "GameFontHighlight") |
text:SetJustifyH("LEFT") |
text:SetPoint("RIGHT") |
local highlight = frame:CreateTexture(nil, "HIGHLIGHT") |
highlight:SetTexture("Interface\\Buttons\\UI-CheckBox-Highlight") |
highlight:SetTexture(130753) -- Interface\\Buttons\\UI-CheckBox-Highlight |
highlight:SetBlendMode("ADD") |
highlight:SetAllPoints(checkbg) |
local highlight = frame:CreateTexture(nil, "HIGHLIGHT") |
highlight:SetAllPoints(image) |
highlight:SetTexture("Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight") |
highlight:SetTexture(136580) -- Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight |
highlight:SetTexCoord(0, 1, 0.23, 0.77) |
highlight:SetBlendMode("ADD") |
statustext:SetText("") |
local titlebg = frame:CreateTexture(nil, "OVERLAY") |
titlebg:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header") |
titlebg:SetTexture(131080) -- Interface\\DialogFrame\\UI-DialogBox-Header |
titlebg:SetTexCoord(0.31, 0.67, 0, 0.63) |
titlebg:SetPoint("TOP", 0, 12) |
titlebg:SetWidth(100) |
titletext:SetPoint("TOP", titlebg, "TOP", 0, -14) |
local titlebg_l = frame:CreateTexture(nil, "OVERLAY") |
titlebg_l:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header") |
titlebg_l:SetTexture(131080) -- Interface\\DialogFrame\\UI-DialogBox-Header |
titlebg_l:SetTexCoord(0.21, 0.31, 0, 0.63) |
titlebg_l:SetPoint("RIGHT", titlebg, "LEFT") |
titlebg_l:SetWidth(30) |
titlebg_l:SetHeight(40) |
local titlebg_r = frame:CreateTexture(nil, "OVERLAY") |
titlebg_r:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header") |
titlebg_r:SetTexture(131080) -- Interface\\DialogFrame\\UI-DialogBox-Header |
titlebg_r:SetTexCoord(0.67, 0.77, 0, 0.63) |
titlebg_r:SetPoint("LEFT", titlebg, "RIGHT") |
titlebg_r:SetWidth(30) |
line1:SetWidth(14) |
line1:SetHeight(14) |
line1:SetPoint("BOTTOMRIGHT", -8, 8) |
line1:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border") |
line1:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border |
local x = 0.1 * 14/17 |
line1:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5) |
line2:SetWidth(8) |
line2:SetHeight(8) |
line2:SetPoint("BOTTOMRIGHT", -8, 8) |
line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border") |
line2:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border |
local x = 0.1 * 8/17 |
line2:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5) |
left:SetHeight(8) |
left:SetPoint("LEFT", 3, 0) |
left:SetPoint("RIGHT", label, "LEFT", -5, 0) |
left:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border") |
left:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border |
left:SetTexCoord(0.81, 0.94, 0.5, 1) |
local right = frame:CreateTexture(nil, "BACKGROUND") |
right:SetHeight(8) |
right:SetPoint("RIGHT", -3, 0) |
right:SetPoint("LEFT", label, "RIGHT", 5, 0) |
right:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border") |
right:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border |
right:SetTexCoord(0.81, 0.94, 0.5, 1) |
local widget = { |
frame:SetToplevel(true) |
local titlebg = frame:CreateTexture(nil, "BACKGROUND") |
titlebg:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Title-Background]]) |
titlebg:SetTexture(251966) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Title-Background |
titlebg:SetPoint("TOPLEFT", 9, -6) |
titlebg:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -28, -24) |
local dialogbg = frame:CreateTexture(nil, "BACKGROUND") |
dialogbg:SetTexture([[Interface\Tooltips\UI-Tooltip-Background]]) |
dialogbg:SetTexture(137056) -- Interface\\Tooltips\\UI-Tooltip-Background |
dialogbg:SetPoint("TOPLEFT", 8, -24) |
dialogbg:SetPoint("BOTTOMRIGHT", -6, 8) |
dialogbg:SetVertexColor(0, 0, 0, .75) |
local topleft = frame:CreateTexture(nil, "BORDER") |
topleft:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]]) |
topleft:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border |
topleft:SetWidth(64) |
topleft:SetHeight(64) |
topleft:SetPoint("TOPLEFT") |
topleft:SetTexCoord(0.501953125, 0.625, 0, 1) |
local topright = frame:CreateTexture(nil, "BORDER") |
topright:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]]) |
topright:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border |
topright:SetWidth(64) |
topright:SetHeight(64) |
topright:SetPoint("TOPRIGHT") |
topright:SetTexCoord(0.625, 0.75, 0, 1) |
local top = frame:CreateTexture(nil, "BORDER") |
top:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]]) |
top:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border |
top:SetHeight(64) |
top:SetPoint("TOPLEFT", topleft, "TOPRIGHT") |
top:SetPoint("TOPRIGHT", topright, "TOPLEFT") |
top:SetTexCoord(0.25, 0.369140625, 0, 1) |
local bottomleft = frame:CreateTexture(nil, "BORDER") |
bottomleft:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]]) |
bottomleft:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border |
bottomleft:SetWidth(64) |
bottomleft:SetHeight(64) |
bottomleft:SetPoint("BOTTOMLEFT") |
bottomleft:SetTexCoord(0.751953125, 0.875, 0, 1) |
local bottomright = frame:CreateTexture(nil, "BORDER") |
bottomright:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]]) |
bottomright:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border |
bottomright:SetWidth(64) |
bottomright:SetHeight(64) |
bottomright:SetPoint("BOTTOMRIGHT") |
bottomright:SetTexCoord(0.875, 1, 0, 1) |
local bottom = frame:CreateTexture(nil, "BORDER") |
bottom:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]]) |
bottom:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border |
bottom:SetHeight(64) |
bottom:SetPoint("BOTTOMLEFT", bottomleft, "BOTTOMRIGHT") |
bottom:SetPoint("BOTTOMRIGHT", bottomright, "BOTTOMLEFT") |
bottom:SetTexCoord(0.376953125, 0.498046875, 0, 1) |
local left = frame:CreateTexture(nil, "BORDER") |
left:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]]) |
left:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border |
left:SetWidth(64) |
left:SetPoint("TOPLEFT", topleft, "BOTTOMLEFT") |
left:SetPoint("BOTTOMLEFT", bottomleft, "TOPLEFT") |
left:SetTexCoord(0.001953125, 0.125, 0, 1) |
local right = frame:CreateTexture(nil, "BORDER") |
right:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]]) |
right:SetTexture(251963) -- Interface\\PaperDollInfoFrame\\UI-GearManager-Border |
right:SetWidth(64) |
right:SetPoint("TOPRIGHT", topright, "BOTTOMRIGHT") |
right:SetPoint("BOTTOMRIGHT", bottomright, "TOPRIGHT") |
line1:SetWidth(14) |
line1:SetHeight(14) |
line1:SetPoint("BOTTOMRIGHT", -8, 8) |
line1:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border") |
line1:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border |
local x = 0.1 * 14/17 |
line1:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5) |
line2:SetWidth(8) |
line2:SetHeight(8) |
line2:SetPoint("BOTTOMRIGHT", -8, 8) |
line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border") |
line2:SetTexture(137057) -- Interface\\Tooltips\\UI-Tooltip-Border |
local x = 0.1 * 8/17 |
line2:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5) |
ScrollFrame Container |
Plain container that scrolls its content and doesn't grow in height. |
-------------------------------------------------------------------------------]] |
local Type, Version = "ScrollFrame", 24 |
local Type, Version = "ScrollFrame", 26 |
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, assert, type = pairs, assert, type |
local min, max, floor, abs = math.min, math.max, math.floor, math.abs |
local min, max, floor = math.min, math.max, math.floor |
-- WoW APIs |
local CreateFrame, UIParent = CreateFrame, UIParent |
self.scrollframe:SetPoint("BOTTOMRIGHT") |
self.scrollbar:Hide() |
self.scrollBarShown = nil |
self.content.height, self.content.width = nil, nil |
self.content.height, self.content.width, self.content.original_width = nil, nil, nil |
end, |
["SetScroll"] = function(self, value) |
local status = self.status or self.localstatus |
local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight() |
local offset = status.offset or 0 |
local curvalue = self.scrollbar:GetValue() |
-- Give us a margin of error of 2 pixels to stop some conditions that i would blame on floating point inaccuracys |
-- No-one is going to miss 2 pixels at the bottom of the frame, anyhow! |
if viewheight < height + 2 then |
self.scrollbar:Hide() |
self.scrollbar:SetValue(0) |
self.scrollframe:SetPoint("BOTTOMRIGHT") |
if self.content.original_width then |
self.content.width = self.content.original_width |
end |
self:DoLayout() |
end |
else |
self.scrollBarShown = true |
self.scrollbar:Show() |
self.scrollframe:SetPoint("BOTTOMRIGHT", -20, 0) |
if self.content.original_width then |
self.content.width = self.content.original_width - 20 |
end |
self:DoLayout() |
end |
local value = (offset / (viewheight - height) * 1000) |
["LayoutFinished"] = function(self, width, height) |
self.content:SetHeight(height or 0 + 20) |
-- update the scrollframe |
self:FixScroll() |
-- schedule another update when everything has "settled" |
self.scrollframe:SetScript("OnUpdate", FixScrollOnUpdate) |
end, |
["OnWidthSet"] = function(self, width) |
local content = self.content |
content.width = width |
content.width = width - (self.scrollBarShown and 20 or 0) |
content.original_width = width |
end, |
["OnHeightSet"] = function(self, height) |
--[[ $Id: AceGUIWidget-DropDown-Items.lua 1167 2017-08-29 22:08:48Z funkydude $ ]]-- |
--[[ $Id: AceGUIWidget-DropDown-Items.lua 1192 2018-07-30 18:03:51Z funkydude $ ]]-- |
local AceGUI = LibStub("AceGUI-3.0") |
self.text = text |
local highlight = frame:CreateTexture(nil, "OVERLAY") |
highlight:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight") |
highlight:SetTexture(136810) -- Interface\\QuestFrame\\UI-QuestTitleHighlight |
highlight:SetBlendMode("ADD") |
highlight:SetHeight(14) |
highlight:ClearAllPoints() |
check:SetWidth(16) |
check:SetHeight(16) |
check:SetPoint("LEFT",frame,"LEFT",3,-1) |
check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") |
check:SetTexture(130751) -- Interface\\Buttons\\UI-CheckBox-Check |
check:Hide() |
self.check = check |
sub:SetWidth(16) |
sub:SetHeight(16) |
sub:SetPoint("RIGHT",frame,"RIGHT",-3,-1) |
sub:SetTexture("Interface\\ChatFrame\\ChatFrameExpandArrow") |
sub:SetTexture(130940) -- Interface\\ChatFrame\\ChatFrameExpandArrow |
sub:Hide() |
self.sub = sub |
local function UpdateButton(button, treeline, selected, canExpand, isExpanded) |
local self = button.obj |
local toggle = button.toggle |
local frame = self.frame |
local text = treeline.text or "" |
local icon = treeline.icon |
local iconCoords = treeline.iconCoords |
button:UnlockHighlight() |
button.selected = false |
end |
local normalTexture = button:GetNormalTexture() |
local line = button.line |
button.level = level |
if ( level == 1 ) then |
button:SetNormalFontObject("GameFontNormal") |
if canExpand then |
if not isExpanded then |
toggle:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-UP") |
toggle:SetPushedTexture("Interface\\Buttons\\UI-PlusButton-DOWN") |
toggle:SetNormalTexture(130838) -- Interface\\Buttons\\UI-PlusButton-UP |
toggle:SetPushedTexture(130836) -- Interface\\Buttons\\UI-PlusButton-DOWN |
else |
toggle:SetNormalTexture("Interface\\Buttons\\UI-MinusButton-UP") |
toggle:SetPushedTexture("Interface\\Buttons\\UI-MinusButton-DOWN") |
toggle:SetNormalTexture(130821) -- Interface\\Buttons\\UI-MinusButton-UP |
toggle:SetPushedTexture(130820) -- Interface\\Buttons\\UI-MinusButton-DOWN |
end |
toggle:Show() |
else |
local function Button_OnDoubleClick(button) |
local self = button.obj |
local status = self.status or self.localstatus |
local status = (self.status or self.localstatus).groups |
status[button.uniquevalue] = not status[button.uniquevalue] |
self:RefreshTree() |
["BuildLevel"] = function(self, tree, level, parent) |
local groups = (self.status or self.localstatus).groups |
local hasChildren = self.hasChildren |
for i, v in ipairs(tree) do |
if v.children then |
local colorSwatch = frame:CreateTexture(nil, "OVERLAY") |
colorSwatch:SetWidth(19) |
colorSwatch:SetHeight(19) |
colorSwatch:SetTexture("Interface\\ChatFrame\\ChatFrameColorSwatch") |
colorSwatch:SetTexture(130939) -- Interface\\ChatFrame\\ChatFrameColorSwatch |
colorSwatch:SetPoint("LEFT") |
local texture = frame:CreateTexture(nil, "BACKGROUND") |
local checkers = frame:CreateTexture(nil, "BACKGROUND") |
checkers:SetWidth(14) |
checkers:SetHeight(14) |
checkers:SetTexture("Tileset\\Generic\\Checkers") |
checkers:SetTexture(188523) -- Tileset\\Generic\\Checkers |
checkers:SetTexCoord(.25, 0, 0.5, .25) |
checkers:SetDesaturated(true) |
checkers:SetVertexColor(1, 1, 1, 0.75) |
text:SetPoint("RIGHT") |
--local highlight = frame:CreateTexture(nil, "HIGHLIGHT") |
--highlight:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight") |
--highlight:SetTexture(136810) -- Interface\\QuestFrame\\UI-QuestTitleHighlight |
--highlight:SetBlendMode("ADD") |
--highlight:SetAllPoints(frame) |
-- Lua APIs |
local select, pairs = select, pairs |
-- WoW APIs |
local CreateFrame, UIParent = CreateFrame, UIParent |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: GameFontHighlightSmall |
--[[----------------------------------------------------------------------------- |
Scripts |
-------------------------------------------------------------------------------]] |
Label Widget |
Displays text and optionally an icon. |
-------------------------------------------------------------------------------]] |
local Type, Version = "Label", 24 |
local Type, Version = "Label", 26 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
label:SetPoint("TOP", image, "BOTTOM") |
label:SetPoint("LEFT") |
label:SetWidth(width) |
height = image:GetHeight() + label:GetHeight() |
height = image:GetHeight() + label:GetStringHeight() |
else |
-- image on the left |
image:SetPoint("TOPLEFT") |
if image:GetHeight() > label:GetHeight() then |
if image:GetHeight() > label:GetStringHeight() then |
label:SetPoint("LEFT", image, "RIGHT", 4, 0) |
else |
label:SetPoint("TOPLEFT", image, "TOPRIGHT", 4, 0) |
end |
label:SetWidth(width - imagewidth - 4) |
height = max(image:GetHeight(), label:GetHeight()) |
height = max(image:GetHeight(), label:GetStringHeight()) |
end |
else |
-- no image shown |
label:SetPoint("TOPLEFT") |
label:SetWidth(width) |
height = label:GetHeight() |
height = label:GetStringHeight() |
end |
-- avoid zero-height labels, since they can used as spacers |
if not height or height == 0 then |
height = 1 |
end |
self.resizing = true |
frame:SetHeight(height) |
frame.height = height |
AceGUI:ClearFocus() |
end |
local function Slider_OnValueChanged(frame) |
local function Slider_OnValueChanged(frame, newvalue) |
local self = frame.obj |
if not frame.setup then |
local newvalue = frame:GetValue() |
if self.step and self.step > 0 then |
local min_value = self.min or 0 |
newvalue = floor((newvalue - min_value) / self.step + 0.5) * self.step + min_value |
["BuildTabs"] = function(self) |
local hastitle = (self.titletext:GetText() and self.titletext:GetText() ~= "") |
local status = self.status or self.localstatus |
local tablist = self.tablist |
local tabs = self.tabs |
-- f:AddChild(btn) |
-- @class file |
-- @name AceGUI-3.0 |
-- @release $Id: AceGUI-3.0.lua 1177 2018-06-25 12:12:48Z nevcairiel $ |
-- @release $Id: AceGUI-3.0.lua 1193 2018-08-02 12:24:37Z funkydude $ |
local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 36 |
local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR) |
if not AceGUI then return end -- No upgrade needed |
-- Lua APIs |
local tconcat, tremove, tinsert = table.concat, table.remove, table.insert |
local tinsert = table.insert |
local select, pairs, next, type = select, pairs, next, type |
local error, assert, loadstring = error, assert, loadstring |
local setmetatable, rawget, rawset = setmetatable, rawget, rawset |
local error, assert = error, assert |
local setmetatable, rawget = setmetatable, rawget |
local math_max = math.max |
-- WoW APIs |
return geterrorhandler()(err) |
end |
local function CreateDispatcher(argCount) |
local code = [[ |
local xpcall, eh = ... |
local method, ARGS |
local function call() return method(ARGS) end |
local function dispatch(func, ...) |
method = func |
if not method then return end |
ARGS = ... |
return xpcall(call, eh) |
end |
return dispatch |
]] |
local ARGS = {} |
for i = 1, argCount do ARGS[i] = "arg"..i end |
code = code:gsub("ARGS", tconcat(ARGS, ", ")) |
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(xpcall, errorhandler) |
end |
local Dispatchers = setmetatable({}, {__index=function(self, argCount) |
local dispatcher = CreateDispatcher(argCount) |
rawset(self, argCount, dispatcher) |
return dispatcher |
end}) |
Dispatchers[0] = function(func) |
return xpcall(func, errorhandler) |
end |
local function safecall(func, ...) |
return Dispatchers[select("#", ...)](func, ...) |
if func then |
return xpcall(func, errorhandler, ...) |
end |
end |
-- Recycling functions |
--height of the current row |
local rowheight = 0 |
local rowoffset = 0 |
local lastrowoffset |
local width = content.width or content:GetWidth() or 0 |
--control at the start of the row |
local rowstart |
local rowstartoffset |
local lastrowstart |
local isfullheight |
local frameoffset |