promotional bannermobile promotional banner

LibFrameAnchorRegistry-1.0

Abandoned
Library to handle and store information about frame that are possible targets to anchor other frames to.

Central registry for addons to register their frames as possible frame anchor. Other addons can then retrieve the list of anchor and then let their user anchor the addon to whatever frame they like.

To register a frame with the registry:

LibStub("LibFrameAnchorRegistry-1.0"):RegisterAnchor("MyCateogry", "NameOfFrame", "Identidy", frame)

To register with sub-categories:

LibStub("LibFrameAnchorRegistry-1.0"):RegisterAnchor("MyCateogry\001MySub-Category", "NameOfFrame", "Identidy", frame)

To retrieve the actual frame:

local anchor = LibStub("LibFrameAnchorRegistry-1.0"):GetAnchor(db.AnchorID)

To use with AceConfig:

local frame CreateFrame("Frame", nil, UIparent)
local options = {
   type = "group",
   args = {
      drop = {
         name = "Test",
         desc = "Some testing",
         type = "select",
         width = "double",
         values = function() return LibStub("LibFrameAnchorRegistry-1.0"):GetAnchors(frame) end,
         set = function(info, ident, name, frame)
            db.AnchorID = ident
         end,
         get = function() return db.AnchorID end,
         dialogControl = "FrameAnchorDropdown",
      },
   },
}

LibStub("AceConfig-3.0"):RegisterOptionsTable("Options", options, {"/myslash", "/my"})

To use stand-alone:

local frame CreateFrame("Frame", nil, UIparent)
local t = AceGUI:Create("FrameAnchorDropdown")
t:SetList(FA:GetAnchors(frame ))
t:SetLabel("Anchor")
t:SetValue(db.FrameAnchorID)
t:SetCallback("OnValueChanged", function(self, event, ident, name, frame)
	db.FrameAnchorID = ident
end)

The LibFrameAnchorRegistry-1.0 Team

profile avatar
  • 13
    Projects
  • 487.4K
    Downloads

More from Forge_User_33287735View all