class Context

  • namespace: RmlUi

Holds documents and a data model. The Context class has no constructor; it must be instantiated through the CreateContext() function. It has the following functions and properties:

[source]


methods


Context.AddEventListener


function Context.AddEventListener(
  event: string,
  script: RmlUi.Element,
  element_context: boolean,
  in_capture_phase: boolean
)

Adds the inline Lua script, script, as an event listener to the context. element_context is an optional Element; if it is not None, then the script will be executed as if it was bound to that element.

[source]

Context.CreateDocument


function Context.CreateDocument(tag: string) ->  RmlUi.Document

Creates a new document with the tag name of tag.

[source]

Context.LoadDocument


function Context.LoadDocument(document_path: string) ->  RmlUi.Document

Attempts to load a document from the RML file found at document_path. If successful, the document will be returned with a reference count of one.

[source]

Context.GetDocument


function Context.GetDocument(name: string)

[source]

Context.Render


function Context.Render() ->  boolean

Renders the context.

[source]

Context.UnloadAllDocuments


function Context.UnloadAllDocuments()

Closes all documents currently loaded with the context.

[source]

Context.UnloadDocument


function Context.UnloadDocument(document: RmlUi.Document)

Unloads a specific document within the context.

[source]

Context.Update


function Context.Update() ->  boolean

Updates the context.

[source]

Context.OpenDataModel


function Context.OpenDataModel(
  name: string,
  model: T,
  widget: table
) ->  SolLuaDataModel<T>

Create a new data model from a base table model and register to the context. The model table is copied. Note that widget does not actually have to be a widget; it can be any table. This table can be accessed in widgets like <button class="mode-button" onclick="widget:SetCamMode()">Set Dolly Mode</button>. Also note that your data model is inaccessible in onx properties.

[source]

Context.RemoveDataModel


function Context.RemoveDataModel(name: string)

Removes a data model from the context.

[source]

Context.ProcessMouseMove


function Context.ProcessMouseMove(position: RmlUi.Vector2f) ->  boolean

Processes a mouse move event.

[source]

Context.ProcessMouseButtonDown


function Context.ProcessMouseButtonDown(
  button: RmlUi.MouseButton,
  key_modifier_state: integer
) ->  boolean

Processes a mouse button down event.

[source]

Context.ProcessMouseButtonUp


function Context.ProcessMouseButtonUp(
  button: RmlUi.MouseButton,
  key_modifier_state: integer
) ->  boolean

Processes a mouse button up event.

[source]

Context.ProcessMouseWheel


function Context.ProcessMouseWheel(
  delta: (RmlUi.Vector2f|number),
  key_modifier_state: integer
) ->  boolean

Processes a mouse wheel event.

[source]

Context.ProcessMouseLeave


function Context.ProcessMouseLeave() ->  boolean

Processes a mouse leave event.

[source]

Context.IsMouseInteracting


function Context.IsMouseInteracting() ->  boolean

Returns true if the mouse is currently interacting with the context, false if not.

[source]

Context.ProcessKeyDown


function Context.ProcessKeyDown(
  key: RmlUi.key_identifier,
  key_modifier_state: integer
) ->  boolean

Processes a key down event.

[source]

Context.ProcessKeyUp


function Context.ProcessKeyUp(
  key: RmlUi.key_identifier,
  key_modifier_state: integer
) ->  boolean

Processes a key up event.

[source]

Context.ProcessTextInput


function Context.ProcessTextInput(text: string) ->  boolean

Processes a text input event.

[source]

Context.EnableMouseCursor


function Context.EnableMouseCursor(enable: boolean)

Enables or disables the mouse cursor for the context.

[source]

Context.ActivateTheme


function Context.ActivateTheme(
  theme_name: string,
  activate: boolean
)

Activates a theme for the context.

[source]

Context.IsThemeActive


function Context.IsThemeActive(theme_name: string) ->  boolean

Returns true if the theme is active, false if not.

[source]

Context.GetElementAtPoint


function Context.GetElementAtPoint(
  point: RmlUi.Vector2f,
  ignore: RmlUi.Element?
) ->  RmlUi.Element

Returns the element at the point specified by point.

[source]

Context.PullDocumentToFront


function Context.PullDocumentToFront(document: RmlUi.Document)

Pulls the document to the front of the context.

[source]

Context.PushDocumentToBack


function Context.PushDocumentToBack(document: RmlUi.Document)

Pushes the document to the back of the context.

[source]

fields


Context.dimensions


Context.dimensions : RmlUi.Vector2i {
    x: integer,
    y: integer,
    magnitude: number,
}

[source]

Context.dp_ratio


Context.dp_ratio : number

[source]

Context.documents


Context.documents : RmlUi.Document[]

[source]

Context.focus_element


Context.focus_element : RmlUi.Element {
    class_name: string,
    id: string,
    inner_rml: string,
    scroll_left: integer,
    scroll_top: integer,
    attributes: RmlUi.ElementAttributesProxy,
    child_nodes: RmlUi.ElementChildNodesProxy,
    client_left: integer,
    client_height: integer,
    client_top: integer,
    client_width: integer,
    first_child: RmlUi.Element?,
    ...
}

[source]

Context.hover_element


Context.hover_element : RmlUi.Element {
    class_name: string,
    id: string,
    inner_rml: string,
    scroll_left: integer,
    scroll_top: integer,
    attributes: RmlUi.ElementAttributesProxy,
    child_nodes: RmlUi.ElementChildNodesProxy,
    client_left: integer,
    client_height: integer,
    client_top: integer,
    client_width: integer,
    first_child: RmlUi.Element?,
    ...
}

[source]

Context.name


Context.name : string

[source]

Context.root_element


Context.root_element : RmlUi.Element {
    class_name: string,
    id: string,
    inner_rml: string,
    scroll_left: integer,
    scroll_top: integer,
    attributes: RmlUi.ElementAttributesProxy,
    child_nodes: RmlUi.ElementChildNodesProxy,
    client_left: integer,
    client_height: integer,
    client_top: integer,
    client_width: integer,
    first_child: RmlUi.Element?,
    ...
}

[source]