/trunk/PhanxConfig-Dropdown
end |
local i = 0 |
function lib.CreateDropdown(parent, name, init) |
function lib.CreateDropdown(parent, name, init, desc) |
assert( type(parent) == "table" and parent.GetFrameType, "PhanxConfig-Button: Parent is not a valid frame!" ) |
if type(name) ~= "string" then name = nil end |
if type(desc) ~= "string" then desc = nil end |
i = i + 1 |
local frame = CreateFrame("Frame", nil, parent) |
frame:SetScript("OnLeave", OnLeave) |
frame:SetScript("OnHide", OnHide) |
frame.desc = desc |
local dropdown = CreateFrame("Frame", "PhanxConfigDropdown" .. i, frame) |
dropdown:SetPoint("TOPLEFT", frame, -16, -14) |
dropdown:SetPoint("TOPRIGHT", frame, 16, -14) |
frame.GetValue = GetValue |
frame.SetValue = SetValue |
if init then |
if type(init) == "function" then |
UIDropDownMenu_Initialize(dropdown, init) |
end |