mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-20 19:30:49 +00:00
gui: create new dropdown menus if required
This commit is contained in:
+19
-1
@@ -1,4 +1,16 @@
|
|||||||
pfUI:RegisterModule("gui", function ()
|
pfUI:RegisterModule("gui", function ()
|
||||||
|
local function PrepareDropDownButton(index)
|
||||||
|
if index > _G.UIDROPDOWNMENU_MAXBUTTONS then
|
||||||
|
for i=1,3 do
|
||||||
|
local name = "DropDownList" .. i .. "Button" .. index
|
||||||
|
local parent = _G["DropDownList" .. i]
|
||||||
|
_G.UIDROPDOWNMENU_MAXBUTTONS = index
|
||||||
|
_G[name] = CreateFrame("Button", name, parent, "UIDropDownMenuButtonTemplate")
|
||||||
|
_G[name]:SetID(index)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function CreateConfig(ufunc, parent, caption, category, config, widget, values, skip, named, type)
|
local function CreateConfig(ufunc, parent, caption, category, config, widget, values, skip, named, type)
|
||||||
-- parent object placement
|
-- parent object placement
|
||||||
if parent.objectCount == nil then
|
if parent.objectCount == nil then
|
||||||
@@ -258,6 +270,9 @@ pfUI:RegisterModule("gui", function ()
|
|||||||
UIDropDownMenu_Initialize(frame.input, function()
|
UIDropDownMenu_Initialize(frame.input, function()
|
||||||
local info = {}
|
local info = {}
|
||||||
for i, k in pairs(frame.input.values) do
|
for i, k in pairs(frame.input.values) do
|
||||||
|
-- create new dropdown buttons when we reach the limit
|
||||||
|
PrepareDropDownButton(i)
|
||||||
|
|
||||||
-- get human readable
|
-- get human readable
|
||||||
local value, text = strsplit(":", k)
|
local value, text = strsplit(":", k)
|
||||||
text = text or value
|
text = text or value
|
||||||
@@ -306,7 +321,10 @@ pfUI:RegisterModule("gui", function ()
|
|||||||
|
|
||||||
frame.input.Refresh = function()
|
frame.input.Refresh = function()
|
||||||
local function CreateValues()
|
local function CreateValues()
|
||||||
for _, val in pairs({strsplit("#", category[config])}) do
|
for i, val in pairs({strsplit("#", category[config])}) do
|
||||||
|
-- create new dropdown buttons when we reach the limit
|
||||||
|
PrepareDropDownButton(i)
|
||||||
|
|
||||||
UIDropDownMenu_AddButton({
|
UIDropDownMenu_AddButton({
|
||||||
["text"] = val,
|
["text"] = val,
|
||||||
["checked"] = false,
|
["checked"] = false,
|
||||||
|
|||||||
Reference in New Issue
Block a user