WoWInterface SVN PhanxConfigWidgets

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 166 to Rev 167
    Reverse comparison

Rev 166 → Rev 167

trunk/PhanxConfig-ScrollingDropdown/PhanxConfig-ScrollingDropdown.lua
143,6 → 143,15
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()
152,6 → 161,11
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
174,15 → 188,15
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
190,11 → 204,19
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()