RmlContext
Summary
Remarks
Danger
All calls made within this class MUST be performed on the Master Thread. See Threads.RunLater on how to safely call this from an asynchronous thread. Failure to comply with this can cause catastrophical failures as the engine is not designed for this.
Important
This class MUST be disposed manually.
Definition
Namespace: SDT4.Managed.UI.Rml
Assembly: SDT4.Managed.UI.dll
sealed class RmlContext
Inheritance:
Object ➔ RmlContext
Implements:
IDisposable
Fields
| Name | Type | Description |
|---|---|---|
Properties
| Name | Type | Description |
|---|---|---|
public get; Contexts |
RmlContext[] | Returns an array of active contexts |
public get; set; Dpi |
Single | Gets/sets the ratio between the dp/px size |
public get; LoadedDocuments |
RmlDocument[] | Retrieves all currently loaded documents |
public get; DataModels |
RmlDataModel[] | Retrieves all currently instantiated data models |
public get; ThemeQuery |
RmlThemeQuery | The theme query associated with this context |
public get; protected set; Name |
String |
Methods
public static RmlContext CreateContext(String name, ViewportRenderInstance viewport)
Summary: Creates a new RmlUi context, with a given name. The name must be unique!
Parameters:
-
name(String): A unique name identifying this context. -
viewport(ViewportRenderInstance): The viewport to attach upon creation.
Returns:
- RmlContext: A valid RmlContext
public Void AttachToViewport(ViewportRenderInstance viewport)
Summary: Attaches this context to a new viewport. The old viewport is automatically detached. If the viewport is the same as the current, the operation does nothing.
Parameters:
viewport(ViewportRenderInstance): A new valid render instance.
public Void ForceUpdate()
Summary: Immediately attempts to update the context.
Remarks:
Important
It is rare appropriate that this needs to be called. Every frame, contexts get updated automatically. This method is mainly here to aid unit testing.
public T CreateDataModel<T>(String name)
Summary: Retrieves the data model instantiated for this context
Parameters:
name(String): A unique data model name.
Returns:
- T: The exact data model instance. Null if the type was not registered as an RML Data Model.
public Void DestroyDataModel(RmlDataModel dataModel)
Summary: Destroys the data model A data model to destroy.
Parameters:
dataModel(RmlDataModel):
public RmlDocument? LoadDocument(AssetId document)
Parameters:
document(AssetId):
Returns:
public Void DestroyDocument(RmlDocument document)
Summary: Removes the document from the UI. The document will be disposed!
Parameters:
document(RmlDocument): Document instance
public Boolean ProcessKeyDown(Int32 keyIdentifier, Int32 keyModifierState)
Summary: Sends a key down event into this context.
Parameters:
-
keyIdentifier(Int32): The key pressed. -
keyModifierState(Int32): The state of key modifiers (shift, control, caps-lock, etc.) keys; this should be generated by ORing together members of theInput.KeyModifier enumeration.
Returns:
- Boolean:
if the event was not consumed (i.e., was prevented from propagating by an element); otherwise, .
public Boolean ProcessKeyUp(Int32 keyIdentifier, Int32 keyModifierState)
Summary: Sends a key up event into this context.
Parameters:
-
keyIdentifier(Int32): The key released. -
keyModifierState(Int32): The state of key modifiers (shift, control, caps-lock, etc.) keys; this should be generated by ORing together members of theInput.KeyModifier enumeration.
Returns:
- Boolean:
if the event was not consumed (i.e., was prevented from propagating by an element); otherwise, .
public Boolean ProcessTextInput(Rune unicode)
Summary: Sends a single Unicode character as text input into this context.
Parameters:
unicode(Rune): The Unicode code point to send into this context.
Returns:
- Boolean:
if the event was not consumed (i.e., was prevented from propagating by an element); otherwise, .
public Boolean ProcessTextInput(Char character)
Summary: Sends a single ASCII character as text input into this context.
Parameters:
character(Char): The ASCII character to send into this context.
Returns:
- Boolean:
if the event was not consumed; otherwise, .
public Boolean ProcessTextInput(String text)
Summary: Sends a string of text as text input into this context.
Parameters:
text(String): The UTF-8 string to send into this context.
Returns:
- Boolean:
if the event was not consumed (i.e., was prevented from propagating by an element); otherwise, .
public Boolean ProcessMouseMove(Int32 x, Int32 y, Int32 keyModifierState)
Summary: Sends a mouse movement event into this context.
Parameters:
-
x(Int32): The x-coordinate of the mouse cursor, in window-coordinates (i.e., 0 should be the left of the client area). -
y(Int32): The y-coordinate of the mouse cursor, in window-coordinates (i.e., 0 should be the top of the client area). -
keyModifierState(Int32): The state of key modifiers (shift, control, caps-lock, etc.) keys; this should be generated by ORing together members of theInput.KeyModifier enumeration.
Returns:
- Boolean:
if the mouse is not interacting with any elements in the context (see IsMouseInteracting ); otherwise,.
public Boolean ProcessMouseButtonDown(Int32 buttonIndex, Int32 keyModifierState)
Summary: Sends a mouse-button down event into this context.
Parameters:
-
buttonIndex(Int32): The index of the button that was pressed. Left: 0, Right: 1, Middle: 2. -
keyModifierState(Int32): The state of key modifiers (shift, control, caps-lock, etc.) keys; this should be generated by ORing together members of theInput.KeyModifier enumeration.
Returns:
- Boolean:
if the mouse is not interacting with any elements in the context (see IsMouseInteracting ); otherwise,.
public Boolean ProcessMouseButtonUp(Int32 buttonIndex, Int32 keyModifierState)
Summary: Sends a mouse-button up event into this context.
Parameters:
-
buttonIndex(Int32): The index of the button that was released. Left: 0, Right: 1, Middle: 2. -
keyModifierState(Int32): The state of key modifiers (shift, control, caps-lock, etc.) keys; this should be generated by ORing together members of theInput.KeyModifier enumeration.
Returns:
- Boolean:
if the mouse is not interacting with any elements in the context (see IsMouseInteracting ); otherwise,.
public Boolean ProcessMouseWheel(Vector2d wheelDelta, Int32 keyModifierState)
Summary:
Sends a
Parameters:
-
wheelDelta(Vector2d): The mouse-wheel movement this frame, with positive values being directed right and down. -
keyModifierState(Int32): The state of key modifiers (shift, control, caps-lock, etc.) keys; this should be generated by ORing together members of theInput.KeyModifier enumeration.
Returns:
- Boolean:
if the event was not consumed (i.e., was prevented from propagating by an element); otherwise, .
public Boolean ProcessMouseLeave()
Summary: Tells the context the mouse has left the window.
Remarks:
This removes any hover state from all elements and prevents
Returns:
- Boolean:
if the mouse is not interacting with any elements in the context (see IsMouseInteracting ); otherwise,.
public Void SubscribeToWindow(Window window)
Summary: Subscribes the input processors to the window event listener
Parameters:
window(Window): A valid window to subscribe to
public Void UnsubscribeFromWindow(Window window)
Summary: Unsubscribes the input processors from the window event listener
Parameters:
window(Window): A valid window to unsubscribe from
public virtual String ToString()
Returns:
public virtual Int32 GetHashCode()
Returns:
public virtual Boolean Equals(Object? obj)
Parameters:
obj(Object?):
Returns: