-
Notifications
You must be signed in to change notification settings - Fork 0
Text Widgets
Documentation of FontString functions that comes in handy when creating lables. You have 2 actual widgets here:
Additionally this component provides a way to add labels to existing Frame
:
StdUi:FontString(parent, text, inherit)
Description:
Creates a simple FontString object that has set
font, font size, effects according to StdUi
configuration. Additionaly it is justified
vertically to left and horizontally to middle.
Arguments:
-
parent
Frame - Object that should be a parent of font string -
text
string - Text that should be visible -
inherit
FontString - Object that should be used as template
Returns:
Example:
local text = StdUi:FontString(frame, 'Some text');
StdUi:Label(parent, text, size, inherit, width, height)
Description:
Creates a simple FontString, but with additional
arguments provides one-liner for changing font size, and FontString
width/height. It may also inherit
from existing fonts. It has color set according to StdUi
configuration.
Arguments:
-
parent
Frame - Object that should be a parent of font string -
text
string - Text that should be visible -
size
number - Font size -
inherit
FontString - Object that should be used as template -
width
number - Custom width to clip/expand FontString -
height
number - Custom height to clip/expand FontString
Returns:
Example:
local label = StdUi:Label(frame, 'Some text', 14);
StdUi:AddLabel(parent, object, text, labelPosition, labelWidth)
Description:
Appends label to provided object. Label is then accessible by object.label
. This is important because
some of the widgets has disabled
state. StdUi
hooks on Enable
and Disable
and changes not
only the widget itself by also a label.
Arguments:
-
parent
Frame - Object that should be a parent of font string -
object
Frame - Object that is related to (it creates named childrenobject.label
) -
text
string - Text that should be visible -
labelPosition
string - Can be one of-
'TOP'
- Label will be placed above theobject
-
'LEFT'
- Label will be placed before theobject
-
'RIGHT'
- Label will be placed after theobject
-
-
labelWidth
number (Optional) - custom font string width
Returns:
Example:
local editBox = StdUi:EditBox(window, 100, 24);
local label = StdUi:AddLabel(window, editBox, 'EditBox Label', 'TOP');
---@type StdUi
local StdUi = LibStub('StdUi');
local window = StdUi:Window(UIParent, 'Title', 400, 400);
window:SetPoint('CENTER');
local fs = StdUi:FontString(window, 'Simple FontString');
StdUi:GlueTop(fs, window, 0, -40);
local l = StdUi:Label(window, 'Long Label, Long Label, Long Label, Long Label', 20, nil, 160);
l:SetJustifyH('MIDDLE');
StdUi:GlueBelow(l, fs, 0, -10);
local eb1 = StdUi:SimpleEditBox(window, 100, 24);
eb1:SetPoint('CENTER');
StdUi:AddLabel(window, eb1, 'Simple Label', 'TOP');
local eb2 = StdUi:SimpleEditBox(window, 100, 24);
StdUi:GlueBelow(eb2, eb1, 0, -30);
StdUi:AddLabel(window, eb2, 'Simple Disabled', 'TOP');
eb2:Disable();