LibFrameX-1.0
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
Keyword | Description |
---|---|
root | This frame's elements wont be drawn; acts as an invisible container. The children will be draw unless specified. (boolean) optional |
ftype | Type of frame; Frame, Button, ... (string) |
name | Given name of the frame (string) |
dim | Dimensions; dimension table: w,h,s (width, height, scale) |
pos | Position; position table: a, r, ap, x, y (anchor, relative to, r anchor, x, y) |
show | Visibility property (bolean) optional |
template | Template 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
Keyword | Description |
---|---|
color | Color of the text; (RGBA table: r,g,b: 0-255, a: 0-1) optional |
fs | Font style; (string) defaults to: "NumberFont_Shadow_Small" |
halign | Horizontal alignment; (string) defaults to: "CENTER" |
valign | Vertical alignment; (string) defaults to: "CENTER" |
show | Show/hide text; (boolean) |
caption | Text 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
Keyword | Description |
---|---|
bgFile | Background image file; such as Interface\ChatFrame\ChatFrameBackground |
edgeFile | Edge file of the background image; such as Interface/Tooltips/UI-Tooltip-Border |
tile | Is the image tiled or stretched (boolean) |
tileSize | Size in pixels of each tile (integer) |
edgeSize | Size of the edge and corners (integer) |
insets | The 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
Keyword | Description |
---|---|
rgba | Color of the backdrop; (RGBA table: r,g,b: 0-255, a:0-1) optional |
brgba | Color 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
Keyword | Description |
---|---|
enabled | Enable or disable the drag (boolean) |
drag | List of buttons to register for the drag (drag table: str-1,...,str-n) "LeftButton", "RightButton", ... |
clicks | List 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)
Keyword | Description |
---|---|
event | Event name (string) "OnSomeEvent" |
func | Actual 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