Skip to content

Class: MockCUIScriptWnd ​

Mocking script window for testing.

Extends ​

Implements ​

  • CUIScriptWnd

Accessors ​

__name ​

Get Signature ​

ts
get __name(): string;
Returns ​

string

Implementation of ​

ts
CUIScriptWnd.__name

Inherited from ​

MockCUIDialogWnd.__name


__name ​

Get Signature ​

ts
get static __name(): string;
Returns ​

string

Inherited from ​

MockCUIDialogWnd.__name

Constructors ​

Constructor ​

ts
new MockCUIScriptWnd(): MockCUIScriptWnd;

Returns ​

MockCUIScriptWnd

Inherited from ​

MockCUIDialogWnd.constructor

Methods ​

GetHeight() ​

ts
GetHeight(): number;

Returns ​

number

Window height.

Implementation of ​

ts
CUIScriptWnd.GetHeight

Inherited from ​

MockCUIDialogWnd.GetHeight


GetWidth() ​

ts
GetWidth(): number;

Returns ​

number

Window width.

Implementation of ​

ts
CUIScriptWnd.GetWidth

Inherited from ​

MockCUIDialogWnd.GetWidth


OnKeyboard() ​

ts
OnKeyboard(): boolean;

Returns ​

boolean

Implementation of ​

ts
CUIScriptWnd.OnKeyboard

Inherited from ​

MockCUIDialogWnd.OnKeyboard


Show() ​

ts
Show(isShown: boolean): void;

Show or hide the window.

Parameters ​

ParameterType
isShownboolean

Returns ​

void

Remarks ​

Visibility does not attach, detach, enable, or disable the window.

Implementation of ​

ts
CUIScriptWnd.Show

Inherited from ​

MockCUIDialogWnd.Show


Update() ​

ts
Update(): void;

Update the script window.

Returns ​

void

Implementation of ​

ts
CUIScriptWnd.Update

create() ​

ts
static create(): MockCUIScriptWnd;

Returns ​

MockCUIScriptWnd

Overrides ​

MockCUIDialogWnd.create


mock() ​

ts
static mock(): CUIScriptWnd;

Returns ​

CUIScriptWnd

Overrides ​

MockCUIDialogWnd.mock

Properties ​

AddCallback ​

ts
AddCallback: Mock<UnknownFunction>;

Register a named UI callback.

Remarks ​

The callback is matched by control name and event. Register the target control first so its window name and message target are set on this script window.

Param ​

name

Control name.

Param ​

event

UI event id.

Param ​

cb

Callback function.

Param ​

source

Optional callback owner.

Implementation of ​

ts
CUIScriptWnd.AddCallback

AttachChild ​

ts
AttachChild: Mock<(window: CUIWindow) => void>;

Attach a child window.

Remarks ​

The Lua binding adopts child; after attachment, treat the parent as owning its lifetime.

Param ​

child

Child window.

Implementation of ​

ts
CUIScriptWnd.AttachChild

Inherited from ​

MockCUIDialogWnd.AttachChild


children ​

ts
children: CUIWindow[] = [];

Inherited from ​

MockCUIDialogWnd.children


DetachChild ​

ts
DetachChild: Mock<(window: CUIWindow) => void>;

Detach a child window.

Remarks ​

Detaching removes the parent relation. It does not reinitialize the window or attach it elsewhere.

Param ​

child

Child window.

Implementation of ​

ts
CUIScriptWnd.DetachChild

Inherited from ​

MockCUIDialogWnd.DetachChild


Dispatch ​

ts
Dispatch: Mock<() => boolean>;

Dispatch a UI command.

Remarks ​

Used for dialog command routing. Return true only when the command was handled.

Param ​

command

Command id.

Param ​

parameter

Command parameter.

Returns ​

Whether the command was handled.

Implementation of ​

ts
CUIScriptWnd.Dispatch

Enable ​

ts
Enable: Mock<(isEnabled: boolean) => void>;

Enable or disable interaction.

Remarks ​

Enabled state and visibility are separate. Hidden controls can still be enabled.

Param ​

is_enabled

Whether the window should be enabled.

Implementation of ​

ts
CUIScriptWnd.Enable

Inherited from ​

MockCUIDialogWnd.Enable


focusReceiveTime ​

ts
focusReceiveTime: number = 0;

Inherited from ​

MockCUIDialogWnd.focusReceiveTime


FocusReceiveTime ​

ts
FocusReceiveTime: Mock<() => number>;

Returns ​

Level time when this window received focus.

Implementation of ​

ts
CUIScriptWnd.FocusReceiveTime

Inherited from ​

MockCUIDialogWnd.FocusReceiveTime


GetAbsoluteRect ​

ts
GetAbsoluteRect: Mock<() => Frect>;

Returns ​

Window rectangle in screen coordinates.

Implementation of ​

ts
CUIScriptWnd.GetAbsoluteRect

Inherited from ​

MockCUIDialogWnd.GetAbsoluteRect


GetDialogWnd ​

ts
GetDialogWnd: Mock<(id: string) => CUIDialogWnd>;

Find a dialog window by id.

Param ​

id

Window id.

Returns ​

Control instance, or null when not found or not matching.

Implementation of ​

ts
CUIScriptWnd.GetDialogWnd

GetEditBox ​

ts
GetEditBox: Mock<(id: string) => CUIEditBox>;

Find an edit box by id.

Param ​

id

Window id.

Returns ​

Control instance, or null when not found or not matching.

Implementation of ​

ts
CUIScriptWnd.GetEditBox

GetFont ​

ts
GetFont: Mock<() => CGameFont>;

Get the font assigned to this window.

Remarks ​

Text controls need a font assigned before drawing custom text reliably.

Returns ​

Font assigned to this window.

Implementation of ​

ts
CUIScriptWnd.GetFont

Inherited from ​

MockCUIDialogWnd.GetFont


GetFrameLineWnd ​

ts
GetFrameLineWnd: Mock<(id: string) => CUIFrameLineWnd>;

Find a frame line by id.

Param ​

id

Window id.

Returns ​

Control instance, or null when not found or not matching.

Implementation of ​

ts
CUIScriptWnd.GetFrameLineWnd

GetFrameWindow ​

ts
GetFrameWindow: Mock<(id: string) => CUIFrameWindow>;

Find a frame window by id.

Param ​

id

Window id.

Returns ​

Control instance, or null when not found or not matching.

Implementation of ​

ts
CUIScriptWnd.GetFrameWindow

GetHolder ​

ts
GetHolder: Mock<() => CDialogHolder>;

Get the dialog holder.

Remarks ​

The holder is available only after the dialog is assigned to one by the owning UI flow.

Returns ​

Dialog holder.

Implementation of ​

ts
CUIScriptWnd.GetHolder

Inherited from ​

MockCUIDialogWnd.GetHolder


GetListBox ​

ts
GetListBox: Mock<(id: string) => CUIListBox<CUIListBoxItem>>;

Find a list box by id.

Param ​

id

Window id.

Returns ​

Control instance, or null when not found or not matching.

Implementation of ​

ts
CUIScriptWnd.GetListBox

GetListWnd ​

ts
GetListWnd: Mock<(id: string) => CUIListWnd>;

Find a list window by id.

Param ​

id

Window id.

Returns ​

Control instance, or null when not found or not matching.

Implementation of ​

ts
CUIScriptWnd.GetListWnd

GetMouseX ​

ts
GetMouseX: Mock<() => number>;

Get cursor X coordinate stored on this window.

Since ​

OpenXRay 2026-01-01, e3b0e3c5, PR #2028

Source ​

src/xrUICore/ui_export_script.cpp, CUIWindow.GetMouseX binding.

Returns ​

Current cursor X coordinate.

Implementation of ​

ts
CUIScriptWnd.GetMouseX

Inherited from ​

MockCUIDialogWnd.GetMouseX


GetMouseY ​

ts
GetMouseY: Mock<() => number>;

Get cursor Y coordinate stored on this window.

Since ​

OpenXRay 2026-01-01, e3b0e3c5, PR #2028

Source ​

src/xrUICore/ui_export_script.cpp, CUIWindow.GetMouseY binding.

Returns ​

Current cursor Y coordinate.

Implementation of ​

ts
CUIScriptWnd.GetMouseY

Inherited from ​

MockCUIDialogWnd.GetMouseY


GetProgressBar ​

ts
GetProgressBar: Mock<(id: string) => CUIProgressBar>;

Find a progress bar by id.

Param ​

id

Window id.

Returns ​

Control instance, or null when not found or not matching.

Implementation of ​

ts
CUIScriptWnd.GetProgressBar

GetStatic ​

ts
GetStatic: Mock<(id: string) => CUIStatic>;

Find a static control by id.

Param ​

id

Window id.

Returns ​

Control instance, or null when not found or not matching.

Implementation of ​

ts
CUIScriptWnd.GetStatic

GetTabControl ​

ts
GetTabControl: Mock<(id: string) => CUITabControl>;

Find a tab control by id.

Param ​

id

Window id.

Returns ​

Control instance, or null when not found or not matching.

Implementation of ​

ts
CUIScriptWnd.GetTabControl

GetWndPos ​

ts
GetWndPos: Mock<() => vector2>;

Returns ​

Window position relative to its parent.

Implementation of ​

ts
CUIScriptWnd.GetWndPos

Inherited from ​

MockCUIDialogWnd.GetWndPos


HideDialog ​

ts
HideDialog: Mock<UnknownFunction>;

Hide the dialog.

Implementation of ​

ts
CUIScriptWnd.HideDialog

Inherited from ​

MockCUIDialogWnd.HideDialog


holder ​

ts
holder: CDialogHolder | null = null;

Inherited from ​

MockCUIDialogWnd.holder


Init ​

ts
Init: Mock<(rectOrX: number | Frect, y?: number, width?: number, height?: number) => void>;

Initialize window rectangle.

Param ​

frect

Window rectangle.

Implementation of ​

ts
CUIScriptWnd.Init

Inherited from ​

MockCUIDialogWnd.Init


isAutoDelete ​

ts
isAutoDelete: boolean = false;

Inherited from ​

MockCUIDialogWnd.isAutoDelete


IsAutoDelete ​

ts
IsAutoDelete: Mock<() => boolean>;

Returns ​

Whether the engine owns and deletes this window with its parent.

Implementation of ​

ts
CUIScriptWnd.IsAutoDelete

Inherited from ​

MockCUIDialogWnd.IsAutoDelete


IsCursorOverWindow ​

ts
IsCursorOverWindow: Mock<() => boolean>;

Returns ​

Whether the UI cursor is currently over this window.

Implementation of ​

ts
CUIScriptWnd.IsCursorOverWindow

Inherited from ​

MockCUIDialogWnd.IsCursorOverWindow


isEnabled ​

ts
isEnabled: boolean = false;

Inherited from ​

MockCUIDialogWnd.isEnabled


IsEnabled ​

ts
IsEnabled: Mock<() => boolean>;

Returns ​

Whether the window accepts interaction.

Implementation of ​

ts
CUIScriptWnd.IsEnabled

Inherited from ​

MockCUIDialogWnd.IsEnabled


isPostProcessMode ​

ts
isPostProcessMode: boolean = false;

Inherited from ​

MockCUIDialogWnd.isPostProcessMode


isShown ​

ts
isShown: boolean = false;

Inherited from ​

MockCUIDialogWnd.isShown


IsShown ​

ts
IsShown: Mock<() => boolean>;

Returns ​

Whether the window is visible.

Implementation of ​

ts
CUIScriptWnd.IsShown

Inherited from ​

MockCUIDialogWnd.IsShown


Load ​

ts
Load: Mock<() => boolean>;

Load a UI section or XML resource.

Remarks ​

The base CUIScriptWnd binding accepts the value but always reports success. Real loading is usually done by XML helper code before controls are registered.

Param ​

value

Resource or section name.

Returns ​

Whether the load succeeded.

Implementation of ​

ts
CUIScriptWnd.Load

mouseX ​

ts
mouseX: number = 0;

Inherited from ​

MockCUIDialogWnd.mouseX


mouseY ​

ts
mouseY: number = 0;

Inherited from ​

MockCUIDialogWnd.mouseY


Register ​

ts
Register: Mock<(window: CUIWindow, name?: string) => void>;

Register a child window for lookup and callbacks.

Remarks ​

Registration sets this script window as the child's message target. When name is provided, it also replaces the child's window name used by callback matching and typed lookup.

Param ​

window

Child window.

Param ​

name

Optional registration name.

Implementation of ​

ts
CUIScriptWnd.Register

registeredWindows ​

ts
registeredWindows: Map<string, CUIWindow>;

ResetPPMode ​

ts
ResetPPMode: Mock<() => void>;

Disable post-process mode for this window.

Remarks ​

Pair with CUIWindow.SetPPMode when a window no longer needs post-process rendering.

Implementation of ​

ts
CUIScriptWnd.ResetPPMode

Inherited from ​

MockCUIDialogWnd.ResetPPMode


SetAutoDelete ​

ts
SetAutoDelete: Mock<(isAutoDelete: boolean) => void>;

Set whether the parent owns this child window.

Remarks ​

Use this for script-created windows that are attached to a parent and should be cleaned up with the UI tree.

Param ​

auto_delete

Whether the engine should delete the child automatically.

Implementation of ​

ts
CUIScriptWnd.SetAutoDelete

Inherited from ​

MockCUIDialogWnd.SetAutoDelete


SetFont ​

ts
SetFont: Mock<(font: CGameFont) => void>;

Set the font used by this window.

Param ​

font

Font object.

Implementation of ​

ts
CUIScriptWnd.SetFont

Inherited from ​

MockCUIDialogWnd.SetFont


SetHeight ​

ts
SetHeight: Mock<(height: number) => void>;

Set window height.

Param ​

height

New height.

Implementation of ​

ts
CUIScriptWnd.SetHeight

Inherited from ​

MockCUIDialogWnd.SetHeight


SetHolder ​

ts
SetHolder: Mock<(holder: CDialogHolder) => void>;

Assign a dialog holder.

Param ​

holder

Dialog holder.

Implementation of ​

ts
CUIScriptWnd.SetHolder

Inherited from ​

MockCUIDialogWnd.SetHolder


SetPPMode ​

ts
SetPPMode: Mock<() => void>;

Enable post-process mode for this window.

Remarks ​

Use for windows meant to be drawn through the post-process UI path, and reset it when the window returns to normal UI rendering.

Implementation of ​

ts
CUIScriptWnd.SetPPMode

Inherited from ​

MockCUIDialogWnd.SetPPMode


SetWidth ​

ts
SetWidth: Mock<(width: number) => void>;

Set window width.

Param ​

width

New width.

Implementation of ​

ts
CUIScriptWnd.SetWidth

Inherited from ​

MockCUIDialogWnd.SetWidth


SetWindowName ​

ts
SetWindowName: Mock<(name: string) => void>;

Set debug/window name.

Param ​

name

Window name.

Implementation of ​

ts
CUIScriptWnd.SetWindowName

Inherited from ​

MockCUIDialogWnd.SetWindowName


SetWndPos ​

ts
SetWndPos: Mock<(positionOrX: number | vector2, y?: number) => void>;

Set window position.

Param ​

vector2

New position.

Implementation of ​

ts
CUIScriptWnd.SetWndPos

Inherited from ​

MockCUIDialogWnd.SetWndPos


SetWndRect ​

ts
SetWndRect: Mock<(rectOrX: number | Frect, y?: number, width?: number, height?: number) => void>;

Set window rectangle.

Param ​

rect

New rectangle.

Implementation of ​

ts
CUIScriptWnd.SetWndRect

Inherited from ​

MockCUIDialogWnd.SetWndRect


SetWndSize ​

ts
SetWndSize: Mock<(sizeOrWidth: number | vector2, height?: number) => void>;

Set window size.

Param ​

vector2

New size.

Implementation of ​

ts
CUIScriptWnd.SetWndSize

Inherited from ​

MockCUIDialogWnd.SetWndSize


ShowDialog ​

ts
ShowDialog: Mock<UnknownFunction>;

Show or hide the dialog.

Param ​

show

Whether the dialog should be visible.

Implementation of ​

ts
CUIScriptWnd.ShowDialog

Inherited from ​

MockCUIDialogWnd.ShowDialog


windowFont ​

ts
windowFont: CGameFont | null = null;

Inherited from ​

MockCUIDialogWnd.windowFont


windowName ​

ts
windowName: string | null = null;

Inherited from ​

MockCUIDialogWnd.windowName


WindowName ​

ts
WindowName: Mock<() => string>;

Returns ​

Window name.

Implementation of ​

ts
CUIScriptWnd.WindowName

Inherited from ​

MockCUIDialogWnd.WindowName


windowPosition ​

ts
windowPosition: vector2;

Inherited from ​

MockCUIDialogWnd.windowPosition


windowRect ​

ts
windowRect: Frect | null = null;

Inherited from ​

MockCUIDialogWnd.windowRect


windowSize ​

ts
windowSize: vector2;

Inherited from ​

MockCUIDialogWnd.windowSize