draw()
- draw the elementsetParent(parent)
- set the widgets parentcalculateGeometry(x, y, w, h)
- calculate placement inside a boxgetMinDimensions()
- get the minimum space required by the Widget, including padding, border & margingetContentDimensions()
- get the minimum space required for the content of the widget, without anywhing elsegetContentBox()
- get the box to draw the contents ininside(x, y)
- check if a point is inside the widget or not. Used for mouse events.handleMouse(x, y)
- handle mouse (fire enter or leave events)handleClick(x, y, button)
- fire click event if insidegetFont()
- get the font or the parent's fontgetWidget(id)
- get a widget with a given ID from the hierarchyaddWidgetLookup(key, widget)
- register a widget with an ID in the hierarcy (containers only)getSlots()
- get the required slots to divide space into (containers only)
update()
- do mouse updatingrecalculate()
- recalculate all geometryresize(w, h)
- resize & recalculatehandleClick(x, y, button)
- forward a click event
x
,y
,w
,h
- only after set bycalculateGeomery
style
id
mouseOver
parent
text
(in case ofLabels
andButtons
)widgets
(in case ofSwitchers
andGUI
)items
(in case of all containers)selected
(Switcher
only)
Note: setting of any other attribute than those is possible.
Font(size, file)
- create a cached font withlove.graphics.newFont(size, file)
. Second parameter is optionalrgb(r, g, b, a)
- RGB helper, divide each component by 255 and return as a table. Alpha is optional, defaults to 255.getId(type)
- generate a new string Id for a widget, based on it's typecenterBox(bX, bY, bW, bH, w, h)
center a(w, h)
sized box inside another. Returns(x, y)
of top left corner to place.
- Created via their constructor from bottom-up (elements first, then parent containers)
- Called
setParent()
from top-down (source isGUI
) - called
calculateGeometry(x, y, w, h)
by parent Sets own values - called
draw()
repedately - called
handleMouse(x, y)
by parent (source is GUI, ifupdate()
is called) - called
handleClick(x, y, w, h)
by parent (source is GUI, ifhandleClick(x, y, button)
is called on it) - called
calculateGeometry(x, y, w, h)
by parent in case of recalculation(resize or directly issued)