Skip to content

Class: MockCUIListBox<T>

Mock CUI list box.

Extends

Type Parameters

Type ParameterDefault type
T extends CUIListBoxItemCUIListBoxItem

Implements

  • CUIListBox<T>

Accessors

__name

Get Signature

ts
get __name(): string;
Returns

string

Implementation of

ts
CUIListBox.__name

Inherited from

MockCUIScrollView.__name


__name

Get Signature

ts
get static __name(): string;
Returns

string

Inherited from

MockCUIScrollView.__name

Constructors

Constructor

ts
new MockCUIListBox<T>(): MockCUIListBox<T>;

Returns

MockCUIListBox<T>

Inherited from

MockCUIScrollView.constructor

Methods

GetHeight()

ts
GetHeight(): number;

Returns

number

Window height.

Implementation of

ts
CUIListBox.GetHeight

Inherited from

MockCUIScrollView.GetHeight


GetWidth()

ts
GetWidth(): number;

Returns

number

Window width.

Implementation of

ts
CUIListBox.GetWidth

Inherited from

MockCUIScrollView.GetWidth


OnKeyboard()

ts
OnKeyboard(): boolean;

Returns

boolean

Inherited from

MockCUIScrollView.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
CUIListBox.Show

Inherited from

MockCUIScrollView.Show


create()

ts
static create(): MockCUIListBox;

Returns

MockCUIListBox

Overrides

MockCUIScrollView.create


mock()

ts
static mock(): CUIListBox;

Returns

CUIListBox

Overrides

MockCUIScrollView.mock

Properties

AddExistingItem

ts
AddExistingItem: Mock<(item: T) => void>;

Add an existing item and transfer it to the list.

Remarks

The Lua binding adopts item; keep future lifetime management with the list.

Param

item

Item to add.

Implementation of

ts
CUIListBox.AddExistingItem

AddTextItem

ts
AddTextItem: Mock<(text: string) => T>;

Add a text item.

Param

text

Item text.

Returns

Created item.

Implementation of

ts
CUIListBox.AddTextItem

AddWindow

ts
AddWindow: Mock<UnknownFunction>;

Add a window to the scroll view.

Param

window

Window to add.

Param

value

Whether layout should be recalculated.

Implementation of

ts
CUIListBox.AddWindow

Inherited from

MockCUIScrollView.AddWindow


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
CUIListBox.AttachChild

Inherited from

MockCUIScrollView.AttachChild


children

ts
children: CUIWindow[] = [];

Inherited from

MockCUIScrollView.children


Clear

ts
Clear: Mock<UnknownFunction>;

Remove all child windows.

Implementation of

ts
CUIListBox.Clear

Inherited from

MockCUIScrollView.Clear


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
CUIListBox.DetachChild

Inherited from

MockCUIScrollView.DetachChild


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
CUIListBox.Enable

Inherited from

MockCUIScrollView.Enable


focusReceiveTime

ts
focusReceiveTime: number = 0;

Inherited from

MockCUIScrollView.focusReceiveTime


FocusReceiveTime

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

Returns

Level time when this window received focus.

Implementation of

ts
CUIListBox.FocusReceiveTime

Inherited from

MockCUIScrollView.FocusReceiveTime


GetAbsoluteRect

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

Returns

Window rectangle in screen coordinates.

Implementation of

ts
CUIListBox.GetAbsoluteRect

Inherited from

MockCUIScrollView.GetAbsoluteRect


GetCurrentScrollPos

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

Returns

Current scroll position.

Implementation of

ts
CUIListBox.GetCurrentScrollPos

Inherited from

MockCUIScrollView.GetCurrentScrollPos


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
CUIListBox.GetFont

Inherited from

MockCUIScrollView.GetFont


GetItem

ts
GetItem: Mock<(index: number) => CUIWindow>;

Get item window by index.

Param

index

Item index.

Returns

Item window.

Implementation of

ts
CUIListBox.GetItem

GetItemByIndex

ts
GetItemByIndex: Mock<(index: number) => T>;

Get typed item by index.

Param

index

Item index.

Returns

List box item.

Implementation of

ts
CUIListBox.GetItemByIndex

GetItemHeight

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

Returns

List item height.

Implementation of

ts
CUIListBox.GetItemHeight

GetMaxScrollPos

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

Returns

Maximum scroll position.

Implementation of

ts
CUIListBox.GetMaxScrollPos

Inherited from

MockCUIScrollView.GetMaxScrollPos


GetMinScrollPos

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

Returns

Minimum scroll position.

Implementation of

ts
CUIListBox.GetMinScrollPos

Inherited from

MockCUIScrollView.GetMinScrollPos


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
CUIListBox.GetMouseX

Inherited from

MockCUIScrollView.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
CUIListBox.GetMouseY

Inherited from

MockCUIScrollView.GetMouseY


GetSelectedIndex

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

Returns

Selected item index.

Implementation of

ts
CUIListBox.GetSelectedIndex

GetSelectedItem

ts
GetSelectedItem: Mock<() => T>;

Returns

Selected item, or null when nothing is selected.

Implementation of

ts
CUIListBox.GetSelectedItem

GetSize

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

Returns

Number of items in the list.

Implementation of

ts
CUIListBox.GetSize

GetWndPos

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

Returns

Window position relative to its parent.

Implementation of

ts
CUIListBox.GetWndPos

Inherited from

MockCUIScrollView.GetWndPos


Init

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

Initialize window rectangle.

Param

frect

Window rectangle.

Implementation of

ts
CUIListBox.Init

Inherited from

MockCUIScrollView.Init


isAutoDelete

ts
isAutoDelete: boolean = false;

Inherited from

MockCUIScrollView.isAutoDelete


IsAutoDelete

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

Returns

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

Implementation of

ts
CUIListBox.IsAutoDelete

Inherited from

MockCUIScrollView.IsAutoDelete


IsCursorOverWindow

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

Returns

Whether the UI cursor is currently over this window.

Implementation of

ts
CUIListBox.IsCursorOverWindow

Inherited from

MockCUIScrollView.IsCursorOverWindow


isEnabled

ts
isEnabled: boolean = false;

Inherited from

MockCUIScrollView.isEnabled


IsEnabled

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

Returns

Whether the window accepts interaction.

Implementation of

ts
CUIListBox.IsEnabled

Inherited from

MockCUIScrollView.IsEnabled


isFixedScrollBar

ts
isFixedScrollBar: boolean = false;

Inherited from

MockCUIScrollView.isFixedScrollBar


isPostProcessMode

ts
isPostProcessMode: boolean = false;

Inherited from

MockCUIScrollView.isPostProcessMode


isShown

ts
isShown: boolean = false;

Inherited from

MockCUIScrollView.isShown


IsShown

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

Returns

Whether the window is visible.

Implementation of

ts
CUIListBox.IsShown

Inherited from

MockCUIScrollView.IsShown


itemHeight

ts
itemHeight: number = 0;

items

ts
items: T[] = [];

maxScrollPosition

ts
maxScrollPosition: number = 0;

Inherited from

MockCUIScrollView.maxScrollPosition


minScrollPosition

ts
minScrollPosition: number = 0;

Inherited from

MockCUIScrollView.minScrollPosition


mouseX

ts
mouseX: number = 0;

Inherited from

MockCUIScrollView.mouseX


mouseY

ts
mouseY: number = 0;

Inherited from

MockCUIScrollView.mouseY


RemoveAll

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

Remove all items.

Implementation of

ts
CUIListBox.RemoveAll

RemoveItem

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

Remove an item window.

Param

window

Item window.

Implementation of

ts
CUIListBox.RemoveItem

RemoveWindow

ts
RemoveWindow: Mock<UnknownFunction>;

Remove a child window from the scroll view.

Param

window

Window to remove.

Implementation of

ts
CUIListBox.RemoveWindow

Inherited from

MockCUIScrollView.RemoveWindow


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
CUIListBox.ResetPPMode

Inherited from

MockCUIScrollView.ResetPPMode


scrollPosition

ts
scrollPosition: number = 0;

Inherited from

MockCUIScrollView.scrollPosition


ScrollToBegin

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

Scroll to the beginning.

Implementation of

ts
CUIListBox.ScrollToBegin

Inherited from

MockCUIScrollView.ScrollToBegin


ScrollToEnd

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

Scroll to the end.

Implementation of

ts
CUIListBox.ScrollToEnd

Inherited from

MockCUIScrollView.ScrollToEnd


selectedIndex

ts
selectedIndex: number = 0;

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
CUIListBox.SetAutoDelete

Inherited from

MockCUIScrollView.SetAutoDelete


SetFixedScrollBar

ts
SetFixedScrollBar: Mock<(fixed: boolean) => void>;

Keep scrollbar visibility fixed.

Param

fixed

Whether scrollbar state is fixed.

Implementation of

ts
CUIListBox.SetFixedScrollBar

Inherited from

MockCUIScrollView.SetFixedScrollBar


SetFont

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

Set the font used by this window.

Param

font

Font object.

Implementation of

ts
CUIListBox.SetFont

Inherited from

MockCUIScrollView.SetFont


SetHeight

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

Set window height.

Param

height

New height.

Implementation of

ts
CUIListBox.SetHeight

Inherited from

MockCUIScrollView.SetHeight


SetItemHeight

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

Set list item height.

Param

height

Item height.

Implementation of

ts
CUIListBox.SetItemHeight

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
CUIListBox.SetPPMode

Inherited from

MockCUIScrollView.SetPPMode


SetScrollPos

ts
SetScrollPos: Mock<(position: number) => void>;

Set scroll position.

Param

position

Scroll position.

Implementation of

ts
CUIListBox.SetScrollPos

Inherited from

MockCUIScrollView.SetScrollPos


SetSelectedIndex

ts
SetSelectedIndex: Mock<(index: number) => void>;

Select an item by index.

Param

index

Item index.

Implementation of

ts
CUIListBox.SetSelectedIndex

SetWidth

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

Set window width.

Param

width

New width.

Implementation of

ts
CUIListBox.SetWidth

Inherited from

MockCUIScrollView.SetWidth


SetWindowName

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

Set debug/window name.

Param

name

Window name.

Implementation of

ts
CUIListBox.SetWindowName

Inherited from

MockCUIScrollView.SetWindowName


SetWndPos

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

Set window position.

Param

vector2

New position.

Implementation of

ts
CUIListBox.SetWndPos

Inherited from

MockCUIScrollView.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
CUIListBox.SetWndRect

Inherited from

MockCUIScrollView.SetWndRect


SetWndSize

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

Set window size.

Param

vector2

New size.

Implementation of

ts
CUIListBox.SetWndSize

Inherited from

MockCUIScrollView.SetWndSize


ShowSelectedItem

ts
ShowSelectedItem: Mock<UnknownFunction>;

Scroll the selected item into view.

Param

value

Whether selected item should be shown.

Implementation of

ts
CUIListBox.ShowSelectedItem

windowFont

ts
windowFont: CGameFont | null = null;

Inherited from

MockCUIScrollView.windowFont


windowName

ts
windowName: string | null = null;

Inherited from

MockCUIScrollView.windowName


WindowName

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

Returns

Window name.

Implementation of

ts
CUIListBox.WindowName

Inherited from

MockCUIScrollView.WindowName


windowPosition

ts
windowPosition: vector2;

Inherited from

MockCUIScrollView.windowPosition


windowRect

ts
windowRect: Frect | null = null;

Inherited from

MockCUIScrollView.windowRect


windowSize

ts
windowSize: vector2;

Inherited from

MockCUIScrollView.windowSize