m
Move page script moved page SecureActionButtonTemplate to WoW:SecureActionButtonTemplate without leaving a redirect
(→Other attributes: width) |
m (Move page script moved page SecureActionButtonTemplate to WoW:SecureActionButtonTemplate without leaving a redirect) |
||
| (3 intermediate revisions by 3 users not shown) | |||
| Line 12: | Line 12: | ||
</Attributes> | </Attributes> | ||
</Button> | </Button> | ||
'''Using Lua''': | '''Using Lua''': (Warning: the following code does nothing) | ||
local btn = CreateFrame("Button", "myButton", UIParent, "SecureActionButtonTemplate"); | local btn = CreateFrame("Button", "myButton", UIParent, "SecureActionButtonTemplate"); | ||
btn:SetAttribute("type", "action"); | btn:SetAttribute("type", "action"); | ||
| Line 18: | Line 18: | ||
== Modified attributes == | == Modified attributes == | ||
{| class="darktable | {| class="darktable" | ||
! Attribute !! Used on... | ! Attribute !! Used on... | ||
|- | |- | ||
| | | type || Any clicks. | ||
|- | |- | ||
| | | *type1 || Any left click. | ||
|- | |- | ||
| | | type1 || Unmodified left click. | ||
|- | |- | ||
| | | shift-type2 || Shift+right click. (But not Alt+Shift+right click) | ||
|- | |- | ||
| | | shift-type* || Shift+any button click. | ||
|- | |- | ||
| | | alt-ctrl-shift-type* || Alt+Control+Shift+any button click. | ||
|- | |- | ||
| <s>ctrl-alt-shift-type*</s> || Invalid, as modifiers are in the wrong order. | |||
|} | |} | ||
Some attribute may change value based on whether a particular combination of modifier keys is held down and/or a particular button is being clicked. Those attributes are typically called modified attributes, and are resolved by the SecureButton_GetModifiedAttribute function. | Some attribute may change value based on whether a particular combination of modifier keys is held down and/or a particular button is being clicked. Those attributes are typically called modified attributes, and are resolved by the SecureButton_GetModifiedAttribute function. | ||
| Line 70: | Line 71: | ||
== Action Types == | == Action Types == | ||
The action the SecureActionButtonTemplate-inheriting frame actually performs is dependent on the value of its ''modified'' type attribute, and possibly additional attributes specific to a type. | The action the SecureActionButtonTemplate-inheriting frame actually performs is dependent on the value of its ''modified'' type attribute, and possibly additional attributes specific to a type. | ||
The table below lists all valid type values and the attributes they use to perform their actions. All relevant attributes can be modified as previously described; and, to the extent possible, all types respect the "unit" attribute for targeting. Generally, variable names are used to refer to the value of the modified attribute sharing their name. | The table below lists all valid type values and the attributes they use to perform their actions. All relevant attributes can be modified as previously described; and, to the extent possible, all types respect the "unit" attribute for targeting. Generally, variable names are used to refer to the value of the modified attribute sharing their name. | ||
{| class="darktable" | {| class="darktable" | ||
|+ SecureActionButtonTemplate "type" attributes | |+SecureActionButtonTemplate "type" attributes | ||
|- | |||
! style="width: 8em" | Type | ! style="width: 8em" | Type | ||
! style="width: 8em" | Used attributes | ! style="width: 8em" | Used attributes | ||
| Line 83: | Line 85: | ||
| valign="top" | "action" | | valign="top" | "action" | ||
| Switches the current action bar depending on the value of the "action" attribute: | | Switches the current action bar depending on the value of the "action" attribute: | ||
* A number: switches to a the bar specified by the number. | * A number: switches to a the bar specified by the number. | ||
* "increment" or "decrement": move one bar up/down. | * "increment" or "decrement": move one bar up/down. | ||
| Line 91: | Line 94: | ||
| Performs an action specified by the "action" attribute (a number).<br /> | | Performs an action specified by the "action" attribute (a number).<br /> | ||
If the button:GetID() > 0, paging behavior is supported; see the ActionButton_CalculateAction FrameXML function. | If the button:GetID() > 0, paging behavior is supported; see the ActionButton_CalculateAction FrameXML function. | ||
|- | |- | ||
| valign="top" | "pet" | | valign="top" | "pet" | ||
| Line 111: | Line 110: | ||
|- | |- | ||
| valign="top" | "macro" | | valign="top" | "macro" | ||
| valign="top" | "macro" OR<br/>"macrotext" | | valign="top" | "macro" OR<br />"macrotext" | ||
| valign="top" | If "macro" attribute is specified, calls {{api|RunMacro}}(macro, button); otherwise, {{api|RunMacroText}}(macrotext, button); | | valign="top" | If "macro" attribute is specified, calls {{api|RunMacro}}(macro, button); otherwise, {{api|RunMacroText}}(macrotext, button); | ||
|- | |- | ||
| valign="top" | "cancelaura" | | valign="top" | "cancelaura" | ||
| valign="top" | "unit"<br />"index" OR<br />"spell"[, "rank"] | | valign="top" | "unit"<br />"index" OR<br />"spell"[, "rank"] | ||
| Calls either {{api|CancelUnitBuff}}(unit, index) or CancelUnitBuff(unit, spell, rank). The first version | | Calls either {{api|CancelUnitBuff}}(unit, index) or CancelUnitBuff(unit, spell, rank). The first version | ||
'''Note''': the value of the "index" attribute must resolve to nil/false for the "spell", "rank" attributes to be considered. | '''Note''': the value of the "index" attribute must resolve to nil/false for the "spell", "rank" attributes to be considered. | ||
|- | |- | ||
| Line 137: | Line 136: | ||
| valign="top" | "action", "unit" | | valign="top" | "action", "unit" | ||
| Performs a main assist status on the unit based on the value of the "action" attribute: | | Performs a main assist status on the unit based on the value of the "action" attribute: | ||
* nil or "set": the unit is assigned main assist status. ({{api|SetPartyAssignment}}) | * nil or "set": the unit is assigned main assist status. ({{api|SetPartyAssignment}}) | ||
* "clear": the unit is stripped main assist status. ({{api|ClearPartyAssignment}}) | * "clear": the unit is stripped main assist status. ({{api|ClearPartyAssignment}}) | ||
| Line 150: | Line 150: | ||
|- | |- | ||
| valign="top" | "attribute" | | valign="top" | "attribute" | ||
| valign="top" | ["attribute-frame",]<br /> "attribute-name"<br /> "attribute-value" | | valign="top" | ["attribute-frame",]<br />"attribute-name"<br />"attribute-value" | ||
| valign="top" | Calls frame:SetAttribute(attributeName, attributeValue). If "attribute-frame" is not specified, the button itself is assumed. | | valign="top" | Calls frame:SetAttribute(attributeName, attributeValue). If "attribute-frame" is not specified, the button itself is assumed. | ||
|- | |- | ||
| Line 156: | Line 156: | ||
| valign="top"| "_''type''" | | valign="top"| "_''type''" | ||
| Action depends on the value of the modified ("_" .. type) attribute, or rawget(button, type), in that order. | | Action depends on the value of the modified ("_" .. type) attribute, or rawget(button, type), in that order. | ||
* If the value is a function, it is called with (self, unit, button, actionType) arguments | * If the value is a function, it is called with (self, unit, button, actionType) arguments | ||
* If the value is a string, a restricted snippet stored in the attribute specified by the value on the button is executed as if it was OnClick. | * If the value is a string, a restricted snippet stored in the attribute specified by the value on the button is executed as if it was OnClick. | ||
| Line 172: | Line 173: | ||
! Function | ! Function | ||
|- | |- | ||
| valign="top" | "downbutton" | | valign="top" | "downbutton" | ||
| valign="top" | Any string | | valign="top" | Any string | ||
| Remaps the mouse button if this is a "down" click. This transformation is applied before all others. | | Remaps the mouse button if this is a "down" click. This transformation is applied before all others. | ||
|- | |- | ||
| valign="top" | "unitsuffix" | | valign="top" | "unitsuffix" | ||
| valign="top" | "pet", "target", etc. | | valign="top" | "pet", "target", etc. | ||
| Appends the attribute's value to the "unit" attribute value when resolving units. | | Appends the attribute's value to the "unit" attribute value when resolving units. | ||
| Line 183: | Line 184: | ||
| valign="top" | true, false | | valign="top" | true, false | ||
| When the unit's owner is in a vehicle, remap the pet to its owner, and its owner to its pet (the vehicle). Based on the original unit: | | When the unit's owner is in a vehicle, remap the pet to its owner, and its owner to its pet (the vehicle). Based on the original unit: | ||
* If it was a pet unit ("raidpetX", "pet", etc), and owner is in a vehicle, remap to owner. | * If it was a pet unit ("raidpetX", "pet", etc), and owner is in a vehicle, remap to owner. | ||
* If it did not contain "target", or "allowVehicleTarget" attribute is set to true, remap the original unit to its pet. | * If it did not contain "target", or "allowVehicleTarget" attribute is set to true, remap the original unit to its pet. | ||
|- | |- | ||
| valign="top" | "allowVehicleTarget" | | valign="top" | "allowVehicleTarget" | ||
| valign="top" | true, false | | valign="top" | true, false | ||
| If true, allows "toggleForVehicle" to remap units like "party1target" to "partypet1target". | | If true, allows "toggleForVehicle" to remap units like "party1target" to "partypet1target". | ||
|- | |- | ||
| valign="top" | "checkselfcast" | | valign="top" | "checkselfcast" | ||
| valign="top" | true, false | | valign="top" | true, false | ||
| If true, and the SELFCAST modifier is held down, resolves the unit to "player". | | If true, and the SELFCAST modifier is held down, resolves the unit to "player". | ||
|- | |- | ||
| valign="top" | "checkfocuscast" | | valign="top" | "checkfocuscast" | ||
| valign="top" | true, false | | valign="top" | true, false | ||
| If true, and the FOCUSCAST modifier is held down, resolves the unit to "focus". | | If true, and the FOCUSCAST modifier is held down, resolves the unit to "focus". | ||