LibFrameX-1.0

This project is abandoned and its default file will likely not work with the most recent version of World of Warcraft. Whether this project is out of date or its author has marked it as abandoned, this project is no longer maintained.

LibFrameX-1.0

This library lets you create your frames dynamically and handles most of the function calls for you. (work in progress)

Dependencies: LibStub

Structure of the FrameX.data.[MyAddon].tframes table

t = {
  {
    name = "root",
    children = {
      {
        name = "child1",
        children = {
          {
            name = "grandson1",
          },
        },
      },
    },
  },
}

- Each table within tframes can have the following elements, including sub-tables:

Basic Properties

KeywordDescription
rootThis frame's elements wont be drawn; acts as an invisible container. The children will be draw unless specified. (boolean) optional
ftypeType of frame; Frame, Button, ... (string)
nameGiven name of the frame (string)
dimDimensions; dimension table: w,h,s (width, height, scale)
posPosition; position table: a, r, ap, x, y (anchor, relative to, r anchor, x, y)
showVisibility property (bolean) optional
templateTemplate to be used for the CreateFrame call (string) optional


Text Properties

text: Table of text properties to show a string of characters in the frame; text table (str,color,fs,halign,valign) optional

KeywordDescription
colorColor of the text; (RGBA table: r,g,b: 0-255, a: 0-1) optional
fsFont style; (string) defaults to: "NumberFont_Shadow_Small"
halignHorizontal alignment; (string) defaults to: "CENTER"
valignVertical alignment; (string) defaults to: "CENTER"
showShow/hide text; (boolean)
captionText shown; (string)


Backdrop Properties

A backdrop is the background part of a frame; it can be colourized
bd: BackDrop of the element (BackDrop table) optional

KeywordDescription
bgFileBackground image file; such as Interface\ChatFrame\ChatFrameBackground
edgeFileEdge file of the background image; such as Interface/Tooltips/UI-Tooltip-Border
tileIs the image tiled or stretched (boolean)
tileSizeSize in pixels of each tile (integer)
edgeSizeSize of the edge and corners (integer)
insetsThe bigger the edge, the bigger the inset. Controls overflow, making sure backdrop doesn't overflow outside of the edges.
{ left, right, top, bottom } (integer)s


Color Properties

KeywordDescription
rgbaColor of the backdrop; (RGBA table: r,g,b: 0-255, a:0-1) optional
brgbaColor of the element's border; (RGBA table: r,g,b: 0-255, a: 0-1) optional


Movement Properties

movable: Makes the frame movable with a specific mouse button and script. (movable table: enabled, drag table) optional

KeywordDescription
enabledEnable or disable the drag (boolean)
dragList of buttons to register for the drag (drag table: str-1,...,str-n) "LeftButton", "RightButton", ...
clicksList of possible registered mouse clicks (click table: str-1, ..., str-n) "LeftButtonUp", "RightButtonUp", ...


Script Properties

scripts: Table of scripts associated with this element (scripts table: event, func)

KeywordDescription
eventEvent name (string) "OnSomeEvent"
funcActual function to execute when event is triggered (function(self,...) ... end)


Functions

Public

  • makeFrames(t)
  • findFrame(fxt, name)

getter/setter functions

  • getBD(name)
  • setBD(name, bd)
  • getBRGBA(name)
  • setBRGBA(name, brgba)
  • getRGBA(name)
  • setRGBA(name, rgba)
  • getVisibility(name)
  • setVisibility(name, vis)
  • getPositionByName(name)
  • setPosition(name, pos)
  • getFrameCaption(name)
  • setFrameCaption(name, cap)

Known Issues

Surely some but I have not identified them yet

Usage

MyAddon = LibStub("AceAddon-3.0"):NewAddon("MyAddon", "AceConsole-3.0", "AceEvent-3.0")

local LFX = LibStub("LibFrameX-1.0")
assert(LFX, "LibFrameX-1.0 not loaded")
MyAddon.makeFrames = LFX.makeFrames

function MyAddon:OnInitialize()
  self:makeFrames(t) -- for demonstration purposes we will keep this short (t)
end

function MyAddon:ChangeText(txt)
  MyAddon:setFrameCaption("FrameName", "TextToSet")
end

Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

Categories

Members

Recent Files

WoW Retail

  • r8
    Jan 29, 2015