/
end |
end |
function lib.CreateCheckbox(parent, text, desc, size) |
function lib.CreateCheckbox(parent, text, desc) |
assert( type(parent) == "table" and parent.GetFrameType, "PhanxConfig-Checkbox: Parent is not a valid frame!" ) |
if type(name) ~= "string" then name = nil end |
if type(desc) ~= "string" then desc = nil end |
local check = CreateFrame("CheckButton", nil, parent) |
check:SetWidth(size or 26) |
check:SetHeight(size or 26) |
check:SetWidth(26) |
check:SetHeight(26) |
check:SetNormalTexture("Interface\\Buttons\\UI-CheckBox-Up") |
check:SetPushedTexture("Interface\\Buttons\\UI-CheckBox-Down") |
if not lib then return end |
function lib.CreateHeader( parent, titleText, notesText, noPrefix ) |
assert( type(parent) == "table" and parent.GetFrameType, "PhanxConfig-Header: Parent is not a valid frame!" ) |
if type(titleText) ~= "string" then name = nil end |
if type(notesText) ~= "string" then desc = nil end |
if not titleText then |
titleText = parent.name |
end |
self.dropdown.selected = value |
end |
function lib.CreateScrollingDropdown(parent, name, items) |
local container = PhanxConfigDropdown.CreateDropdown(parent, name) |
function lib.CreateScrollingDropdown(parent, name, items, desc) |
assert( type(parent) == "table" and parent.GetFrameType, "PhanxConfig-ScrollingDropdown: Parent is not a valid frame!" ) |
if type(name) ~= "string" then name = nil end |
if type(desc) ~= "string" then desc = nil end |
local container = PhanxConfigDropdown.CreateDropdown(parent, name, nil, desc) |
if type(items) == "table" then |
container.button:SetScript("OnClick", DropdownButton_OnClick) |
container.dropdown.items = items |
end |
function lib.CreateButton( parent, name, desc ) |
assert( type(parent) == "table" and parent.GetFrameType, "PhanxConfig-Button: Parent is not a valid frame!" ) |
if type(name) ~= "string" then name = nil end |
if type(desc) ~= "string" then desc = nil end |
local button = CreateFrame( "Button", nil, parent ) |
button:SetNormalFontObject( GameFontNormalSmall ) |
end |
function lib.CreateOptionsPanel( name, parent, construct, refresh ) |
if type( name ) ~= "string" then return end |
assert( type( name ) == "string", "PhanxConfig-OptionsPanel: Name is not a string!" ) |
if type( parent ) ~= "string" then parent = nil end |
if type( construct ) ~= "function" then construct = nil end |
if type( refresh ) ~= "function" then refresh = nil end |
end |
end |
function lib.CreateColorPicker(parent, name) |
function lib.CreateColorPicker(parent, name, desc) |
assert( type(parent) == "table" and parent.GetFrameType, "PhanxConfig-ColorPicker: Parent is not a valid frame!" ) |
if type(name) ~= "string" then name = nil end |
if type(desc) ~= "string" then desc = nil end |
local frame = CreateFrame("Button", nil, parent) |
frame:SetHeight(19) |
frame:SetScript("OnEnter", OnEnter) |
frame:SetScript("OnLeave", OnLeave) |
frame.desc = desc |
return frame |
end |
local i = 0 |
function lib.CreateDropdown(parent, name, init, desc) |
assert( type(parent) == "table" and parent.GetFrameType, "PhanxConfig-Button: Parent is not a valid frame!" ) |
if type(name) ~= "string" then name = nil end |
if type(desc) ~= "string" then desc = nil end |
i = i + 1 |
local frame = CreateFrame("Frame", nil, parent) |
frame.GetValue = GetValue |
frame.SetValue = SetValue |
if init then |
if type(init) == "function" then |
UIDropDownMenu_Initialize(dropdown, init) |
end |
## Interface: 40000 |
## Version: 4.0.3.wowi:revision |
## Version: 4.0.6.wowi:revision |
## Title: |cffffcc00Lib:|r PhanxConfigWidgets |
## Notes: Simple GUI configuration widgets. |
## Author: Phanx |
## X-Email: addons@phanx.net |
## Dependencies: LibStub |
## OptionalDependencies: LibStub |
PhanxConfig-Button\PhanxConfig-Button.lua |
PhanxConfig-Checkbox\PhanxConfig-Checkbox.lua |
PhanxConfig-ColorPicker\PhanxConfig-ColorPicker.lua |
PhanxConfig-Dropdown\PhanxConfig-Dropdown.lua |
PhanxConfig-EditBox\PhanxConfig-EditBox.lua |
PhanxConfig-Header\PhanxConfig-Header.lua |
PhanxConfig-OptionsPanel\PhanxConfig-OptionsPanel.lua |
PhanxConfig-Panel\PhanxConfig-Panel.lua |
PhanxConfig-ScrollingDropdown\PhanxConfig-ScrollingDropdown.lua |
PhanxConfig-Slider\PhanxConfig-Slider.lua |
end |
function lib.CreateEditBox( parent, name, desc, maxLetters ) |
assert( type(parent) == "table" and parent.GetFrameType, "PhanxConfig-EditBox: Parent is not a valid frame!" ) |
if type(name) ~= "string" then name = nil end |
if type(desc) ~= "string" then desc = nil end |
if type(maxLetters) ~= "number" then maxLetters = nil end |
local frame = CreateFrame( "Frame", nil, parent ) |
frame:SetWidth( 144 ) |
frame:SetHeight( 42 ) |
} |
function lib.CreatePanel(parent, width, height) |
assert( type(parent) == "table" and parent.GetFrameType, "PhanxConfig-Panel: Parent is not a valid frame!" ) |
local frame = CreateFrame("Frame", nil, parent) |
frame:SetFrameStrata(parent:GetFrameStrata()) |
frame:SetFrameLevel(parent:GetFrameLevel() + 1) |
} |
function lib.CreateSlider(parent, name, lowvalue, highvalue, valuestep, percent, desc) |
assert( type(parent) == "table" and parent.GetFrameType, "PhanxConfig-Slider: Parent is not a valid frame!" ) |
if type(name) ~= "string" then name = nil end |
if type(desc) ~= "string" then desc = nil end |
if type(lowvalue) ~= "number" then lowvalue = 0 end |
if type(highvalue) ~= "number" then highvalue = 100 end |
local frame = CreateFrame("Frame", nil, parent) |
frame:SetWidth(144) |
frame:SetHeight(42) |