/trunk/PhanxConfig-Dropdown
Simple scrolling dropdown widget generator. |
Based on tekKonfig-Dropdown by Tekkub and OmniCC_Options by Tuller. |
Requires LibStub. |
https://github.com/phanx/PhanxConfigWidgets |
Copyright (c) 2009-2014 Phanx. All rights reserved. |
See the accompanying README and LICENSE files for more information. |
https://github.com/phanx/PhanxConfigWidgets |
----------------------------------------------------------------------]] |
local MINOR_VERSION = tonumber(strmatch("$Revision$", "%d+")) |
local MINOR_VERSION = 182 |
local lib, oldminor = LibStub:NewLibrary("PhanxConfig-Dropdown", MINOR_VERSION) |
if not lib then return end |
end |
function methods:SetValue(value, text) |
self.selected = value |
if not text and self.items and type(self.items[1]) == "table" then |
local found |
for i = 1, #self.items do |
local item = self.items[i] |
if type(item) == "table" and item.value == value then |
text = item.text |
found = true |
break |
end |
end |
if not found then |
text = CUSTOM |
end |
end |
self.valueText:SetText(text or value) |
end |
self.valueText:SetFontObject(GameFontDisableSmall) |
self.button:Disable() |
end |
function methods:SetEnabled(enable) |
if enable then |
self:Enable() |
else |
self:Disable() |
end |
end |
------------------------------------------------------------------------ |