- Home
- Downloads
-
Addons & Mods
Featured
World of Warcraft
6,111 Addons
-
Popular Downloads
- Top World of Warcraft Addons
- Top Minecraft Server Mods
- Top Rift Addons
- Top Skyrim Mods
- Top World of Tanks Skins
- Top StarCraft II Maps
- Top Terraria Maps
- Top Runes of Magic Addons
- Top Warhammer Online Addons
- Top The Secret World Mods
- Top Age of Conan Addons
-
- Curse Client
- Premium
- News
- Giveaways
- Forums
- Store
LibAddonButton
- 0 Likes
- Warhammer Online
- 38 Monthly Downloads
- Supports: 1.4.0
- 5,958 Total Downloads
- Updated 11/19/2010
- Created 09/13/2010
- 6 Favorites
- Project Site
- Comments
- Release Type: Release
- License: GNU General Public License version 3 (GPLv3)
- Newest File: 1.0.6
About LibAddonButton
Description
Intended for addons with a GUI but only accessible by slash commands, LibAddonButton can be used to create buttons that house menus to display various addons. The button can me moved by dragging it, locked/unlocked by right-clicking it and the menu can be accessed by left-clicking it. New buttons will be automatically unlocked on their first use.
By default, all first level menu items are sorted alphabetically and all sub menu items are displayed in the order they were added.
Registering a button
LibAddonButton.Register("uniqeName", buttonWidth, buttonHeight, "DefaultTexture", "HighlightTexture", "PressedTexture")
By default, if the "PressedTexture" or "HighlightTexture" is left blank, then "DefaultTexture" will be used. If they are all left blank, the default animated gear button will be used.
A texture can be a simple string that is the name of a texture, or an animation. The format of an animation is:
local animation =
{
FPS = 10, -- display 1 frame every 0.1 seconds
Frames = -- this must be an index-based array from 1 to n
{
"FrameTexture1", "FrameTexture2", "FrameTexture3"
}
}
Adding a menu item
LibAddonButton.AddMenuItem("uniqeName", L"label text", callbackFunction)
The callbackFunction will be called when a menu item is clicked.
Adding a cascading menu item
local menu = LibAddonButton.AddCascadingMenuItem("uniqeName", L"label text")
This function returns the created menu that is used to add sub menu items. Examples to add submenu items:
LibAddonButton.AddMenuSubitem(menu, L"A", callbackFunction) menu = LibAddonButton.AddCascadingMenuSubitem(menu, L"B", callbackFunction) LibAddonButton.AddMenuSubitem(menu, L"C", callbackFunction) menu = LibAddonButton.AddCascadingMenuSubitem(menu, L"D", callbackFunction) LibAddonButton.AddMenuSubitem(menu, L"E", callbackFunction)
The above will result in:
A B > C D > E
Overriding the default behavior of the LUp/RUp events
First you must find the button using either method:
local button = LibAddonButton.Register("uniqueName", ... )
local button = LibAddonButton.GetButton("uniqueName")
Then to override the LUp/RUp events:
button:SetLUpOverride(callbackFunction) button:SetRUpOverride(callbackFunction)
- User defined menu items can now be added to menus using the following functions
LibAddonButton.AddUserDefinedMenuItem(uniqueName, text, window)
LibAddonButton.AddUserDefinedMenuSubitem(menu, text, window)
- LUp/RUp button overrides will now pass the parameters flags, mouseX and mouseY
- Menu creation can now be overriden using the following function
button:SetFinalizeMenuOverride(callbackFunction)- The menuId will be passed as a parameter
- If the callback function returns true, the menu is aborted and finalize will not be called
Top Downloads
-
- Enemy
- Buffs & Debuffs, Unit Frames, Combat, and PvP
- 391 Monthly Downloads
-
- LibSlash
- Development Tools
- 328 Monthly Downloads
-
- Squared
- Unit Frames
- 249 Monthly Downloads
-
- Twister
- Action Bars, Combat, Class, and Buffs & Debuffs
- 243 Monthly Downloads
-
- BuffHead2
- PvP, Combat, and Buffs & Debuffs
- 203 Monthly Downloads




Comments
local button = LibAddonButton.Register("mybutton")
function ShowTooltip()
local windowName = SystemData.ActiveWindow.name
Tooltips.CreateTextOnlyTooltip(windowName, nil)
Tooltips.SetTooltipText(1, 1, L"Example")
Tooltips.Finalize()
local anchor = { Point = "top", RelativeTo = windowName, RelativePoint = "center", XOffset = 0, YOffset = -32 }
Tooltips.AnchorTooltip(anchor)
end
local old = LibAddonButton.Button.OnMouseOver
LibAddonButton.Button.OnMouseOver = function(...)
old(...)
local self = ...
if (self == button) then
ShowTooltip()
end
end
For your consideration:
http://war.pastey.net/142794
But I was too lazy for that for now ;)
Feel free to borrow my Yak-Mantra: "Sorry, that´s technically not possible" ;) It´s underused since he´s gone and could use some appliances.
function LibAddonButton.Button:OnLButtonUp(flags, mouseX, mouseY)
function LibAddonButton.Button:OnRButtonUp(flags, mouseX, mouseY)
passing on the arguments:
local success, errmsg = pcall(self.Override.LUp, flags, mouseX, mouseY)
local success, errmsg = pcall(self.Override.RUp, flags, mouseX, mouseY)
one bug: Divider not work in 1st menu. I can create it but not move and not show.
New ideas:
- add some own textures for buttons. Like some folder where I copy icon in specific format and after that chose it in GUI.
- add description to every menu item (like on mouse over tooltip)
- add item moving between buttons (like between submenus in one button)
and one question:-)
For example when U post some position by State of Realm it send into the chat little icon before text. Is possible add that icons into my chat macro? Is here some list of that icons?
makes a break and makes an icon.
The reason I made it so you can only copy a pre-existing button is because of the way textures are handled in WAR. You can't simply drop textures in a folder, you also have to add them to the xml file. Since this would required basic coding anyways, that's why I left choosing the texture to buttons created by addons only.
works too
- in Manager, can U add my own items sorting? (by own id perhaps) not just alphabetical?