API Functions
Embed_CheckTooltips(self, ...)
Checks if the given tooltips are currently displayed and if yes, fires their update callback.
This function becomes available on your addon table when you registered it via iLib:Register()!
Parameters
- self
- ...
- The names of the tooltips to be checked.
Usage
-- A WoW API event got fired and several tooltips needs an update. myAddon:CheckTooltips("Main", "Second", "Special", ...)
Embed_GetTooltip(self, name, updateCallback)
Acquires a LibQTip tooltip with the specified name and registers an updateCallback with it.
If the tooltip is already acquired, returns the LibQTip object. This function becomes available on your addon table when you registered it via iLib:Register()!
Parameters
- self
- name
- The name for the tooltip object.
- updateCallback
- The function name of the function which fills the tooltip with content. Can be a String and must be available as function on your addon table. Can also be a function.
Return value
Returns a LibQTip object.
Usage
-- for registering a new tooltip local tip = myAddon:GetTooltip("Main", "UpdateTooltip") local tip = myAddon:GetTooltip("Main", do_something); -- if do_something is a function -- for getting the previously registered tooltip object local tip = myAddon:GetTooltip("Main")
Embed_HideAllTooltips()
Iterates over all LibQTip tooltips and hides them, if they are acquired by the iLib.
This function becomes available on your addon table when you registered it via iLib:Register()!
Usage
myAddon:HideAllTooltips(); -- All previously displayed tooltips are hidden now. -- You may want to display a new one, now.
Embed_IsTooltip(self, name)
Checks if a tooltip is currently displayed.
This function becomes available on your addon table when you registered it via iLib:Register()!
Parameters
- self
- name
- The name of your tooltip.
Return value
Returns true of your tooltip is displayed.
Usage
if myAddon:IsTooltip("Main") then -- do something end
Embed_SetSharedAutoHideDelay(self, delay, main, ...)
Sets a shared AutoHideDelay for an infinite number of frames.
This will result in none tooltips are hidden, if one of the frames is hovered with your mouse. The more frames are specified, the more CPU is required. The first frame should always be a LibQTip object, since for example anchors often have their own OnUpdate scripts. This function becomes available on your addon table when you registered it via iLib:Register()!
Parameters
- self
- delay
- The time after all tooltips are hidden.
- main
- The LibQTip object to which the OnUpdate script will be attached.
- ...
- Infinite number of frames to check mouse hovering for.
Usage
myAddon:SetSharedAutoHideDelay(0.25, tip1, anchor, tip2) -- Neither tip1 nor tip2 are hidden -- if one of the three frames is hovered with the cursor.
iLib:Compare(addonName, version)
Compares the given addon and version with an addon registered with the iLib.
Parameters
- addonName
- The name of the addon to compare with.
- version
- The version to compare with.
Return value
Returns a number which indicates the result:
- 1 = The version is higher than ours. We need to update. In this case, iLib automatically stores the new version number for further use.
- 2 = Both versions are equal. This is also returned if the given addon isn't registered with iLib.
- 3 = We have a higher version installed.
Usage
if LibStub("iLib"):Compare("MyAddon", 2034) == 3 then SendChatMessage("addon update: "..addonName, "WHISPER", nil, "user") end
iLib:IsRegistered(addonName)
Checks if the given addon is registered with the iLib.
Parameters
- addonName
- The name of your addon.
Return value
Returns true if the addon is registered.
Usage
if LibStub("iLib"):IsRegistered("MyAddon") then -- do something end
iLib:IsUpdate(addonName)
Checks whether there is an update for the given addon or not.
Parameters
- addonName
- The name of the addon.
Return value
False if no update, the version number if update.
Usage
local update = iLib:IsUpdate("myAddon") print(update and "New version available!" or "No updates at all")
iLib:Register(addonName, version, addonTable)
Registers an addon with the iLib
Parameters
- addonName
- Your addon's name. Please use the same name as in the TOC (for smart versioning).
- version
- The version as number. If its a string or nil, iLib trys to create a number from it (e.g. 2.1.0 => 21000)
- addonTable
- Your addon table. Only use if you want to use the iLib tooltip handler.
Return value
Returns true if registration was successful.
Usage
-- without tooltip handling LibStub("iLib"):Register("MyAddon") LibStub("iLib"):Register("MyAddon", 10200) -- with tooltip handling LibStub("iLib"):Register("MyAddon", nil, myAddon) LibStub("iLib"):Register("MyAddon", 10200, myAddon)
Comments