Embed Methods:
TabletLib:GetInstance("version")
Library Functions:
Register(parent, ...)
Unregister(parent)
Open(parent)
Close([parent])
Refresh(parent)
AddCategory(...)
AddLine(...)
SetHint("text")
SetTitle("title")
GetNormalFontSize()
GetHeaderFontSize()
GetNormalFontObject()
GetHeaderFontObject()
SetFontSizePercent(parent, percent)
GetFontSizePercent(parent)
SetTransparency(parent, alpha)
GetTransparency(parent)
SetColor(parent, r, g, b)
GetColor(parent)
Detach(parent)
Attach(parent)
IsAttached(parent)
IsLocked(parent)
ToggleLocked(parent)
Register arguments:
data
detachedData
children
menu
clickable
point
relativePoint
cantAttach
AddCategory arguments:
id
columns
child_<argument>
hideBlankLine
showWithoutChildren
AddLine arguments: (Also works for AddCategory)
text
textR, textG, textB
font
size
text<N>
text<N>R, text<N>G, text<N>B
font<N>
size<N>
wrap
wrap<N>
func
arg1, arg2, arg3
hasCheck
isRadio
checked
checkIcon
justify
justify<N>
indentation
noInherit
Embed Methods:
TabletLib:GetInstance("version")
Returns an instance of TabletLib with the specified version. If the version cannot be found, an error occurs.
Arguments:
("version")
"version":
String - the major version of the library, currently "1.0"
Returns:
An instance of TabletLib with the specified version
Example:
local tablet = TabletLib:GetInstance("1.0")
Library Functions:
Register(parent, ...)
Registers a given parent with TabletLib. Settings are initialized from the other arguments given.
Arguments:
(parent, ...)
parent:
Frame - parent frame to register.
...
Register arguments
You can also supply another parent in this place to share the same information.
Returns:
nil
Example:
tablet:Register(Minimap,
    'children', function()
        local cat = tablet:AddCategory()
        cat:AddLine(
            'text', "Text"
        )
    end
)
Unregister(parent)
Unregisters a given parent from TabletLib.
Arguments:
(parent)
parent:
Frame - registered parent frame.
Returns:
nil
Example:
tablet:Unregister(Minimap)
Open(parent)
Open the tablet registered with the given parent frame.
Arguments:
(parent)
parent
Frame - registered parent frame.
Returns:
nil
Remarks:
You typically won't need to call this, unless you close a detached tablet and want to get it back.
Example:
tablet:Open(Minimap)
Close([parent])
Close the tablet registered with the given parent frame.
Arguments:
([parent])
parent
Frame - registered parent frame. If not given, it closes the currently open attached tablet.
Returns:
nil
Remarks:
You typically won't need to call this, unless you want to close a detached tablet. Attached tablets close by themselves when you stop hovering.
Example:
tablet:Close(Minimap)
Refresh(parent)
Refresh the contents of a tablet.
Arguments:
(parent)
parent
Frame - registered parent frame.
Returns:
nil
Remarks:
If the parent frame's tablet isn't open, this does nothing.
Example:
tablet:Refresh(Minimap)
AddCategory(...)
Adds a category to the tablet.
Arguments:
(...)
A list of arguments to represent the data and style of the category and its children.
AddCategory arguments
Returns:
nil
Remarks:
This is the initial block of all tablets. In order to add lines, they need to be located within a category.
This can only be called within the children section of the registration process.
Example:
local category = tablet:AddCategory()
category:AddLine(
    'text', "Text"
)
AddLine(...)
Adds a line to a category.
Arguments:
(...)
A list of arguments to represent the data and style of a line.
AddLine arguments
Returns:
nil
Remarks:
This can only be called on a category created by the AddCategory(...) method.
Example:
local cat = tablet:AddCategory()
cat:AddLine(
    'text', "Text"
)
SetHint("text")
Set the hint of a tablet.
Arguments:
("text")
"text"
String - text of the hint.
Returns:
nil
Remarks:
This essentially adds a green line of text to the bottom of the tablet that says "Hint: text" where text is what you provided.
This must be called within a registration statement.
Hints do not show up on detached tablets.
Example:
tablet:SetHint("Click for happy fun time!")
SetTitle("text")
Set the title of a tablet.
Arguments:
("text")
"text"
String - text of the title.
Returns:
nil
Remarks:
This essentially sets the text of the top line of the tablet.
This must be called within a registration statement.
Titles do not show up on detached tablets, unless there is no other text available.
Example:
tablet:SetTitle("This is a title")
GetNormalFontSize()
Returns the font size of normal tablet text.
Arguments:
()
Returns:
Number - the font size of normal tablet text
Remarks:
Use this instead of hard numbers because some font packages (such as ClearFont) may change the size.
Example:
local normal = tablet:GetNormalFontSize()
GetHeaderFontSize()
Returns the font size of header tablet text.
Arguments:
()
Returns:
Number - the font size of header tablet text
Remarks:
Use this instead of hard numbers because some font packages (such as ClearFont) may change the size.
Example:
local header = tablet:GetHeaderFontSize()
GetNormalFontObject()
Returns the font object of normal tablet text.
Arguments:
()
Returns:
Font - the font object of normal tablet text
Remarks:
Use this instead of hard numbers because some font packages (such as ClearFont) may change the size/boldness/etc.
Example:
local normalFont = tablet:GetNormalFontObject()
GetHeaderFontObject()
Returns the font object of header tablet text.
Arguments:
()
Returns:
Font - the font object of header tablet text
Remarks:
Use this instead of hard numbers because some font packages (such as ClearFont) may change the size/boldness/etc.
Example:
local headerFont = tablet:GetHeaderFontObject()
SetFontSizePercent(parent, scale)
Sets the relative font size of the tablet.
Arguments:
(parent, percent)
parent
Frame - registered parent frame.
scale
Number - relative font size from 0.25 to 4. (25% to 400%)
Returns:
nil
Example:
tablet:SetFontSizePercent(Minimap, 1)
GetFontSizePercent(parent)
Returns the relative font size of the tablet.
Arguments:
(parent)
parent
Frame - registered parent frame.
Returns:
Number - The relative font size of the tablet.
Example:
local percent = tablet:GetFontSizePercent(Minimap)
SetTransparency(parent, alpha)
Sets the transparency of the tablet.
Arguments:
(parent, percent)
parent
Frame - registered parent frame.
alpha
Number - alpha level from 0 to 1. (clear to solid)
Returns:
nil
Example:
tablet:SetTransparency(Minimap, 0.75)
GetTransparency(parent)
Returns the transparency of the tablet.
Arguments:
(parent)
parent
Frame - registered parent frame.
Returns:
Number - The alpha level of the tablet.
Example:
local percent = tablet:GetTransparency(Minimap)
SetColor(parent, r, g, b)
Sets the color of the tablet.
Arguments:
(parent, r, g, b)
parent
Frame - registered parent frame.
r
Number - red color [0, 1]
g
Number - green color [0, 1]
b
Number - blue color [0, 1]
Returns:
nil
Example:
tablet:SetColor(Minimap, 1, 1, 0) -- yellow
GetColor(parent)
Returns the color of the tablet.
Arguments:
(parent)
parent
Frame - registered parent frame.
Returns:
r, g, b
r
Number - red value [0, 1]
g
Number - green value [0, 1]
b
Number - blue value [0, 1]
Example:
local r, g, b = tablet:GetColor(Minimap)
Detach(parent)
Detaches a tablet, thus making it sticky.
Arguments:
(parent)
parent
Frame - registered parent frame.
Returns:
nil
Remarks:
This will also make the tablet show.
Example:
tablet:Detach(Minimap)
Attach(parent)
Attaches a tablet back to the parent.
Arguments:
(parent)
parent
Frame - registered parent frame.
Returns:
nil
Example:
tablet:Attach(Minimap)
IsAttached(parent)
Returns whether the tablet is attached.
Arguments:
(parent)
parent
Frame - registered parent frame.
Returns:
Boolean - whether the tablet is attached.
Example:
local isAttached = tablet:IsAttached(Minimap)
IsLocked(parent)
Returns whether the tablet is locked.
Arguments:
(parent)
parent
Frame - registered parent frame.
Returns:
Boolean - whether the tablet is locked.
Example:
local locked = tablet:IsLocked(Minimap)
ToggleLocked(parent)
Toggles the lock status of a tablet.
Arguments:
(parent)
parent
Frame - registered parent frame.
Returns:
nil
Example:
tablet:ToggleLocked(Minimap)
Register arguments:
data
Table - table to store data about the tablet.
Remarks:
If this is unavailable, detachedData will be assumed. If both data and detachedData are unavailable, information cannot be saved and most of the settings (such as color or font size) won't work.
Example:
tablet:Register(Minimap,
    'data', {}
)
detachedData
Table - table to store data about the tablet, specifically when it is detached.
Remarks:
If this is unavailable, data will be assumed. If both data and detachedData are unavailable, information cannot be saved and most of the settings (such as color or font size) won't work.
This is available in case you want many frames to look the same (same data value) but have their detached tablets look different.
Example:
tablet:Register(Minimap,
    'detachedData', {}
)
children
Function - function with which to specify information about the tablet's innards.
Remarks:
In this section, you would typically call tablet:SetTitle("text"), tablet:SetHint("text"), and tablet:AddCategory(...)
Example:
tablet:Register(Minimap,
    'children', function()
        tablet:SetTitle("Title")
       
        local cat = tablet:AddCategory()
        cat:AddLine('text', "Text")
       
        tablet:SetHint("A hint")
    end
)
menu
Function - function with which to specify information about the tablet's right-click menu.
Remarks:
This is a DewdropLib menu, so be sure to use that API.
Example:
tablet:Register(Minimap,
    'menu', function()
        dewdrop:AddLine('text', "Text")
    end
)
clickable
Boolean - whether the tablet is clickable (so you can hover over it when attached)
Example:
tablet:Register(Minimap,
    'clickable', true
)
point
String - the main attach point of the tablet.
Function - a function which returns the main attach point of the tablet and, optionally, the relative attach point.
Example:
tablet:Register(Minimap,
    'point', function()
        return "TOPRIGHT", "TOPLEFT"
    end
)
relativePoint
String - the relative attach point of the tablet.
Function - a function which returns the relative attach point of the tablet.
Example:
tablet:Register(Minimap,
    'point', function()
        return "TOPRIGHT"
    end,
    'relativePoint', function()
        return "TOPLEFT"
    end
)
cantAttach
Boolean - whether the tablet is automatically detached and cannot reattach.
Example:
tablet:Register(Minimap,
    'cantAttach', true
)
AddCategory arguments:
id
Value - a unique value for the category.
Remarks:
If you add two categories with the same id, they will actually concatenate instead of actually having two separate categories.
Example:
tablet:AddCategory(
    'id', "Alpha"
)
columns
Integer - the number of columns in the category. [1, 4]
Remarks:
If your lines specify more columns than what this is set to, they are ignored.
Example:
tablet:AddCategory(
    'columns', 3
)
child_<argument>
Value - the value all the children's arguments should take on. (unless specified)
Remarks:
This essentially creates a waterfall of data, if you set a child_arg in the category, all children take on that property, unless they specifically set it as well.
Example:
tablet:AddCategory(
    'child_size', 16
)
hideBlankLine
Boolean - whether to hide the usual blank line before the category.
Remarks:
You should specify a text if you want this to be true.
Example:
tablet:AddCategory(
    'text', "Category",
    'hideBlankLine', true
)
showWithoutChildren
Boolean - whether to show the blank line and category header if the category has no children in it.
Remarks:
Categories are by default hidden (including their headers) if there are no children in it.
Example:
tablet:AddCategory(
    'text', "Category",
    'showWithoutChildren', true
)
AddLine arguments: (Also works for AddCategory)
text
String - the text value of the first column.
Example:
category:AddLine(
    'text', "Text"
)
textR, textG, textB
textR
Number - the red value of the first column. [0, 1]
textG
Number - the green value of the first column. [0, 1]
textB
Number - the blue value of the first column. [0, 1]
Example:
category:AddLine(
    'text', "Text",
    'textR', 1,
    'textG', 1,
    'textB', 0
)
font
Font - the font object of the line.
Example:
category:AddLine(
    'text', 42,
    'font', NumberFontNormal
)
size
Number - the font size of the line.
Example:
category:AddLine(
    'text', "Text",
    'size', 16
)
text<N>
String - the text value of the Nth column.
Example:
category:AddLine(
    'text', "Text"
    'text2', "Value"
)
text<N>R, text<N>G, text<N>B
text<N>R
Number - the red value of the Nth column. [0, 1]
text<N>G
Number - the green value of the Nth column. [0, 1]
text<N>B
Number - the blue value of the Nth column. [0, 1]
Example:
category:AddLine(
    'text', "Text",
    'textR', 1,
    'textG', 1,
    'textB', 0
    'text2', "Value",
    'text2R', 1,
    'text2G', 1,
    'text2B', 1
)
font<N>
Font - the font object of the Nth column.
Remarks:
If this is not specified, the font of the first column is used, as specified by 'font'.
Example:
category:AddLine(
    'text', "The answer",
    'text2', 42,
    'font2', NumberFontNormal
)
size<N>
Number - the font size of the Nth column.
Example:
category:AddLine(
    'text', "Text",
    'size', 16
    'text2', "Value",
    'size2', 12
)
wrap
Boolean - whether the text can wrap to the next line.
Remarks:
Can only be specified on one column. If another wrap is given, the lower value will take precedent.
Example:
category:AddLine(
    'text', "A long line which may or may not wrap, but due to its length, probably will.",
    'wrap', true
)
wrap<N>
Boolean - whether the text can wrap to the next line.
Remarks:
Can only be specified on one column out of the 4.
Example:
category:AddLine(
    'text', "Thing",     'text2', "A long line which may or may not wrap, but due to its length, probably will.",
    'wrap2', true
)
func
function(arg1, arg2, arg3) - a function to call when the line is clicked.
String - name of the method of arg1.
Example:
category:AddLine(
    'text', "Click",
    'func', function()
        print('You win!')
    end
)
arg1, arg2, arg3
arg1
Value - first value to pass to the function.
arg2
Value - second value to pass to the function.
arg3
Value - third value to pass to the function.
Example:
category:AddLine(
    'text', "Click",
    'func', function(a, b, c)
        print(a + b + c)
    end,
    'arg1', math.random(),
    'arg2', math.random(),
    'arg3', math.random()
)
hasCheck
Boolean - whether the line has a check mark.
Example:
category:AddLine(
    'text', "Text",
    'hasCheck', true,
    'checked', false
)
isRadio
Boolean - whether the line's check is a radio button.
Example:
category:AddLine(
    'text', "Text",
    'hasCheck', true,
    'checked', false,
    'isRadio', true
)
AddLine_checked
Boolean - whether the line's check mark is checked.
Remarks:
Only works if hasCheck is true.
Example:
category:AddLine(
    'text', "Text",
    'hasCheck', true,
    'checked', true
)
checkIcon
String - file path to the texture.
Remarks:
Only works if hasCheck is true.
If not specified, 'Interface\Buttons\UI-CheckBox-Check' is used.
Example:
category:AddLine(
    'text', "Text",
    'hasCheck', true,
    'checked', true
    'checkIcon', true
)
justify
String - justification of the text.
Remarks:
Only works if there is 1, 3, or 4 columns.
Example:
category:AddLine(
    'text', "Text",
    'justify', "CENTER"
)
justify<N>
String - justification of the Nth column.
Remarks:
Only works if there is 1, 3, or 4 columns.
Example:
category:AddLine(
    'text', "Text",
    'text2', "Value",
    'justify', "LEFT",
    'justify2', "RIGHT"
)
indentation
Number - indentation of a line.
Example:
category:AddLine(
    'text', "Text",
    'indentation', 10
)
noInherit
Boolean - whether to not inherit settings pushed from the category.
Example:
local cat = tablet:AddCategory(
    'child_indentation', 10
)

cat:AddText(
    'text', "Hello, World",
    'noInherit', true
)