Thread Tools Display Modes
Prev Previous Post   Next Post Next
06/04/15, 08:20 AM   #1
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,583
LibAddonMenu-2.0r18 preview

I am proud to announce r18 is (nearly) finished.
It has been in the works for a few weeks and I feel it is ready to be tested by other developers.
I tested it with many addons, but as LAM is the most used library I want to make sure there are really no problems that I might have missed.
This is where I need your feedback. If you are a developer or just use many addons, please try the new build and tell me if everything works as expected.

Preliminary Changelog
2.0 r18
- major overhaul of the addon menu style (thanks votan & merlight)
- NOTE: the menu is now a bit wider than before, if you created custom elements you might need to update them accordingly
- added search box to addon list
- new icon picker widget
- removed micro freeze when opening a menu with many options for the first time
- changed tooltip property to accept functions that return a string (thanks Ayantir)
- updated LibStub to r3 (support for '.' in minor version string, e.g. "17.5")

Icon Picker Widget
Here are some infos on how to use the new icon picker widget.

This new widget allows you to specify a list of texture paths which are then shown as icons in a custom dropdown element.
The options table takes a choices array like the dropdown widget. It also features a few optional parameters to control the dimensions.

Lua Code:
  1. iconpickerData = {
  2.     type = "iconpicker",
  3.     name = "My Icon Picker",
  4.     tooltip = "Color Picker's tooltip text.",
  5.     choices = {"texture path 1", "texture path 2", "texture path 3"},
  6.     choicesTooltips = {"icon tooltip 1", "icon tooltip 2", "icon tooltip 3"}, --(optional)
  7.     getFunc = function() return db.var end,
  8.     setFunc = function(var) db.var = var doStuff() end,
  9.     maxColumns = 5, --(optional) number of icons in one row
  10.     visibleRows = 4.5, --(optional) number of visible rows
  11.     iconSize = 28, --(optional) size of the icons
  12.     width = "full", --or "half" (optional)
  13.     beforeShow = function(control, iconPicker) return preventShow end, --(optional)
  14.     disabled = function() return db.someBooleanSetting end, --or boolean (optional)
  15.     warning = "Will need to reload the UI.",    --(optional)
  16.     default = defaults.var, --(optional)
  17.     reference = "MyAddonIconPicker" --(optional) unique global reference to control
  18. }

In order to allow for some features that are used in popular addons, there are also some additional functions that can be used to dynamically update the widget:
Lua Code:
  1. control:SetColor(ZO_ColorDef color) -- Sets the texture color of the displayed icons
  2. control:SetIconSize(number size) -- Changes the size of the icons. This also affects the row height of the addon menu.

To access them it is recommended to use the reference property which creates a global reference like with other UI elements.

Lua Code:
  1. iconpickerData = {
  2. ...
  3. reference ="MyIconPicker",
  4. ...
  5. }
  6.  
  7. local control= MyIconPicker
  8. control:SetColor(ZO_ColorDef:New(r, g, b, a))
  9. control:SetIconSize(size)

In order to change the settings of the dropdown, the beforeShow function can be used.
For example to implement custom mouseover behavior something like this can be done:
Lua Code:
  1. beforeShow = function(control, iconPicker)
  2.     iconPicker:SetMouseHandlers(function(icon)
  3.         control.label:SetText(icon.tooltip)
  4.         iconPicker:OnMouseEnter(icon)
  5.     end, function(icon)
  6.         control.label:SetText("Icon Picker Test")
  7.         iconPicker:OnMouseExit(icon)
  8.     end)
  9. end,

r18 is now released and can be downloaded from here.

Last edited by sirinsidiator : 06/14/15 at 01:30 PM. Reason: updated to r18
  Reply With Quote
 

ESOUI » Developer Discussions » General Authoring Discussion » LibAddonMenu-2.0r18 preview


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off