Skip to content

Types and Utilities

Type definitions and utility types used in PixelUI.

PixelUI.DimensionConstraint

NameTypeDescription
percentnumber?Percentage (0-1) of the referenced metric
ofstring?Reference string such as "parent.width"
offsetinteger?Offset applied after evaluation

PixelUI.AlignmentConstraint

NameTypeDescription
referencestring?Reference string such as "parent.centerX"
offsetinteger?Offset applied relative to the reference

PixelUI.FreeDrawContext

NameTypeDescription
appPixelUI.AppOwning application instance
boxShrekBoxUnderlying ShrekBox instance
textLayerLayerShared text layer used by PixelUI
pixelLayerLayerShared pixel layer used by PixelUI
xintegerAbsolute X coordinate of the widget region
yintegerAbsolute Y coordinate of the widget region
widthintegerWidth of the widget region
heightintegerHeight of the widget region
writefun(x:integer,
pixelfun(x:integer,
fillfun(color:PixelUI.Color)Fill the region with a colour

PixelUI.TreeNode

A tree node representing an item in a TreeView. Can have children nodes for hierarchical structures.

NameTypeDescription
labelstringDisplay text for the node
dataanyCustom data associated with the node
childrenPixelUI.TreeNode[]Child nodes
expandedbooleanWhether the node is expanded to show children

PixelUI.TabControlTab

NameTypeDescription
idany?Optional identifier for the tab
labelstringDisplay label rendered inside the tab
valueany?Optional value associated with the tab
contentstring|PixelUI.TabControlRenderer?Optional string or renderer used for the body
contentRendererPixelUI.TabControlRenderer?Tab-specific renderer that overrides the widget default
disabledboolean?When true the tab cannot be selected
tooltipstring?Optional tooltip text (reserved for future use)

PixelUI.ContextMenu

A hierarchical context menu widget with optional submenus. Renders as a popup and supports keyboard navigation.

NameTypeDescription
itemsPixelUI.ContextMenuEntry[]Normalized menu entries
menuBgPixelUI.ColorBackground color for menu panels
menuFgPixelUI.ColorForeground color for menu items
highlightBgPixelUI.ColorHighlight background for the active item
highlightFgPixelUI.ColorHighlight foreground for the active item
shortcutFgPixelUI.ColorForeground color for shortcut text
disabledFgPixelUI.ColorForeground color for disabled entries
separatorColorPixelUI.ColorSeparator line color
maxWidthintegerMaximum width of a menu panel in characters
onSelectfun(self:PixelUI.ContextMenu,

PixelUI.ContextMenuEntry

NameTypeDescription
labelstring?Text label for menu row
shortcutstring?Optional shortcut hint text
valueanyArbitrary value passed through on selection
idanyOptional identifier for the item
disabledboolean?When true the item cannot be activated
submenuPixelUI.ContextMenuEntry[]?Nested submenu entries
onSelectfun(menu:PixelUI.ContextMenu,
separatorboolean?Marks this entry as a separator row

PixelUI.ContextMenuItem

NameTypeDescription
type"item"|"separator"
labelstring?
shortcutstring?
valueany
idany
disabledboolean
submenuPixelUI.ContextMenuItem[]?
actionfun(menu:PixelUI.ContextMenu,
dataany

PixelUI.TableColumn

A table column definition for the Table widget. Defines how data is accessed, displayed, and sorted.

NameTypeDescription
idstringUnique identifier for the column
titlestringDisplay title in the header
keystring?Key to access data from row objects
accessorfun(row:any):anyFunction to extract cell value from row
widthinteger?Fixed width in characters (auto-sized if not set)
align"left"|"center"|"right"?Cell text alignment
sortableboolean?Whether this column can be sorted
formatfun(value:any,
comparatorfun(a:any,

PixelUI.ThreadHandle

Handle for controlling and monitoring a background thread. Provides methods to check status, cancel execution, and retrieve results.

NameTypeDescription
appPixelUI.AppThe application instance
getIdfun(self:PixelUI.ThreadHandle):integerGet thread ID
getNamefun(self:PixelUI.ThreadHandle):stringGet thread name
setNamefun(self:PixelUI.ThreadHandle,
getStatusfun(self:PixelUI.ThreadHandle):PixelUI.ThreadStatusGet current status
isRunningfun(self:PixelUI.ThreadHandle):booleanCheck if thread is running
isFinishedfun(self:PixelUI.ThreadHandle):booleanCheck if thread has finished
cancelfun(self:PixelUI.ThreadHandle):booleanRequest thread cancellation
isCancelledfun(self:PixelUI.ThreadHandle):booleanCheck if thread was cancelled
getResultfun(self:PixelUI.ThreadHandle):...Get thread results (blocks until complete)
getResultsfun(self:PixelUI.ThreadHandle):any[]?Get results as array
getErrorfun(self:PixelUI.ThreadHandle):anyGet error if thread failed
setMetadatafun(self:PixelUI.ThreadHandle,
getMetadatafun(self:PixelUI.ThreadHandle,
getAllMetadatafun(self:PixelUI.ThreadHandle):table<string,
onStatusChangefun(self:PixelUI.ThreadHandle,
onMetadataChangefun(self:PixelUI.ThreadHandle,

PixelUI.ThreadContext

Context object provided to background thread functions. Provides utilities for sleeping, yielding, and reporting progress.

NameTypeDescription
sleepfun(self:PixelUI.ThreadContext,
yieldfun(self:PixelUI.ThreadContext)Yield control to other threads
checkCancelledfun(self:PixelUI.ThreadContext)Throw error if cancelled
isCancelledfun(self:PixelUI.ThreadContext):booleanCheck if cancelled
setMetadatafun(self:PixelUI.ThreadContext,
setStatusfun(self:PixelUI.ThreadContext,
setDetailfun(self:PixelUI.ThreadContext,
setProgressfun(self:PixelUI.ThreadContext,
getHandlefun(self:PixelUI.ThreadContext):PixelUI.ThreadHandleGet thread handle

PixelUI.AnimationHandle

Handle for controlling a running animation.

NameTypeDescription
cancelfun(self:PixelUI.AnimationHandle)Cancel the animation

Type Aliases

NameType
PixelUI.Colorinteger
ccTweaked.colors.colorinteger
PixelUI.TabControlRendererfun(self:PixelUI.TabControl, tab:PixelUI.TabControlTab?, textLayer:Layer, pixelLayer:Layer, area:{ x:integer, y:integer, width:integer, height:integer })
PixelUI.ThreadStatus"running"|"completed"|"error"|"cancelled"
PixelUI.WidgetConfigtable

Released under the MIT License.