Class factory

Class used to build lightweight widgets for configuration options.

You can obtain it calling GetFactory() method.

All widgets communicate with your code via the OnChange Callback and expose a SetOnChange method to set it

Usage:

    local addon=LibStub("LibInit"):newAddon("example")
    local factory=addon:GetFactory()
    local widget=factory:Checkbox(frame,true,"Checkbox","Checkbox tooltip")
    widget:SetOnChange(function(checked) end)
    --You can set a custom object so you can pass a method to SetOnChange:
    widget:SetObj(mytable)
    widget:SetOnChange("method")
    

Info:

  • Author: Alar of Runetotem

Methods

factory:Button (father, message[, tooltip[, maxwidth]]) Creates a buttom.
factory:Checkbox (father, current, message[, tooltip[, maxwidth]]) Creates a checkbox.
factory:DropDown (father, current, list, message[, tooltip[, maxwidth]]) Creates a dropdown menu.
factory:Option (addon, father, flag[, maxwidth]) Quickly defines a widget for a defined configuration variable All data for the widget are inferred for the variable
factory:Slider (father, min, max, current, message[, tooltip[, maxwidth]]) Creates a slider.


Methods

factory:Button (father, message[, tooltip[, maxwidth]])
Creates a buttom.

Parameters:

  • father frame Parent frame to use
  • message string or table String with description or table with .desc and .tooltip fields
  • tooltip string Tooltip message (ignored if message is a table. Can be a table for a multiline tooltip (optional)
  • maxwidth number maximum widget width (optional)

Returns:

    widget button widget object
factory:Checkbox (father, current, message[, tooltip[, maxwidth]])
Creates a checkbox.

Parameters:

  • father frame Parent frame to use
  • current bool Actual value
  • message string or table String with description or table with .desc and .tooltip fields
  • tooltip string Tooltip message (ignored if message is a table).Can be a table for a multiline tooltip (optional)
  • maxwidth number maximum widget width (optional)

Returns:

    widget checkbox widget object
factory:DropDown (father, current, list, message[, tooltip[, maxwidth]])
Creates a dropdown menu. Create a totally new frame in order to avoid taint

Parameters:

  • father frame Parent frame to use
  • current mixed Initial value
  • list tab Option list
  • message string or table String with description or table with .desc and .tooltip fields
  • tooltip string Tooltip message (ignored if message is a table). Can be a table for a multiline tooltip (optional)
  • maxwidth number maximum widget width (optional)

Returns:

    widget dropdown widget object
factory:Option (addon, father, flag[, maxwidth])
Quickly defines a widget for a defined configuration variable All data for the widget are inferred for the variable

Parameters:

  • addon table The addon wich defined the variable
  • father frame Parent frame to use
  • flag string name of the variable to use
  • maxwidth number maximum widget width (optional)
factory:Slider (father, min, max, current, message[, tooltip[, maxwidth]])
Creates a slider.

Parameters:

  • father frame Parent frame to use
  • min number Minimum value
  • max number Maximum value
  • current number Actual value
  • message string or table String with description or table with .desc and .tooltip fields
  • tooltip string Tooltip message (ignored if message is a table). Can be a table for a multiline tooltip (optional)
  • maxwidth number maximum widget width (optional)

Returns:

    widget slider widget object
generated by LDoc 1.4.6 Last updated 2020-10-17 18:33:04