MyMinimapButton is an embedded library to make creating and managing minimap buttons easy for mod authors.
By embedded library, it's one single lua file (MyMinimapButton.lua) that you toss into your addon's folder and use without dependencies or worrying about other mods using the same library.
Any number of mods can include this file, older or newer versions. Multiple copies aren't made, it just uses the most recent version. Every attempt will be made to keep it backwards compatable from this point forward.
To demonstrate MyMinimapButton's use, this download includes a mod called MyMinimapButton-Demo. This demo adds a 'Minimap' button to the macro edit window. When you select a macro and click the button, it creates a minimap button that will attempt to run the macro when clicked. (It can only run macros entirely in /script form -- it doesn't include a parser for slash commands)
Also included in the download is a zip file named TestMod that demonstrates different ways of creating buttons.
1. Toss MyMinimapButton.lua into your addon's folder
2. Include the file in your .toc
3. Use the API to create and manipulate the button.
This will create a minimap button referenced as "MyMod", saving its settings in MyMod_Settings, with the icon MyIcon, that runs MyMod_MinimapButton_OnClick when left clicked.
MyMinimapButton will handle the positioning of the button, whether it's visible or not, its tooltip and all movement. You can if you choose alter any of this behavior with the MyMinimapButton API (see its readme).
__ Changes __
1.0, 7/2/06, release
0.7, lowered frameStrata of buttons to "LOW"
0.6, added toplevel support
0.5, 4/7/06, added SetLock, removed "NONE" as drag option, added
SetEnable and removed Enable/Disable. Changed "ON"/"OFF" to 1/nil,
added SetTopLevel for 1.10.2.
0.4, 3/7/06, bug fixed: Minimap parent, changed: Buttons shrunk slightly
0.3, 3/6/06, initial beta