-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Simple dropdown menu widget generator for GUI configuration. Requires LibStub.
lib = LibStub("PhanxConfig-Dropdown")
Create a dropdown menu widget:
dropdown = lib:New(parentFrame, labelText[, tooltipText][, menuList][, keepShownOnClick])
-
parentFrame
- frame reference -
labelText
- string; text to be displayed on the color picker -
tooltipText
- string; text to be be displayed in a tooltip when moving the cursor over the color picker (optional) -
menuList
- table; a list of items to be shown in the dropdown menu (optional, may be set later) -
keepShownOnClick
- boolean: whether the menu should remain open when a menu item is clicked (optional, default isfalse
)
dropdown = lib.CreateDropdown(parentFrame, labelText[, tooltipText][, menuList][, keepShownOnClick])
Set a function to be run when a menu item is clicked:
dropdown.OnValueChanged = function(dropdown, value, text) ... end
Set a function to be run when a menu item is displayed:
dropdown.OnListButtonChanged = function(dropdown, button, item, selected) ... end
This may be used to, for example, display a list of available fonts with each item shown in the appropriate font.
Set a function to be run when the menu is requested, before it is displayed:
dropdown.PreUpdate = function(dropdown) ... end
Generally you would use this to update a dynamic list of values.
Set the list of items to be displayed by the menu:
dropdown:SetList(list)
The list
should be an indexed table of either simple string values, or table values containing EasyMenu-compatible key/value pairs. Currently only the text
, value
, selected
, and disabled
properties are supported.
Get the current list of items displayed by the menu:
list = dropdown:GetList()
Set whether the menu should remain open when a value is clicked:
dropdown:SetKeepShownOnClick(state)
Copyright © 2009–2014 Phanx. All rights reserved. You MAY distribute this library WITHOUT CHANGES inside addons that make use of it. You MAY NOT distribute this library by itself or with changes. You MAY use any or all of the source code from this library in your own library or addon, as long as you do not use the name of this library or the name of its author anywhere in your work outside of an optional attribution. See the comment header in the library file for more details.