WoWInterface SVN PhanxConfigWidgets

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk/PhanxConfig-Dropdown
    from Rev 6 to Rev 13
    Reverse comparison

Rev 6 → Rev 13

PhanxConfig-Dropdown.lua
1,23 → 1,24
--[[--------------------------------------------------------------------
PhanxConfig-Dropdown
Simple color picker widget generator. Requires LibStub.
Simple color picker widget generator.
Based on tekKonfig-Dropdown by Tekkub.
Requires LibStub.
----------------------------------------------------------------------]]
 
local lib, oldminor = LibStub:NewLibrary("PhanxConfig-Dropdown", 1)
local lib, oldminor = LibStub:NewLibrary("PhanxConfig-Dropdown", 3)
if not lib then return end
 
local function Frame_OnEnter(self)
if self.hint then
if self.desc then
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetText(self.hint, nil, nil, nil, nil, true)
GameTooltip:SetText(self.desc, nil, nil, nil, nil, true)
end
end
 
local function Button_OnEnter(self)
if self:GetParent().hint then
if self:GetParent().desc then
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetText(self.hint, nil, nil, nil, nil, true)
GameTooltip:SetText(self.desc, nil, nil, nil, nil, true)
end
end
 
34,8 → 35,17
CloseDropDownMenus()
end
 
local function GetValue(self)
return UIDropDownMenu_GetSelectedValue(self) or self.valueText:GetText()
end
 
local function SetValue(self, value, text)
self.valueText:SetText(text or value)
UIDropDownMenu_SetSelectedValue(self, value or "")
end
 
local i = 0
function lib.CreateDropdown(parent, name)
function lib.CreateDropdown(parent, name, init)
i = i + 1
 
local frame = CreateFrame("Frame", nil, parent)
94,14 → 104,21
 
button:SetNormalTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Up")
button:SetPushedTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Down")
button:SetDisabledTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Disabled")
button:SetHighlightTexture("Interface\\Buttons\\UI-Common-MouseHilight")
button:SetDisabledTexture("Interface\\ChatFrame\\UI-ChatIcon-ScrollDown-Disabled")
button:GetHighlightTexture():SetBlendMode("ADD")
 
dropdown.container = frame
dropdown.button = button
dropdown.label = label
dropdown.value = value
dropdown.valueText = value
 
dropdown.GetValue = GetValue
dropdown.SetValue = SetValue
 
if init then
UIDropDownMenu_Initialize(dropdown, init)
end
 
return dropdown
end
\ No newline at end of file