/
return button |
end |
local emptyList = { |
{ |
text = GRAY_FONT_COLOR_CODE .. EMPTY, |
value = EMPTY, |
disabled = true, |
empty = true, |
} |
} |
local function UpdateList(self) |
local buttons = self.buttons |
local dropdown = self:GetParent() |
dropdown:PreUpdate(items) |
end |
if #items == 0 then |
--print("List is empty!") |
items = emptyList |
end |
local listSize = min(#items, MAX_LIST_SIZE) |
local scrollFrame = self.scrollFrame |
end |
local EXTRA_WIDTH = scrollFrame:IsShown() and 50 or 30 |
width = max(width + 27 + EXTRA_WIDTH, dropdown:GetWidth() + 10) |
self:SetWidth(width) |
self:SetHeight((listSize * UIDROPDOWNMENU_BUTTON_HEIGHT) + (UIDROPDOWNMENU_BORDER_HEIGHT * 2)) |
width = width - EXTRA_WIDTH |
self:SetHeight((listSize * UIDROPDOWNMENU_BUTTON_HEIGHT) + (UIDROPDOWNMENU_BORDER_HEIGHT * 2)) |
for i = 1, listSize do |
local index = i + offset |
local button = self.buttons[i] |
local button = buttons[i] |
local item = items[index] |
if item then |
if type(item) == "table" then |
button.value = item.value |
button:SetText(item.text or item.value) |
button.check:SetShown(item.selected or item.value == selected) |
if item.disabled then |
button.label:SetTextColor(GameFontDisable:GetTextColor()) |
else |
button.label:SetTextColor(GameFontHighlight:GetTextColor()) |
end |
--button:SetEnabled(not item.disabled) |
else |
--print(i, "string", item, "|", item == selected) |
button.value = item |
button:SetText(item) |
button.check:SetShown(item == selected) |
button.label:SetTextColor(GameFontHighlight:GetTextColor()) |
--button:SetEnabled(true) |
end |
button:SetWidth(width) |
button:Show() |