Skip to content

PixelUI.Window ​

Extends: PixelUI.Frame

A floating window widget with an optional title bar and dragging support. Extends Frame by adding chrome controls and layered ordering.

Properties ​

NameTypeDescription
draggablebooleanWhether the window can be dragged by the title bar
resizablebooleanWhether the window size can be adjusted via drag handles
closablebooleanWhether the window shows a close button
maximizablebooleanWhether the window shows a maximize/restore button
minimizablebooleanWhether the window shows a minimize button
hideBorderWhenMaximizedbooleanWhether the border is hidden while maximized
minimizedHeightinteger?Optional fixed height used when the window is minimized
private_titleBar
private_titleLayoutCache
private_titleButtonRects
private_dragging
private_dragSource
private_dragIdentifier
private_dragOffsetX
private_dragOffsetY
private_resizing
private_resizeSource
private_resizeIdentifier
private_resizeEdges
private_resizeStart
private_isMaximized
private_restoreRect

Methods ​

new ​

lua
new()

_refreshTitleBarState ​

lua
_refreshTitleBarState()

_invalidateTitleLayout ​

lua
_invalidateTitleLayout()

_isBorderVisible ​

lua
_isBorderVisible()

_computeInnerOffsets ​

lua
_computeInnerOffsets()

_resolveGeometryAnimation ​

lua
_resolveGeometryAnimation()

_stopGeometryAnimation ​

lua
_stopGeometryAnimation()

_applyGeometry ​

lua
_applyGeometry()

_transitionGeometry ​

lua
_transitionGeometry()

_computeTitleLayout ​

lua
_computeTitleLayout()

_hitTestTitleButton ​

lua
_hitTestTitleButton()

_drawTitleButton ​

lua
_drawTitleButton()

_fillTitleBarPixels ​

lua
_fillTitleBarPixels()

_hitTestResize ​

lua
_hitTestResize()

_beginResize ​

lua
_beginResize()

_updateResize ​

lua
_updateResize()

_endResize ​

lua
_endResize()

_restoreFromMaximize ​

lua
_restoreFromMaximize()

_computeMaximizedGeometry ​

lua
_computeMaximizedGeometry()

_computeMinimizedGeometry ​

lua
_computeMinimizedGeometry()

_captureRestoreRect ​

lua
_captureRestoreRect()

maximize ​

lua
maximize()

restore ​

lua
restore()

toggleMaximize ​

lua
toggleMaximize()

minimize ​

lua
minimize()

toggleMinimize ​

lua
toggleMinimize()

isMinimized ​

lua
isMinimized()

close ​

lua
close()

_getVisibleTitleBarHeight ​

lua
_getVisibleTitleBarHeight()

setTitleBar ​

lua
setTitleBar()

getTitleBar ​

lua
getTitleBar()

setDraggable ​

lua
setDraggable()

isDraggable ​

lua
isDraggable()

setResizable ​

lua
setResizable()

isResizable ​

lua
isResizable()

setClosable ​

lua
setClosable()

isClosable ​

lua
isClosable()

setMaximizable ​

lua
setMaximizable()

isMaximizable ​

lua
isMaximizable()

setMinimizable ​

lua
setMinimizable()

isMinimizable ​

lua
isMinimizable()

setHideBorderWhenMaximized ​

lua
setHideBorderWhenMaximized()

hidesBorderWhenMaximized ​

lua
hidesBorderWhenMaximized()

setMinimizedHeight ​

lua
setMinimizedHeight()

getMinimizedHeight ​

lua
getMinimizedHeight()

setGeometryAnimation ​

lua
setGeometryAnimation()

setOnMinimize ​

lua
setOnMinimize()

setTitle ​

lua
setTitle()

getContentOffset ​

lua
getContentOffset()

setSize ​

lua
setSize()

setBorder ​

lua
setBorder()

bringToFront ​

lua
bringToFront()

_pointInTitleBar ​

lua
_pointInTitleBar()

_beginDrag ​

lua
_beginDrag()

_updateDragPosition ​

lua
_updateDragPosition()

_endDrag ​

lua
_endDrag()

draw ​

lua
draw()

handleEvent ​

lua
handleEvent()

Examples ​

Basic
lua
local pixelui = require("pixelui")
local app = pixelui.app()

-- Simple floating window
local window = app:window({
    x = 5, y = 3,
    width = 30, height = 12,
    title = "My Window",
    bg = colors.gray
})

window:addChild(app:label({
    x = 2, y = 2,
    text = "Window content here"
}))

app.root:addChild(window)

app:run()
Advanced
lua
local pixelui = require("pixelui")
local app = pixelui.app()

-- Feature-rich window with all controls
local window = app:window({
    x = 5, y = 3,
    width = 35, height = 15,
    title = "Advanced Window",
    draggable = true,
    resizable = true,
    closable = true,
    maximizable = true,
    minimizable = true,
    hideBorderWhenMaximized = true,
    bg = colors.black,
    border = { color = colors.gray }
})

-- Configure title bar
window:setTitleBar({
    enabled = true,
    height = 1,
    bg = colors.blue,
    fg = colors.white,
    align = "center"
})

-- Add window content
window:addChild(app:label({
    x = 2, y = 2,
    text = "Drag the title bar to move"
}))

window:addChild(app:label({
    x = 2, y = 4,
    text = "Drag corners to resize"
}))

-- Handle window events
window.onClose = function()
    return true  -- Allow close
end

window.onMaximize = function()
    -- Handle maximize
end

app.root:addChild(window)

app:run()

Released under the MIT License.