public
Description: WoW Addon - Addon quicklaunch bar
Homepage: http://www.tekkub.net/
Clone URL: git://github.com/tekkub/quickie.git
tekkub (author)
Sun Jul 06 18:26:43 -0700 2008
commit  d4118d4987002bf359430be01117a47d100ba989
tree    39c17361798e09b45149323a910176e314dd7942
parent  74d456005fbb6aed3ffde6cdeb69ca9557535ca2
name age message
file CallbackHandler-1.0.lua Sun Jul 06 14:05:04 -0700 2008 And so it begins... [tekkub]
submodule LibDataBroker-1.1 - 92347c5 Loading commit data...
file LibStub.lua
file Quickie.lua
file Quickie.toc
file README.textile
file tekKonfigAboutPanel.lua Sun Jul 06 17:20:10 -0700 2008 Upgrade tekKonfigAboutPanel [tekkub]
README.textile

Quickie is a ‘quicklaunch’ bar based off LibDataBroker-1.1 and Auctioneer’s Slidebar.
It is meant to be a common place for addons to register simple config-launching buttons, or other basic buttons.
Basically a replacement for creating a minimap button (herpes) or fubar plugin that does nothing more than open your addon’s config.

Adding support to your addon

The key design point of LibDataBroker is to implement the “Model, View, Controller” design in WoW.
This allows an addon to send out data, an OnClick action… all sorts of things, while remaining independent of the addon displaying the data or using the OnClick.
In short, this means an addon can provide data to display on FuBar without requiring FuBar to be present.
If the user doesn’t have an addon to display the data, they are not bothered by stuff they don’t want to see.

Along this line, we can implement buttons to open addon configs easily, without the need to embed a bunch of libraries to render frames for us.
If the user wishes to have access to the buttons, they need only install a display addon (like this one).
This also means many different display addons could be made, each addressing a certain design, and the user has the control of which design they use.
User choice is a good thing, I’ve been told.

So enough rambing, how do I add this into my addon? Two simple steps:

  1. Add the embed libs into your addon. You need LibStub, CallbackHandler-1.0 and LibDataBroker-1.1
    • If you use Ace3 in your addon, you probably already have the first two embeds. Just make sure they’re loaded before LibDataBroker
  2. Add a “dataobject” to LibDataBroker containing an icon, an OnClick function, and “launcher” set to true
    • The “launcher” key tells display addons that you do not provide any “data” to be rendered, simply an OnClick action to attach to a frame

Example:

LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("MyAddonName", {
	launcher = true,
	icon = "Interface\\Icons\\Spell_Nature_StormReach",
	OnClick = function(clickedframe, button) InterfaceOptionsFrame_OpenToFrame(myconfigframe) end,
})

Extra features

Note that these features may not be implemented in other LDB-based quicklaunch addons!

Quickie will use the dataobject name to find addon metadata from the addon’s TOC and display it in the tooltip.
If your addon’s name (the folder name) does not match the name you give your dataobject, you can set the “tocname” key to your addon name.

If you want a custom tooltip instead of Quickie’s default (addon title and notes from the TOC), you can pass OnEnter and OnLeave functions into your dataobject.
These handlers will be called and passed the usual args (self for the frame that we were called from).
Make sure you include both script handlers!

If you don’t want an addon-specific tooltip, but instead a simple label, use a dataobject name that doesn’t match your addon name and set the “label” key in your dataobject to the text you wish to display.

Links

Visit my site for more info.
Please report all bugs and feature requests to my Google Code tracker
Please direct all feedback and questions to my Google Groups mailinglist