/trunk/VendorMaster/libs
local Type, Version = "MultiLineEditBox", 27 |
local Type, Version = "MultiLineEditBox", 28 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: ACCEPT, ChatFontNormal |
local wowMoP |
do |
local _, _, _, interface = GetBuildInfo() |
wowMoP = (interface >= 50000) |
end |
--[[----------------------------------------------------------------------------- |
Support functions |
-------------------------------------------------------------------------------]] |
self.frame:SetScript("OnShow", OnShowFocus) |
end |
end, |
["HighlightText"] = function(self, from, to) |
self.editBox:HighlightText(from, to) |
end, |
["GetCursorPosition"] = function(self) |
return self.editBox:GetCursorPosition() |
end, |
label:SetText(ACCEPT) |
label:SetHeight(10) |
local button = CreateFrame("Button", ("%s%dButton"):format(Type, widgetNum), frame, wowMoP and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2") |
local button = CreateFrame("Button", ("%s%dButton"):format(Type, widgetNum), frame, "UIPanelButtonTemplate") |
button:SetPoint("BOTTOMLEFT", 0, 4) |
button:SetHeight(22) |
button:SetWidth(label:GetStringWidth() + 24) |
Slider Widget |
Graphical Slider, like, for Range values. |
-------------------------------------------------------------------------------]] |
local Type, Version = "Slider", 20 |
local Type, Version = "Slider", 21 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
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 |
end |
if newvalue ~= self.value and not self.disabled then |
self.value = newvalue |
self:Fire("OnValueChanged", newvalue) |
Keybinding Widget |
Set Keybindings in the Config UI. |
-------------------------------------------------------------------------------]] |
local Type, Version = "Keybinding", 24 |
local Type, Version = "Keybinding", 25 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: NOT_BOUND |
local wowMoP |
do |
local _, _, _, interface = GetBuildInfo() |
wowMoP = (interface >= 50000) |
end |
--[[----------------------------------------------------------------------------- |
Scripts |
-------------------------------------------------------------------------------]] |
local self = frame.obj |
if self.waitingForKey then |
frame:EnableKeyboard(false) |
frame:EnableMouseWheel(false) |
self.msgframe:Hide() |
frame:UnlockHighlight() |
self.waitingForKey = nil |
else |
frame:EnableKeyboard(true) |
frame:EnableMouseWheel(true) |
self.msgframe:Show() |
frame:LockHighlight() |
self.waitingForKey = true |
end |
frame:EnableKeyboard(false) |
frame:EnableMouseWheel(false) |
self.msgframe:Hide() |
frame:UnlockHighlight() |
self.waitingForKey = nil |
Keybinding_OnKeyDown(frame, button) |
end |
local function Keybinding_OnMouseWheel(frame, direction) |
local button |
if direction >= 0 then |
button = "MOUSEWHEELUP" |
else |
button = "MOUSEWHEELDOWN" |
end |
Keybinding_OnKeyDown(frame, button) |
end |
--[[----------------------------------------------------------------------------- |
Methods |
-------------------------------------------------------------------------------]] |
self.msgframe:Hide() |
self:SetDisabled(false) |
self.button:EnableKeyboard(false) |
self.button:EnableMouseWheel(false) |
end, |
-- ["OnRelease"] = nil, |
local name = "AceGUI30KeybindingButton" .. AceGUI:GetNextWidgetNum(Type) |
local frame = CreateFrame("Frame", nil, UIParent) |
local button = CreateFrame("Button", name, frame, wowMoP and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2") |
local button = CreateFrame("Button", name, frame, "UIPanelButtonTemplate") |
button:EnableMouse(true) |
button:EnableMouseWheel(false) |
button:RegisterForClicks("AnyDown") |
button:SetScript("OnEnter", Control_OnEnter) |
button:SetScript("OnLeave", Control_OnLeave) |
button:SetScript("OnClick", Keybinding_OnClick) |
button:SetScript("OnKeyDown", Keybinding_OnKeyDown) |
button:SetScript("OnMouseDown", Keybinding_OnMouseDown) |
button:SetScript("OnMouseWheel", Keybinding_OnMouseWheel) |
button:SetPoint("BOTTOMLEFT") |
button:SetPoint("BOTTOMRIGHT") |
button:SetHeight(24) |
local select, pairs, print = select, pairs, print |
-- WoW APIs |
local CreateFrame, UIParent, GetBuildInfo = CreateFrame, UIParent, GetBuildInfo |
local CreateFrame, UIParent = CreateFrame, UIParent |
--[[----------------------------------------------------------------------------- |
Scripts |
for method, func in pairs(methods) do |
widget[method] = func |
end |
-- SetText is deprecated, but keep it around for a while. (say, to WoW 4.0) |
if (select(4, GetBuildInfo()) < 40000) then |
widget.SetText = widget.SetLabel |
else |
widget.SetText = function(self, ...) print("AceGUI-3.0-Icon: SetText is deprecated! Use SetLabel instead!"); self:SetLabel(...) end |
end |
widget.SetText = function(self, ...) print("AceGUI-3.0-Icon: SetText is deprecated! Use SetLabel instead!"); self:SetLabel(...) end |
return AceGUI:RegisterAsWidget(widget) |
end |
BlizOptionsGroup Container |
Simple container widget for the integration of AceGUI into the Blizzard Interface Options |
-------------------------------------------------------------------------------]] |
local Type, Version = "BlizOptionsGroup", 20 |
local Type, Version = "BlizOptionsGroup", 21 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
frame.obj:Fire("cancel") |
end |
local function defaults(frame) |
frame.obj:Fire("defaults") |
local function default(frame) |
frame.obj:Fire("default") |
end |
local function refresh(frame) |
frame.obj:Fire("refresh") |
end |
--[[----------------------------------------------------------------------------- |
Methods |
-------------------------------------------------------------------------------]] |
-- support functions for the Blizzard Interface Options |
frame.okay = okay |
frame.cancel = cancel |
frame.defaults = defaults |
frame.default = default |
frame.refresh = refresh |
frame:SetScript("OnHide", OnHide) |
frame:SetScript("OnShow", OnShow) |
InlineGroup Container |
Simple container widget that creates a visible "box" with an optional title. |
-------------------------------------------------------------------------------]] |
local Type, Version = "InlineGroup", 20 |
local Type, Version = "InlineGroup", 21 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
["OnAcquire"] = function(self) |
self:SetWidth(300) |
self:SetHeight(100) |
self:SetTitle("") |
end, |
-- ["OnRelease"] = nil, |
--[[ $Id: AceGUIWidget-DropDown.lua 1029 2011-06-10 23:10:58Z nevcairiel $ ]]-- |
--[[ $Id: AceGUIWidget-DropDown.lua 1116 2014-10-12 08:15:46Z nevcairiel $ ]]-- |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
do |
local widgetType = "Dropdown" |
local widgetVersion = 25 |
local widgetVersion = 30 |
--[[ Static data ]]-- |
--[[ UI event handler ]]-- |
local function Control_OnEnter(this) |
this.obj.button:LockHighlight() |
this.obj:Fire("OnEnter") |
end |
local function Control_OnLeave(this) |
this.obj.button:UnlockHighlight() |
this.obj:Fire("OnLeave") |
end |
AceGUI:ClearFocus() |
else |
self.open = true |
self.pullout:SetWidth(self.frame:GetWidth()) |
self.pullout:SetWidth(self.pulloutWidth or self.frame:GetWidth()) |
self.pullout:Open("TOPLEFT", self.frame, "BOTTOMLEFT", 0, self.label:IsShown() and -2 or 0) |
AceGUI:SetFocus(self) |
end |
end |
self.open = true |
self:Fire("OnOpened") |
end |
local function OnPulloutClose(this) |
self:SetHeight(44) |
self:SetWidth(200) |
self:SetLabel() |
self:SetPulloutWidth(nil) |
end |
-- exported, AceGUI callback |
if disabled then |
self.text:SetTextColor(0.5,0.5,0.5) |
self.button:Disable() |
self.button_cover:Disable() |
self.label:SetTextColor(0.5,0.5,0.5) |
else |
self.button:Enable() |
self.button_cover:Enable() |
self.label:SetTextColor(1,.82,0) |
self.text:SetTextColor(1,1,1) |
end |
if text and text ~= "" then |
self.label:SetText(text) |
self.label:Show() |
self.dropdown:SetPoint("TOPLEFT",self.frame,"TOPLEFT",-15,-18) |
self:SetHeight(44) |
self.alignoffset = 30 |
self.dropdown:SetPoint("TOPLEFT",self.frame,"TOPLEFT",-15,-14) |
self:SetHeight(40) |
self.alignoffset = 26 |
else |
self.label:SetText("") |
self.label:Hide() |
return self.multiselect |
end |
local function SetPulloutWidth(self, width) |
self.pulloutWidth = width |
end |
--[[ Constructor ]]-- |
local function Constructor() |
self.GetMultiselect = GetMultiselect |
self.SetItemValue = SetItemValue |
self.SetItemDisabled = SetItemDisabled |
self.SetPulloutWidth = SetPulloutWidth |
self.alignoffset = 30 |
self.alignoffset = 26 |
frame:SetScript("OnHide",Dropdown_OnHide) |
button:SetScript("OnLeave",Control_OnLeave) |
button:SetScript("OnClick",Dropdown_TogglePullout) |
local button_cover = CreateFrame("BUTTON",nil,self.frame) |
self.button_cover = button_cover |
button_cover.obj = self |
button_cover:SetPoint("TOPLEFT",self.frame,"BOTTOMLEFT",0,25) |
button_cover:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT") |
button_cover:SetScript("OnEnter",Control_OnEnter) |
button_cover:SetScript("OnLeave",Control_OnLeave) |
button_cover:SetScript("OnClick",Dropdown_TogglePullout) |
local text = _G[dropdown:GetName() .. "Text"] |
self.text = text |
text.obj = self |
--[[----------------------------------------------------------------------------- |
EditBox Widget |
-------------------------------------------------------------------------------]] |
local Type, Version = "EditBox", 24 |
local Type, Version = "EditBox", 26 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
self:SetText(name) |
self:Fire("OnEnterPressed", name) |
ClearCursor() |
elseif type == "macro" then |
local name = GetMacroInfo(id) |
self:SetText(name) |
self:Fire("OnEnterPressed", name) |
ClearCursor() |
end |
HideButton(self) |
AceGUI:ClearFocus() |
if not self.frame:IsShown() then |
self.frame:SetScript("OnShow", Frame_OnShowFocus) |
end |
end, |
["HighlightText"] = function(self, from, to) |
self.editbox:HighlightText(from, to) |
end |
} |
ScrollFrame Container |
Plain container that scrolls its content and doesn't grow in height. |
-------------------------------------------------------------------------------]] |
local Type, Version = "ScrollFrame", 23 |
local Type, Version = "ScrollFrame", 24 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
local IsLegion = select(4, GetBuildInfo()) >= 70000 |
-- Lua APIs |
local pairs, assert, type = pairs, assert, type |
local min, max, floor, abs = math.min, math.max, math.floor, math.abs |
local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND") |
scrollbg:SetAllPoints(scrollbar) |
scrollbg:SetTexture(0, 0, 0, 0.4) |
if IsLegion then |
scrollbg:SetColorTexture(0, 0, 0, 0.4) |
else |
scrollbg:SetTexture(0, 0, 0, 0.4) |
end |
--Container Support |
local content = CreateFrame("Frame", nil, scrollframe) |
--[[ $Id: AceGUIWidget-DropDown-Items.lua 996 2010-12-01 18:34:17Z nevcairiel $ ]]-- |
--[[ $Id: AceGUIWidget-DropDown-Items.lua 1137 2016-05-15 10:57:36Z nevcairiel $ ]]-- |
local AceGUI = LibStub("AceGUI-3.0") |
local IsLegion = select(4, GetBuildInfo()) >= 70000 |
-- Lua APIs |
local select, assert = select, assert |
-- A single line to separate items |
do |
local widgetType = "Dropdown-Item-Separator" |
local widgetVersion = 1 |
local widgetVersion = 2 |
-- exported, override |
local function SetDisabled(self, disabled) |
local line = self.frame:CreateTexture(nil, "OVERLAY") |
line:SetHeight(1) |
line:SetTexture(.5, .5, .5) |
if IsLegion then |
line:SetColorTexture(.5, .5, .5) |
else |
line:SetTexture(.5, .5, .5) |
end |
line:SetPoint("LEFT", self.frame, "LEFT", 10, 0) |
line:SetPoint("RIGHT", self.frame, "RIGHT", -10, 0) |
Button Widget |
Graphical Button. |
-------------------------------------------------------------------------------]] |
local Type, Version = "Button", 22 |
local Type, Version = "Button", 23 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
local _G = _G |
local PlaySound, CreateFrame, UIParent = PlaySound, CreateFrame, UIParent |
local wowMoP |
do |
local _, _, _, interface = GetBuildInfo() |
wowMoP = (interface >= 50000) |
end |
--[[----------------------------------------------------------------------------- |
Scripts |
-------------------------------------------------------------------------------]] |
self:SetHeight(24) |
self:SetWidth(200) |
self:SetDisabled(false) |
self:SetAutoWidth(false) |
self:SetText() |
end, |
["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 |
-------------------------------------------------------------------------------]] |
local function Constructor() |
local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type) |
local frame = CreateFrame("Button", name, UIParent, wowMoP and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2") |
local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate") |
frame:Hide() |
frame:EnableMouse(true) |
TreeGroup Container |
Container that uses a tree control to switch between groups. |
-------------------------------------------------------------------------------]] |
local Type, Version = "TreeGroup", 34 |
local Type, Version = "TreeGroup", 40 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
local IsLegion = select(4, GetBuildInfo()) >= 70000 |
-- Lua APIs |
local next, pairs, ipairs, assert, type = next, pairs, ipairs, assert, type |
local math_min, math_max, floor = math.min, math.max, floor |
if self.enabletooltips then |
GameTooltip:SetOwner(frame, "ANCHOR_NONE") |
GameTooltip:SetPoint("LEFT",frame,"RIGHT") |
GameTooltip:SetText(frame.text:GetText() or "", 1, .82, 0, 1) |
GameTooltip:SetText(frame.text:GetText() or "", 1, .82, 0, true) |
GameTooltip:Show() |
end |
if frame.obj.noupdate then return end |
local self = frame.obj |
local status = self.status or self.localstatus |
status.scrollvalue = value |
status.scrollvalue = floor(value + 0.5) |
self:RefreshTree() |
AceGUI:ClearFocus() |
end |
["OnAcquire"] = function(self) |
self:SetTreeWidth(DEFAULT_TREE_WIDTH, DEFAULT_TREE_SIZABLE) |
self:EnableButtonTooltips(true) |
self.frame:SetScript("OnUpdate", FirstFrameUpdate) |
end, |
["OnRelease"] = function(self) |
button.toggle.button = button |
button.toggle:SetScript("OnClick",Expand_OnClick) |
button.text:SetHeight(14) -- Prevents text wrapping |
return button |
end, |
local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND") |
scrollbg:SetAllPoints(scrollbar) |
scrollbg:SetTexture(0,0,0,0.4) |
if IsLegion then |
scrollbg:SetColorTexture(0,0,0,0.4) |
else |
scrollbg:SetTexture(0,0,0,0.4) |
end |
local border = CreateFrame("Frame",nil,frame) |
border:SetPoint("TOPLEFT", treeframe, "TOPRIGHT") |
border:SetPoint("BOTTOMRIGHT") |
--[[----------------------------------------------------------------------------- |
ColorPicker Widget |
-------------------------------------------------------------------------------]] |
local Type, Version = "ColorPicker", 20 |
local Type, Version = "ColorPicker", 23 |
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) |
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end |
local IsLegion = select(4, GetBuildInfo()) >= 70000 |
-- Lua APIs |
local pairs = pairs |
local self = frame.obj |
if not self.disabled then |
ColorPickerFrame:SetFrameStrata("FULLSCREEN_DIALOG") |
ColorPickerFrame:SetFrameLevel(frame:GetFrameLevel() + 10) |
ColorPickerFrame:SetClampedToScreen(true) |
ColorPickerFrame.func = function() |
local r, g, b = ColorPickerFrame:GetColorRGB() |
local texture = frame:CreateTexture(nil, "BACKGROUND") |
texture:SetWidth(16) |
texture:SetHeight(16) |
texture:SetTexture(1, 1, 1) |
if IsLegion then |
texture:SetColorTexture(1, 1, 1) |
else |
texture:SetTexture(1, 1, 1) |
end |
texture:SetPoint("CENTER", colorSwatch) |
texture:Show() |
-- f:AddChild(btn) |
-- @class file |
-- @name AceGUI-3.0 |
-- @release $Id: AceGUI-3.0.lua 924 2010-05-13 15:12:20Z nevcairiel $ |
local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 33 |
-- @release $Id: AceGUI-3.0.lua 1102 2013-10-25 14:15:23Z nevcairiel $ |
local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 34 |
local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR) |
if not AceGUI then return end -- No upgrade needed |
end |
end) |
local layoutrecursionblock = nil |
local function safelayoutcall(object, func, ...) |
layoutrecursionblock = true |
object[func](object, ...) |
layoutrecursionblock = nil |
end |
AceGUI:RegisterLayout("Flow", |
function(content, children) |
if layoutrecursionblock then return end |
--used height so far |
local height = 0 |
--width used in the current row |
end |
if child.width == "fill" then |
child:SetWidth(width) |
safelayoutcall(child, "SetWidth", width) |
frame:SetPoint("RIGHT", content) |
usedwidth = 0 |
rowoffset = child.alignoffset or (rowheight / 2) |
rowstartoffset = rowoffset |
elseif child.width == "relative" then |
child:SetWidth(width * child.relWidth) |
safelayoutcall(child, "SetWidth", width * child.relWidth) |
if child.DoLayout then |
child:DoLayout() |
--- AceConfigDialog-3.0 generates AceGUI-3.0 based windows based on option tables. |
-- @class file |
-- @name AceConfigDialog-3.0 |
-- @release $Id: AceConfigDialog-3.0.lua 1049 2012-04-02 13:22:10Z mikk $ |
-- @release $Id: AceConfigDialog-3.0.lua 1139 2016-07-03 07:43:51Z nevcairiel $ |
local LibStub = LibStub |
local MAJOR, MINOR = "AceConfigDialog-3.0", 57 |
local MAJOR, MINOR = "AceConfigDialog-3.0", 61 |
local AceConfigDialog, oldminor = LibStub:NewLibrary(MAJOR, MINOR) |
if not AceConfigDialog then return end |
if descStyle and descStyle ~= "tooltip" then return end |
GameTooltip:SetText(name, 1, .82, 0, 1) |
GameTooltip:SetText(name, 1, .82, 0, true) |
if opt.type == "multiselect" then |
GameTooltip:AddLine(user.text,0.5, 0.5, 0.8, 1) |
GameTooltip:AddLine(user.text, 0.5, 0.5, 0.8, true) |
end |
if type(desc) == "string" then |
GameTooltip:AddLine(desc, 1, 1, 1, 1) |
GameTooltip:AddLine(desc, 1, 1, 1, true) |
end |
if type(usage) == "string" then |
GameTooltip:AddLine("Usage: "..usage, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1) |
GameTooltip:AddLine("Usage: "..usage, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, true) |
end |
GameTooltip:Show() |
t.text = message |
t.button1 = ACCEPT |
t.button2 = CANCEL |
t.preferredIndex = 3 |
t.preferredIndex = STATICPOPUP_NUMDIALOGS |
local dialog, oldstrata |
t.OnAccept = function() |
safecall(func, unpack(t)) |
local imageCoords = GetOptionsMemberValue("imageCoords",v, options, path, appName) |
local image, width, height = GetOptionsMemberValue("image",v, options, path, appName) |
if type(image) == "string" then |
if type(image) == "string" or type(image) == "number" then |
control = gui:Create("Icon") |
if not width then |
width = GetOptionsMemberValue("imageWidth",v, options, path, appName) |
local image = GetOptionsMemberValue("image", v, options, path, appName) |
local imageCoords = GetOptionsMemberValue("imageCoords", v, options, path, appName) |
if type(image) == "string" then |
if type(image) == "string" or type(image) == "number" then |
if type(imageCoords) == "table" then |
control:SetImage(image, unpack(imageCoords)) |
else |
local imageCoords = GetOptionsMemberValue("imageCoords",v, options, path, appName) |
local image, width, height = GetOptionsMemberValue("image",v, options, path, appName) |
if type(image) == "string" then |
if type(image) == "string" or type(image) == "number" then |
if not width then |
width = GetOptionsMemberValue("imageWidth",v, options, path, appName) |
end |
GameTooltip:SetPoint("LEFT",button,"RIGHT") |
end |
GameTooltip:SetText(name, 1, .82, 0, 1) |
GameTooltip:SetText(name, 1, .82, 0, true) |
if type(desc) == "string" then |
GameTooltip:AddLine(desc, 1, 1, 1, 1) |
GameTooltip:AddLine(desc, 1, 1, 1, true) |
end |
GameTooltip:Show() |
tinsert(path, (select(n, ...))) |
end |
local option = options |
if type(container) == "table" and container.type == "BlizOptionsGroup" and #path > 0 then |
for i = 1, #path do |
option = options.args[path[i]] |
end |
name = format("%s - %s", name, GetOptionsMemberValue("name", option, options, path, appName)) |
end |
--if a container is given feed into that |
if container then |
f = container |
-- :IterateOptionsTables() (and :GetOptionsTable() if only given one argument) return a function reference that the requesting config handling addon must call with valid "uiType", "uiName". |
-- @class file |
-- @name AceConfigRegistry-3.0 |
-- @release $Id: AceConfigRegistry-3.0.lua 1045 2011-12-09 17:58:40Z nevcairiel $ |
local MAJOR, MINOR = "AceConfigRegistry-3.0", 14 |
-- @release $Id: AceConfigRegistry-3.0.lua 1139 2016-07-03 07:43:51Z nevcairiel $ |
local MAJOR, MINOR = "AceConfigRegistry-3.0", 16 |
local AceConfigRegistry = LibStub:NewLibrary(MAJOR, MINOR) |
if not AceConfigRegistry then return end |
local ismethodtable={["table"]=true,["string"]=true,["function"]=true, _="methodname, funcref or table"} |
local optstring={["nil"]=true,["string"]=true, _="string"} |
local optstringfunc={["nil"]=true,["string"]=true,["function"]=true, _="string or funcref"} |
local optstringnumberfunc={["nil"]=true,["string"]=true,["number"]=true,["function"]=true, _="string, number or funcref"} |
local optnumber={["nil"]=true,["number"]=true, _="number"} |
local optmethod={["nil"]=true,["string"]=true,["function"]=true, _="methodname or funcref"} |
local optmethodfalse={["nil"]=true,["string"]=true,["function"]=true,["boolean"]={[false]=true}, _="methodname, funcref or false"} |
dialogHidden=optmethodbool, |
dropdownHidden=optmethodbool, |
cmdHidden=optmethodbool, |
icon=optstringfunc, |
icon=optstringnumberfunc, |
iconCoords=optmethodtable, |
handler=opttable, |
get=optmethodfalse, |
local typedkeys={ |
header={}, |
description={ |
image=optstringfunc, |
image=optstringnumberfunc, |
imageCoords=optmethodtable, |
imageHeight=optnumber, |
imageWidth=optnumber, |
childGroups=optstring, |
}, |
execute={ |
image=optstringfunc, |
image=optstringnumberfunc, |
imageCoords=optmethodtable, |
imageHeight=optnumber, |
imageWidth=optnumber, |
}, |
toggle={ |
tristate=optbool, |
image=optstringfunc, |
image=optstringnumberfunc, |
imageCoords=optmethodtable, |
}, |
tristate={ |
-- @param appName The application name as given to `:RegisterOptionsTable()` |
-- @param options The options table, OR a function reference that generates it on demand. \\ |
-- See the top of the page for info on arguments passed to such functions. |
function AceConfigRegistry:RegisterOptionsTable(appName, options) |
-- @param skipValidation Skip options table validation (primarily useful for extremely huge options, with a noticeable slowdown) |
function AceConfigRegistry:RegisterOptionsTable(appName, options, skipValidation) |
if type(options)=="table" then |
if options.type~="group" then -- quick sanity checker |
error(MAJOR..": RegisterOptionsTable(appName, options): 'options' - missing type='group' member in root group", 2) |
AceConfigRegistry.tables[appName] = function(uiType, uiName, errlvl) |
errlvl=(errlvl or 0)+1 |
validateGetterArgs(uiType, uiName, errlvl) |
if not AceConfigRegistry.validated[uiType][appName] then |
if not AceConfigRegistry.validated[uiType][appName] and not skipValidation then |
AceConfigRegistry:ValidateOptionsTable(options, appName, errlvl) -- upgradable |
AceConfigRegistry.validated[uiType][appName] = true |
end |
errlvl=(errlvl or 0)+1 |
validateGetterArgs(uiType, uiName, errlvl) |
local tab = assert(options(uiType, uiName, appName)) |
if not AceConfigRegistry.validated[uiType][appName] then |
if not AceConfigRegistry.validated[uiType][appName] and not skipValidation then |
AceConfigRegistry:ValidateOptionsTable(tab, appName, errlvl) -- upgradable |
AceConfigRegistry.validated[uiType][appName] = true |
end |
--[[ $Id: CallbackHandler-1.0.lua 965 2010-08-09 00:47:52Z mikk $ ]] |
--[[ $Id: CallbackHandler-1.0.lua 1131 2015-06-04 07:29:24Z nevcairiel $ ]] |
local MAJOR, MINOR = "CallbackHandler-1.0", 6 |
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR) |
-- UnregisterName - name of the callback unregistration API, default "UnregisterCallback" |
-- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API. |
function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName, OnUsed, OnUnused) |
-- TODO: Remove this after beta has gone out |
assert(not OnUsed and not OnUnused, "ACE-80: OnUsed/OnUnused are deprecated. Callbacks are now done to registry.OnUsed and registry.OnUnused") |
function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName) |
RegisterName = RegisterName or "RegisterCallback" |
UnregisterName = UnregisterName or "UnregisterCallback" |