WowAce.com
Home
Addons
Authors
Forums
Knowledge base
Paste
Site issues
Sign in
ButtonFacade
Overview
Files
Tickets
Pages
Repository
Localization
Subscriptions
Donate
Curse
API/LibButtonFacade-1.0
r27
Source
Markup:
*
The proper way to access LibButtonFacade to allow optional support of Button Facade is to code similar to the following: <<code>>local LBF = LibStub("LibButtonFacade", true)<</code>> This allows you to test whether the library is loaded, and only use library functions if it is. Otherwise you would default to a normal system. In the rest of the documentation, that above code is assumed to already be in place. **Note:** It is imperative that you do NOT use ButtonFacade's module system to add support for your addon. Use the LibButtonFacade library. ---- == Callbacks == === :ElementListCallback(callback, arg) === Registers a callback that is called whenever a new Button Group is created. Generally, this is only used by ButtonFacade itself. ==== Args ==== ; callback : ''function'' : The function to be called. ; arg : ''any'' : The first parameter to be passed to the callback function. ==== Remarks ==== The callback is called as: <<code>>callback(arg,Addon,Group)<</code>> Where Addon and Group are the group identifiers of the group that gained a new sub-group. ==== Example ==== <<code>>local LBF = LibStub("LibButtonFacade",true) LBF:ElementListCallback(self.BFGroupCallback,self)<</code>> === :RegisterSkinCallback("AddonID", callback, arg) === Registers a callback that is called whenever a group using the given AddonID has its skin changed. This is allows action bar add-ons to save the changed skin parameters in its Saved Variables. ==== Args ==== ; "AddonID" : ''string'' : The AddonID you wish to listen for. This prevents one action bar add-on from receiving notices about other add-on's buttons. ; callback : ''function'' : The function to be called. ; arg : ''any'' : The first parameter to be passed to the callback function. ==== Remarks ==== The callback is called as: <<code>>callback(arg, SkinID, Gloss, Backdrop, Group, Button, Colors)<</code>> Where SkinID, Gloss, Backdrop, and Colors are the Skin Parameters and Group and Button are the remaining identifiers of the group that has changed. Colors comes last in the list for historical/backwards compatibility reasons. ==== Example ==== <<code>>local LBF = LibStub("LibButtonFacade", true) LBF:RegisterSkinCallback("MonkeyBar", self.SkinChanged, self)<</code>> == Skins == === :AddSkin("SkinID", definition[, overwrite]) === Registers a new skin with Button Facade. ==== Args ==== ; "SkinID" : ''string'' : The name of the skin. ; definition : ''table'' : The definition table for the new skin. ; [overwrite] : ''false (default)'' : If a skin already exists by the given name, this will fail without an error. : ''any other type'' : This will overwrite with the new data. ==== Remarks ==== For details on the format of the definition table, see... ==== Example ==== <<code>>local LBF = LibStub("LibButtonFacade", true) LBF:AddSkin("MySkin", MySkinDefinition)<</code>> === :ListSkins() === Returns a list of skins in a format usable by Ace3 and Rock drop-down configuration fields. ==== Returns ==== ; table : A list of skins in a table with keys and values equal to the name of the skin. ==== Example ==== <<code>>local LBF = LibStub("LibButtonFacade", true) LBF:ListSkins()<</code>> == Special Functions == === :SetNormalVertexColor(button, r, g, b, a) === Sets the color of the Normal layer (after factoring in a skin's color specification). Use this instead of :GetNormalTexture():SetVertexColor(r, g, b, a). ==== Args ==== ; button : ''Button Frame'' : The Button to apply the new Normal layer color to. ; r : ''number'' : The red component of the new color. Defaults to 1. ; g : ''number'' : The green component of the new color. Defaults to 1. ; b : : ''number'' : The blue component of the new color. Defaults to 1. ; a : : ''number'' : The alpha component of the new color. Defaults to 1. ==== Example ==== <<code>>local LBF = LibStub("LibButtonFacade", true) LBF:SetNormalVertexColor(myMonkeyButton, 1, 0, 0)<</code>> === :GetNormalVertexColor(button) === Returns the color of the Normal layer (after factoring out a skin's color specification). Use this instead of :GetNormalTexture():GetVertexColor(). ==== Args ==== ; button : ''Button Frame'' : The Button to retrieve the current Normal layer color of. ==== Returns ==== ; r, g, b, a : The color components of the current color. ==== Example ==== <<code>>local LBF = LibStub("LibButtonFacade", true) r,g,b = LBF:GetNormalVertexColor(myMonkeyButton)<</code>> === :GetGlossLayer(button) === Returns the Gloss layer, or nil if there is none. ==== Args ==== ; button : ''Button Frame'' : The Button to retrieve the current Gloss layer of. ==== Returns ==== ; texture : The Gloss layer of the given button, or nil. ==== Example ==== <<code>>local LBF = LibStub("LibButtonFacade", true) gloss = LBF:GetGlossLayer(myMonkeyButton)<</code>> === :GetBackdropLayer(button) === Returns the Backdrop layer, or nil if there is none. ==== Args ==== ; button : ''Button Frame'' : The Button to retrieve the current Backdrop layer of. ==== Returns ==== ; texture : The Backdrop layer of the given button, or nil. ==== Example ==== <<code>>local LBF = LibStub("LibButtonFacade", true) gloss = LBF:GetBackdropLayer(myMonkeyButton)<</code>> == Button Groups == === :Group("Addon"[, "Group"[, "Button"]]) === Returns the group specified by the parameters. Will create new groups as needed. ==== Args ==== ; "Addon" : ''string'' : The name the Actionbar addon wishes to identify itself as. ; ["Group"] : ''string'' : The name of the Group level sub-group. : ''nil'' : If this is nil, "Button" must also be nil, and :Group will return just the group for the entire addon. ; ["Button"] : ''string'' : The name of the third level sub-group. : ''nil'' : If this is nil :Group will return just the group for the Group level sub-group. ==== Returns ==== ;LBFGroup : LBFGroups have their own API for setting their skin and adding buttons to the group. ==== Example ==== <<code>>local LBF = LibStub("LibButtonFacade",true) LBF:Group("MonkeyBar", "MonkeyBar1")<</code>> === :DeleteGroup("Addon"[, "Group"[, "Button"]]) === Deletes the specified group. If a group doesn't exist with the given parameters, this function simply returns. ==== Args ==== ; "Addon" : ''string'' : The name the Addon level group. ; ["Group"] : ''string'' : The name of the Group level sub-group. : ''nil'' : If this is nil, "Button" must also be nil and :DeleteGroup will delete just the group for the entire addon. ; ["Button"] : ''string'' : The name of the third level sub-group. : ''nil'' : If this is nil :DeleteGroup will delete just the group for the Group level sub-group. ==== Remarks ==== One can instead call the :Delete() method on an existing LBFGroup table. ==== Example ==== <<code>>local LBF = LibStub("LibButtonFacade", true) self:DeleteGroup("MonkeyBar", "MonkeyBar1")<</code>> === :ListAddons() === Gives a list of the names of Addon groups, suitable for use in an Ace3 or Rock dropdown field. ==== Returns ==== ; table : A table of key value pairs where the value is the name of the Addon. ==== Remarks ==== The key of these tables is a unique internal value and should not be used with any of the API functions. ==== Example ==== <<code>>local LBF = LibStub("LibButtonFacade", true) LBF:ListAddons()<</code>> === :ListGroups("Addon") === Gives a list of the names of sub-groups of the Addon group, suitable for use in an Ace3 or Rock drop-down field. ==== Args ==== ; "Addon" : ''string'' : The name the Addon level group. ==== Returns ==== ; table : A table of key value pairs where the value is the name of the Group. ==== Remarks ==== The key of these tables is a unique internal value and should not be used with any of the API functions. ==== Example ==== <<code>>local LBF = LibStub("LibButtonFacade", true) LBF:ListGroups("MonkeyBar")<</code>> === :ListButtons("Addon","Group") === Gives a list of the names of sub-groups of the given Group, suitable for use in an Ace3 or Rock dropdown field. ==== Args ==== ; "Addon" : ''string'' : The name the Addon level group. ; "Group" : ''string'' : The name of the Group level sub-group. ==== Returns ==== ;table : A table of key value pairs where the value is the name of the Button level group. ==== Remarks ==== The key of these tables is a unique internal value and should not be used with any of the API functions. ==== Example ==== <<code>>local LBF = LibStub("LibButtonFacade",true) LBF:ListAddons("MonkeyBar","MonkeyBar1")<</code>> === <LBFGroup>:AddButton(button[, buttondata]) === Adds the provided button to the group and immediately skins it. ==== Args ==== ; button : ''Button Frame'' : The Frame (of type Button or CheckButton) to be skinned with this group. ; [buttondata] : ''table'' : A table providing custom frames and textures to have ButtonFacade skin instead of trying to find them on its own. ==== Remarks ==== The following are valid keys to use in buttondata: :* Icon :* Border (Note this is what Blizzard uses to display the equipped item glow.) :* Flash :* Cooldown :* AutoCast :* AutoCastable :* Normal - defaults to button:GetNormalTexture() or a skin specified alternative. :* Pushed - defaults to button:GetPushedTexture() :* Disabled - defaults to button:GetDisabledTexture() :* Checked - defaults to button:GetCheckedTexture() :* Highlight - defaults to button:GetHighlightTexture() :* HotKey :* Count :* Name ==== Example ==== <<code>>local group = LBF:Group("MonkeyBar","MonkeyBar1") group:AddButton(myMonkeyButton)<</code>> === <LBFGroup>:RemoveButton(button[, noReskin]) === Removes the provided button from the group and will reskin it to the Blizzard skin if noReskin is not true. ==== Args ==== ; button : ''Button Frame'' : The Frame to be removed from the group. ; [noReskin] : ''boolean'' : When set to true, the button will not be reskinned with the Blizzard skin. Useful if you intend to add it immediately to a different group. ==== Example ==== <<code>>local group = LBF:Group("MonkeyBar", "MonkeyBar1") group:RemoveButton(myMonkeyButton)<</code>> === <LBFGroup>:Skin("SkinID", Gloss, Backdrop) === Sets the skin used by the buttons in this group, as well as its sub-groups. ==== Args ==== ; "SkinID" : ''string'' : The identifier of the skin to use. If the skin does not exist, it will default to "Blizzard". ; Gloss : ''number'' : Sets the alpha of the Gloss layer. At 0, the Gloss layer is completely hidden, at 1 it is fully visible. : ''nil or false'' : Identical to using 0. : ''true'' :Identical to using 1. ; Backdrop : ''boolean'' Makes the backdrop visible if this is a true value. Hides it otherwise. ==== Remarks ==== This stores the chosen skin parameters, so buttons added to the skin afterward are automatically skinned with the new values. ==== Example ==== <<code>>local group = LBF:Group("MonkeyBar", "MonkeyBar1") group:Skin("DreamLayout", 0, true)<</code>> === <LBFGroup>:Delete([noReskin]) === Deletes the button group. ==== Args ==== ; [noReskin] : ''boolean'' : If noReskin is not a true value, will reskin the group's buttons to the Blizzard skin. ==== Remarks ==== Renaming a button group is done by deleting the old one with noReskin set to true, then creating the new group, setting the skin parameters, and adding the buttons into the new group. ==== Example ==== <<code>>local group = LBF:Group("MonkeyBar","MonkeyBar1") group:Delete()<</code>> === <LBFGroup>.SkinID === ;string : The SkinID of the group's current skin parameters. ==== Example ==== <<code>>local group = LBF:Group("MonkeyBar", "MonkeyBar1") db.mygroupskin = group.SkinID<</code>> === <LBFGroup>.Gloss === ; string : The Gloss of the group's current skin parameters. ==== Example ==== <<code>>local group = LBF:Group("MonkeyBar", "MonkeyBar1") db.mygroupgloss = group.Gloss<</code>> === <LBFGroup>.Backdrop === ;string : The Backdrop of the group's current skin parameters. ==== Example ==== <<code>>local group = LBF:Group("MonkeyBar", "MonkeyBar1") db.mygroupbackdrop = group.Backdrop<</code>>
Markup Type:
*
The type of markup for this entry.
Click here for details
.
WikiCreole
BBCode
Safe HTML
Plain Text
Markdown
Textile
Curse Wiki (Deprecated)