-
Notifications
You must be signed in to change notification settings - Fork 17
This is a Preliminary description of the Ui class. Many methods remain to be described, and some fields and/or methods may need to be updated with verified information.
-
Ui
- Fields
-
Methods
- add
- addTo
- detach
- setroot
- settooltip
- caption
- decorate
- setTranslucent
- show
- hide
- setfocus
- hacsfous
- pos
- posCentered
- setxpx
- setypx
- pospx
- width
- height
- size
- widthpx
- heightpx
- padding
- anchor
- anchorH
- anchorV
- crop
- clip
- wheel
- mousedown
- mouseup
- mousemove
- dragWheel
- startDrag
- stopDrag
- dragMove
- keydown
- keyup
- updateContainsMouse
- updateHoveredState
- updateTooltipState
- update
- relayout
- draw
- clicked
- mouseEntered
- mouseExited
- swapSiblings
- bringUp
- bringDown
- bringToTop
Ui is the base class of all ui elements. A ui element can be instances of derived classes of Ui, but must always be an instance of Ui.
Argument name | Type | Description |
---|
Returns a new ui element instance of class Ui with the following fields and functions:
The root element of this ui element. Normally all elements are attached to the same root, which is automatically updated and drawn by the mod loader.
The direct parent of the ui element. Automatically set when using the methods add and addTo.
A list of children elements. Ui elements are added to children when using the methods add and addTo.
A list of decorations elements. Without decorations, an element will be completely invisible. Decorations are what describes the visual representation of the element.
description_missing
If this field is set to true
, then mouse events will be ignored; it can not be focused; and it can not contain the mouse. It becomes a purely visual element.
If this field is set to true
, then it will not be drawn; mouse events will be ignored; it can not be focused; and it can not contain the mouse. It is as if the element does not exist for all intents and purposes.
If this field is set to true
, then it can not be hovered, focused. It will receive mouse events, but it will not consume them. It is if the mouse events pass through the element.
Setting this field to true
doesn't do anything by default, but many derived classes of Ui as well as some decorations use it to change the functionality or appearance of the element.
If alignH is nil
or "left"
: x coordinate of the ui element, measured from the parent's left padded edge.
If alignH is "right"
: x coordinate of the ui element's right edge, measured from the parent's right padded edge.
See padding
If alignV is nil
or "top"
: y coordinate of the ui element, measured from the parent's top padded edge.
If alignV is "bottom"
: y coordinate of the ui element's bottom edge, measured from the parent's bottom padded edge.
See padding
Width in pixels of the ui element.
Height in pixels of the ui element.
A variable used to horizontally shift all of its children by this amount. Defaults to 0, and is usually only used by scrolling Ui classes.
A variable used to vertically shift all of its children by this amount. Defaults to 0, and is usually only used by scrolling Ui classes.
Horizontal alignment of the ui element. Tells the parent element how this element would like to be aligned by its parent. Accepted values are "left"
, "center"
and "right"
. Defaults to left
if not set.
Vertical alignment of the ui element. Tells the parent element how this element would like to be aligned by its parent. Accepted values are "top"
, "center"
and "bottom"
. Defaults to top
if not set.
Left padding of the ui element. If a child's alignH is nil
, "left"
or "center"
its x coordinate will be shifted to the right by this amount.
Certain ___Layout
Ui classes will also use padding to contain its children elements within its area.
Top padding of the ui element. If a child's alignV is nil
, "top"
or "center"
its y coordinate will be shifted down by this amount.
Certain ___Layout
Ui classes will also use padding to contain its children elements within its area.
Right padding of the ui element. If a child's alignH is "right"
its x coordinate will be shifted up by this amount.
Certain ___Layout
Ui classes will also use padding to contain its children elements within its area.
Bottom padding of the ui element. If a child's alignV is "bottom"
its y coordinate will be shifted up by this amount.
Certain ___Layout
Ui classes will also use padding to contain its children elements within its area.
The x coordinate relative to the screen of the ui element. Is automatically set by Ui.relayout.
The y coordinate relative to the screen of the ui element. Is automatically set by Ui.relayout.
The minimum width needed to contain all of its children. Automatically calculated in relayout
The minimum height needed to contain all of its children. Automatically calculated in relayout
Is true
if the element is hovered by the mouse cursor; otherwise false
. This field is automatically set in updateHoveredState, and should normally not be manually modified.
Is true
if the element is pressed by the left mouse button; otherwise false
. This field is automatically set by mouse down events, and should normally not be manually modified.
Is true
if the element was the hovered element on the last button down event; otherwise false
. If this element is focused
, then key events will be passed to it. This field is automatically set by mouse down events, and should normally not be manually modified (verification needed).
Is true
if the element contains the mouse cursor; otherwise false
. This field is automatically set in updateContainsMouse, and should normally not be manually modified.
Argument name | Type | Description |
---|---|---|
x |
number | position x |
Sets the element's x coordinate relative to the parent's x coordinate (+padding) to the specified x coordinate.
Returns itself.
Argument name | Type | Description |
---|---|---|
y |
number | position y |
Sets the element's y coordinate relative to the parent's y coordinate (+padding) to the specified y coordinate.
Returns itself.
Argument name | Type | Description |
---|---|---|
x |
number | position x |
y |
number | position y |
Sets the element's position relative to the parent's position (+padding) to the specified coordinates.
Returns itself.
Argument name | Type | Description |
---|---|---|
width |
number | The width in percent of the parent element |
Sets the width of this element to a portion of the width of the parent element.
Returns itself.
Argument name | Type | Description |
---|---|---|
height |
number | The height in percent of the parent element |
Sets the height of this element to a portion of the height of the parent element.
Returns itself.
Argument name | Type | Description |
---|---|---|
width |
number | The width in percent of the parent element |
height |
number | The width in percent of the parent element |
Sets the width and height of this element to a portion of the width and height of the parent element.
Returns itself.
Argument name | Type | Description |
---|---|---|
width |
number | Width in pixels |
Sets the width of this element to the specified width.
Returns itself.
Argument name | Type | Description |
---|---|---|
height |
number | Height in pixels |
Sets the height of this element to the specified height.
Returns itself.
Argument name | Type | Description |
---|---|---|
padding |
number | The amount of padding to add in all directions |
Adds an amount of padding to each side of the ui element.
Padding is used to reduce the available area for children.
If for example a child calls width(x)
, its width will be set to [x * (parent.w - parent.padl - parent.padr)]
Returns itself.
padt: top padding
padr: right padding
padb: bottom padding
padl: left padding
<----------- Ui.w -------------> |
---|
padl | <- children -> | padr |
---|
Argument name | Type | Description |
---|---|---|
padding |
number | The amount of padding to add in all directions |
Argument name | Type | Description |
---|---|---|
child |
table | to_be_added |
index |
number | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
child |
table | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
parent |
table | to_be_added |
index |
number | to_be_added |
description_missing
Argument name | Type | Description |
---|
description_missing
Argument name | Type | Description |
---|---|---|
root |
table | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
text |
string | to_be_added |
title |
string | to_be_added |
static |
boolean | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
text |
string | to_be_added |
title |
string | to_be_added |
static |
boolean | to_be_added |
description_missing
Argument name | Type | Description |
---|
description_missing
Argument name | Type | Description |
---|
description_missing
Argument name | Type | Description |
---|
description_missing
Argument name | Type | Description |
---|
description_missing
Argument name | Type | Description |
---|---|---|
decorations |
table | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
x |
number | to_be_added |
y |
number | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
x |
number | to_be_added |
y |
number | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
text |
string | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
translucent |
string | to_be_added |
cascade |
string | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
alignH |
string | to_be_added |
alignV |
string | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
alignH |
string | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
alignV |
string | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
crop |
string | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
clip |
string | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
mx |
number | to_be_added |
my |
number | to_be_added |
y |
number | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
mx |
number | to_be_added |
my |
number | to_be_added |
button |
number | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
mx |
number | to_be_added |
my |
number | to_be_added |
button |
number | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
mx |
number | to_be_added |
my |
number | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
mx |
number | to_be_added |
my |
number | to_be_added |
y |
number | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
mx |
number | to_be_added |
my |
number | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
mx |
number | to_be_added |
my |
number | to_be_added |
button |
number | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
mx |
number | to_be_added |
my |
number | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
keycode |
number | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
keycode |
number | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
mx |
number | to_be_added |
my |
number | to_be_added |
description_missing
Argument name | Type | Description |
---|
description_missing
Argument name | Type | Description |
---|
description_missing
Argument name | Type | Description |
---|
description_missing
Argument name | Type | Description |
---|
description_missing
Argument name | Type | Description |
---|---|---|
screen |
userdata | to_be_added |
description_missing
Argument name | Type | Description |
---|---|---|
button |
number | to_be_added |
description_missing
Argument name | Type | Description |
---|
description_missing
Argument name | Type | Description |
---|
description_missing
Argument name | Type | Description |
---|---|---|
destIndex |
number | to_be_added |
description_missing
Argument name | Type | Description |
---|
description_missing
Argument name | Type | Description |
---|
description_missing
Argument name | Type | Description |
---|
description_missing