/trunk/sStats/libs/AceConfig-3.0
-- :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 998 2010-12-01 18:39:53Z nevcairiel $ |
local MAJOR, MINOR = "AceConfigRegistry-3.0", 13 |
local AceConfigRegistry = LibStub:NewLibrary(MAJOR, MINOR) |
if not AceConfigRegistry then return end |
dropdownControl=optstring, |
}, |
color={ |
hasAlpha=optmethodbool, |
hasAlpha=optbool, |
}, |
keybinding={ |
-- TODO |
--- 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 998 2010-12-01 18:39:53Z nevcairiel $ |
local LibStub = LibStub |
local MAJOR, MINOR = "AceConfigDialog-3.0", 57 |
local MAJOR, MINOR = "AceConfigDialog-3.0", 54 |
local AceConfigDialog, oldminor = LibStub:NewLibrary(MAJOR, MINOR) |
if not AceConfigDialog then return end |
local reg = LibStub("AceConfigRegistry-3.0") |
-- Lua APIs |
local tconcat, tinsert, tsort, tremove, tsort = table.concat, table.insert, table.sort, table.remove, table.sort |
local tconcat, tinsert, tsort, tremove = table.concat, table.insert, table.sort, table.remove |
local strmatch, format = string.match, string.format |
local assert, loadstring, error = assert, loadstring, error |
local pairs, next, select, type, unpack, wipe, ipairs = pairs, next, select, type, unpack, wipe, ipairs |
local pairs, next, select, type, unpack, wipe = pairs, next, select, type, unpack, wipe |
local rawset, tostring, tonumber = rawset, tostring, tonumber |
local math_min, math_max, math_floor = math.min, math.max, math.floor |
t.text = message |
t.button1 = ACCEPT |
t.button2 = CANCEL |
t.preferredIndex = 3 |
local dialog, oldstrata |
t.OnAccept = function() |
safecall(func, unpack(t)) |
control.width = "fill" |
control:PauseLayout() |
local optionValue = GetOptionsMemberValue("get",v, options, path, appName) |
local t = {} |
local optionValue = GetOptionsMemberValue("get",v, options, path, appName, value) |
for value, text in pairs(values) do |
t[#t+1]=value |
end |
tsort(t) |
for k, value in ipairs(t) do |
local text = values[value] |
local radio = gui:Create("CheckBox") |
radio:SetLabel(text) |
radio:SetUserData("value", value) |
elseif v.type == "color" then |
control = gui:Create("ColorPicker") |
control:SetLabel(name) |
control:SetHasAlpha(GetOptionsMemberValue("hasAlpha",v, options, path, appName)) |
control:SetHasAlpha(v.hasAlpha) |
control:SetColor(GetOptionsMemberValue("get",v, options, path, appName)) |
control:SetCallback("OnValueChanged",ActivateControl) |
control:SetCallback("OnValueConfirmed",ActivateControl) |
--- AceConfigCmd-3.0 handles access to an options table through the "command line" interface via the ChatFrames. |
-- @class file |
-- @name AceConfigCmd-3.0 |
-- @release $Id: AceConfigCmd-3.0.lua 1045 2011-12-09 17:58:40Z nevcairiel $ |
-- @release $Id: AceConfigCmd-3.0.lua 904 2009-12-13 11:56:37Z nevcairiel $ |
--[[ |
AceConfigCmd-3.0 |
-- TODO: plugin args |
local MAJOR, MINOR = "AceConfigCmd-3.0", 13 |
local MAJOR, MINOR = "AceConfigCmd-3.0", 12 |
local AceConfigCmd = LibStub:NewLibrary(MAJOR, MINOR) |
if not AceConfigCmd then return end |
local r, g, b, a |
local hasAlpha = tab.hasAlpha |
if type(hasAlpha) == "function" or type(hasAlpha) == "string" then |
info.hasAlpha = hasAlpha |
hasAlpha = callmethod(info, inputpos, tab, 'hasAlpha') |
info.hasAlpha = nil |
end |
if hasAlpha then |
if tab.hasAlpha then |
if str:len() == 8 and str:find("^%x*$") then |
--parse a hex string |
r,g,b,a = tonumber(str:sub(1, 2), 16) / 255, tonumber(str:sub(3, 4), 16) / 255, tonumber(str:sub(5, 6), 16) / 255, tonumber(str:sub(7, 8), 16) / 255 |