Masque

API / Masque

Masque provides a library-style interface through LibStub.


Example

local MSQ = LibStub("Masque")

The above code would return a local copy of Masque's API object. This local copy could then be used to add a new button skin or to interact with a button group object. For information on the Group API, please see this page.


Methods

The following is a list of methods available to Masque's API. The examples provided assume that the API object has already been created, as in the introduction example.


:AddSkin("SkinID", {SkinData} [, Replace])

Adds a skin to Masque.

Parameters

SkinID
string, required
The name of the skin.
SkinData
table, required
The table containing the skin data.
[Replace]
boolean, optional
Whether or not to replace a skin of the same name.

Example

MSQ:AddSkin("MySkin", {
   -- Skin settings here.
}, true)


:GetSkin("SkinID")

Returns the specified skin.

Parameters

SkinID
string, required
The name of the skin.

Example

local Skin = MSQ:GetSkin("MySkin")


:GetSkins()

Returns the table of skins.

Example

local Skins = MSQ:GetSkins()


:Group("Addon" [, "Group"])

Creates and/or returns a button group, allowing access to the Group API.

Parameters

Addon
string, required
Name of the add-on.
[Group]
string, optional
Name of the sub-group.

Example

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


:GetNormal({Button})

Returns the Normal texture object of the Button passed.

Parameters

Button
table, required
The button object to retrieve the Normal texture object of.

Note: In most cases, Masque creates a new Normal texture object to bypass some of the game's built-in button state changes. This method will allow access the texture object that's currently in use.

Example

local Normal = MSQ:GetNormal(MyButton)


:GetBackdrop({Button})

Returns the Backdrop texture object of the Button passed.

Parameters

Button
table, required
The button object to retrieve the Backdrop texture object of.

Note: Masque creates a custom Backdrop texture object for Backdrop-enabled skins. This method will allow access to the texture object.

Example

local Backdrop = MSQ:GetBackdrop(MyButton)


:GetGloss({Button})

Returns the Gloss texture object of the Button passed.

Parameters

Button
table, required
The button object to retrieve the Gloss texture object of.

Note: Masque creates a custom Gloss texture object for Gloss-enabled skins. This method will allow access to the texture object.

Example

local Gloss = MSQ:GetGloss(MyButton)


:AddSpellAlert("Shape", "Glow", "Ants")

Adds a spell alert texture set to the cache.

Parameters

Shape
string, required
The name of the shape to be associated with the given textures.
Glow
string, required
The path to the texture used for the "glow" objects.
Ants
string, required
The path to the texture used for the "ants" animation.

Example

local glow = "Path\\To\\Glow\\Texture"
local ants = "Path\\To\\Ants\\Texture"
MSQ:AddSpellAlert("MyShape", glow, ants)


:GetSpellAlert("Shape")

Returns the paths to the textures associated with the given shape.

Parameters

Shape
string, required
The name of the shape to return the texture paths for.

Example

local glow, ants = MSQ:GetSpellAlert("MyShape")


:Register("Addon", Callback, arg)

Registers an add-on to receive notifications when its skin is changed.

Parameters

"Addon"
string, required
The name of the add-on being registered.
Callback
function, required
The method to be called when an add-on's skin has changed.
arg
table, required
The add-on object that the method is a child of.

Example

function myObj:myFunc(...)
	-- Do stuff
end

MSQ:Register("MyAddon", myFunc, myObj)