A draggable, titled window and the supported way to build movable tool panels. Parent the window's widgets into content (its origin sits just below the title bar) and they move with the window for free: they are plain display-list children, so layouts are written once in window-local coordinates and never touched again on drag.

The window itself is a passive, blocking surface; the interactive title bar is a child, so widgets inside content receive the pointer normally. Pressing anywhere raises the window to the front and makes it the active window (its bar renders brighter). Options: draggable (the bar drags with viewport clamping), resizable (a bottom-right grip, honouring minWidth/minHeight), closable (an X that fires onClose or disposes), and collapsible (a chevron that rolls the body up to just the bar). The body is a UIFill (the PANEL slot by default) with a 1px outline and a PANEL3 title band, so it follows theme swaps like UIPanel.

Static variables

@:value(null)staticread onlyactiveWindow:UIWindow = null

The active (front-most, most recently pressed) window, or null.

Constructor

@:value({ fill : PANEL })new(title:String, width:Float, height:Float, fill:UIFill = PANEL)

Parameters:

title

the title-bar text (raw; use localize for translated titles)

width

layout width

height

TOTAL layout height, title bar included

fill

the body fill: a theme slot or a fixed ARGB colour

Variables

@:value(26)barHeight:Float = 26

Title-bar height in base (unscaled) pixels.

@:value(false)closable:Bool = false

Shows a close (X) button that fires onClose, or disposes the window when it is null.

@:value(false)read onlycollapsed:Bool = false

true while the body is rolled up (bar only).

@:value(false)collapsible:Bool = false

Shows a collapse (chevron) button that rolls the body up to just the title bar.

finalcontent:Sprite

Parent the window's widgets here; local (0, 0) is the body's top-left below the bar.

@:value(true)draggable:Bool = true

false pins the window in place (the title bar stops dragging).

@:value("")fallback:String = ""

@:value(PANEL)fill:UIFill = PANEL

What the body paints: a theme slot (follows theme swaps) or a fixed ARGB colour.

@:value(13)fontSize:Int = 13

Base (unscaled) title font size.

read onlyisActive:Bool

true while this is the active (front-most) window.

@:value(null)key:String = null

@:value(80)minHeight:Float = 80

Smallest height a resize drag allows.

@:value(140)minWidth:Float = 140

Smallest width a resize drag allows.

@:value(false)resizable:Bool = false

Shows a bottom-right resize grip honouring minWidth/minHeight.

title:String

@:value(null)onClose:() ‑> Void = null

Fired when the close button is hit; when null the window disposes itself.

@:value(null)onMoved:(x:Float, y:Float) ‑> Void = null

Fired after the user drags the window, with the new x/y (already applied).

@:value(null)onResized:(w:Float, h:Float) ‑> Void = null

Fired after the user resizes the window, with the new w/h (already applied).

Methods

localize(key:String, fallback:String):Void

Switches the title to a localized string.

Parameters:

key

the translation key

fallback

the source-language text

requestClose():Void

Fires onClose, or disposes the window when no handler is set.

toggleCollapse():Void

Rolls the body up to just the title bar, or back down.

Inherited Variables

Defined by UIComponent

@:value(true)enabled:Bool = true

Disabled widgets ignore the pointer and typically render dimmed.

@:value(0)read onlyh:Float = 0

Layout height in UI units.

@:value(MouseCursor.BUTTON)hoverCursor:MouseCursor = MouseCursor.BUTTON

Native cursor while hovering (interactive widgets; null keeps the arrow).

@:value(false)read onlyhovered:Bool = false

true while the cursor is over this widget.

@:value(false)longPressable:Bool = false

Opts a subclass that overrides onRightPress (without setting onRightClick) into long-press-as-right-click on touch. Widgets with onRightClick set are included automatically.

@:value(null)onClick:() ‑> Void = null

Fired on a completed click (press + release on this widget). Requires an interactive widget.

@:value(null)onHover:() ‑> Void = null

Fired when the cursor first enters this widget (hover-driven descriptions/previews). Interactive widgets only.

@:value(null)onRightClick:() ‑> Void = null

Fired on a right mouse press over this widget (context menus). Only interactive widgets receive pointer events, so this never fires on passive widgets like UILabel/UIPanel — attach it to a UIButton (or another interactive widget) instead. On touch, a long-press fires the same path (see UIRoot.longPressMs).

@:value(false)read onlypressed:Bool = false

true while a press that started here is held.

@:value(null)tooltip:String = null

Optional tooltip text (already-localized or a fixed string).

@:value(null)tooltipShortcut:String = null

Optional right-aligned shortcut hint rendered in the tooltip.

@:value(0)read onlyw:Float = 0

Layout width in UI units (independent of DisplayObject's content-derived width).

Inherited Methods

Defined by UIComponent

invalidate():Void

Schedules a repaint for the next frame (cheap; deduplicated).

resize(width:Float, height:Float):Void

Sets the layout size and repaints when it changed.

Parameters:

width

the new layout width in UI units

height

the new layout height in UI units