Masque

API / Groups

Masque's Button Group API allows add-on authors to skin their button objects by creating groups and then adding buttons to those groups.


Getting Started

In order to access the methods for the button group API, one first needs to get a local copy of the group that they wish to add buttons to. For the examples in this documentation, we will assume that we already have a local copy of the group as shown in the example below.

Example

local myGroup = MSQ:Group("MyAddon", "MyGroup")


Methods

The following is a list of methods available to the Group API.


:AddButton({Button} [, {ButtonData}])

Adds a button to the group.

Parameters

Button
table, required
The button object to be added to the group.
[ButtonData]
table, optional
The table containing the button data.

Example

myGroup:AddButton(MyButton1, {...})

Note: The ButtonData parameter is only optional if the button uses a standard template and is registered in the global name space. When using non-standard buttons, the button's layers must be passed via the ButtonData table. See the ButtonData documentation for more information.


:RemoveButton({Button})

Removes a button from the group.

Parameters

Button
table, required
The button object to be removed from the group.

Example

myGroup:RemoveButton(MyButton1)


:Delete()

Removes the group, its child groups and buttons from Masque.

Example

myGroup:Delete()


:ReSkin()

Re-skins a group. This can be called after an add-on makes a change that interferes with a skin's settings.

Example

myGroup:ReSkin()

Note: This does not re-skin any sub-groups.


:GetLayer({Button}, "Layer")

Returns the specified layer associated with Button.

Parameters

Button
table, required
The button object to get the layer of.
Layer
string, required
The button layer to get.

Example

local Highlight = myGroup:GetLayer(MyButton1, "Highlight")

Note: This method will not work with the Backdrop, Normal or Gloss layers. Use Masque API methods for those layers.


:GetColor("Layer")

Returns a set of color values for the specified layer.

Parameters

Layer
string, required
The layer to get the color of.

Example

local r, g, b, a = myGroup:GetColor("Highlight")