/tg/ Station 13 - Modules - TypesVar Details - Proc Details

/datum/tgui

tgui

/tg/station user interface library

Copyright (c) 2020 Aleksej Komarov SPDX-License-Identifier: MIT

tgui datum (represents a UI).

Vars

_initial_updateHolder for the json string, that is sent during the initial update
autoupdateUpdate the UI every MC tick.
childrenChildren of this UI.
heightThe window height
initial_dataThe data (and datastructure) used to initialize the UI.
initial_static_dataThe static data used to initialize the UI.
initializedIf the UI has been initialized yet.
interfaceThe interface (template) to be used for this UI.
master_uiThe parent UI.
src_objectThe object which owns the UI.
stateTopic state used to determine status/interactability.
statusThe status/visibility of the UI.
titleThe title of te UI.
ui_keyThe ui_key of the UI. This allows multiple UIs for one src_object.
userThe mob who opened/is using the UI.
widthThe window width.
window_idThe window_id for browse() and onclose().

Procs

Newpublic
Topicprivate
closepublic
get_jsonprivate
openpublic
processprivate
push_dataprivate
reinitializepublic
set_autoupdatepublic
set_statusprivate
updateprivate
update_statusprivate

Var Details

_initial_update

Holder for the json string, that is sent during the initial update

autoupdate

Update the UI every MC tick.

children

Children of this UI.

height

The window height

initial_data

The data (and datastructure) used to initialize the UI.

initial_static_data

The static data used to initialize the UI.

initialized

If the UI has been initialized yet.

interface

The interface (template) to be used for this UI.

master_ui

The parent UI.

src_object

The object which owns the UI.

state

Topic state used to determine status/interactability.

status

The status/visibility of the UI.

title

The title of te UI.

ui_key

The ui_key of the UI. This allows multiple UIs for one src_object.

user

The mob who opened/is using the UI.

width

The window width.

window_id

The window_id for browse() and onclose().

Proc Details

New

public

Create a new UI.

required user mob The mob who opened/is using the UI. required src_object datum The object or datum which owns the UI. required ui_key string The ui_key of the UI. required interface string The interface used to render the UI. optional title string The title of the UI. optional width int The window width. optional height int The window height. optional master_ui datum/tgui The parent UI. optional state datum/ui_state The state used to determine status.

return datum/tgui The requested UI.

Topic

private

Handle clicks from the UI. Call the src_object's ui_act() if status is UI_INTERACTIVE. If the src_object's ui_act() returns 1, update all UIs attacked to it.

close

public

Close the UI, and all its children.

get_json

private

Package the data to send to the UI, as JSON. This includes the UI data and config_data.

return string The packaged JSON.

open

public

Open this UI (and initialize it with data).

process

private

Update the UI. Only updates the data if update is true, otherwise only updates the status.

optional force bool If the UI should be forced to update.

push_data

private

Push data to an already open UI.

required data list The data to send. optional force bool If the update should be sent regardless of state.

reinitialize

public

Reinitialize the UI. (Possibly with a new interface and/or data).

optional template string The name of the new interface. optional data list The new initial data.

set_autoupdate

public

Enable/disable auto-updating of the UI.

required state bool Enable/disable auto-updating.

set_status

private

Set the status/visibility of the UI.

required status int The status to set (UI_CLOSE/UI_DISABLED/UI_UPDATE/UI_INTERACTIVE). optional push bool Push an update to the UI (an update is always sent for UI_DISABLED).

update

private

Updates the UI by interacting with the src_object again, which will hopefully call try_ui_update on it.

optional force_open bool If force_open should be passed to ui_interact.

update_status

private

Update the status/visibility of the UI for its user.

optional push bool Push an update to the UI (an update is always sent for UI_DISABLED).