Skip to content

Window ​

Путь подключения: require "ProjectMotionUI/Components/Window"


Класс PMUI.Window ​

Наследуется от: PMUI.Frame

Методы и функции ​

PMUI.Window:new(title, width, height) ​

Creates a window with a draggable header, title, close button, and content area.

ПараметрТипОписание
titlestring|nilWindow title. Defaults to "Window".
widthnumber|nilInitial window width. Defaults to 360.
heightnumber|nilInitial window height. Defaults to 280.

Returns: PMUI.Window

PMUI.Window:SetTexture(textureOrPath) ​

Sets the window background texture. When a texture is assigned, the header background and border are made transparent.

ПараметрТипОписание
textureOrPathstring|Texture|nilTexture object or path to a texture.

Returns: PMUI.Window

PMUI.Window:SetOpenSound(soundName) ​

Sets the sound played when the window is opened.

ПараметрТипОписание
soundNamestring|nilUI sound name.

Returns: PMUI.Window

PMUI.Window:SetCloseSound(soundName) ​

Sets the sound played when the window is closed.

ПараметрТипОписание
soundNamestring|nilUI sound name.

Returns: PMUI.Window

PMUI.Window:SetCornerRadius(radius) ​

Sets the corner radius of the window and its header. The header uses the top-corners-only mode to preserve the window shape.

ПараметрТипОписание
radiusnumberCorner radius in pixels.

Returns: PMUI.Window

PMUI.Window:SetHeaderColor(r, g, b, a) ​

Sets the background color of the window header.

ПараметрТипОписание
rnumberRed component (0.0-1.0).
gnumberGreen component (0.0-1.0).
bnumberBlue component (0.0-1.0).
anumber|nilAlpha component (0.0-1.0).

Returns: PMUI.Window

PMUI.Window:OnClose(callback) ​

Registers a callback invoked when the window is closed. The callback receives the window instance.

ПараметрТипОписание
callbackfunction|nilClose callback.

Returns: PMUI.Window

PMUI.Window:Close() ​

Closes the window. Invokes the close callback, plays the configured sound, and fades out the window. Registered instances are removed through PMUI.CloseInstance after the fade-out completes.