RSX Code Reference
    Preparing search index...
    • rsx
    • UIHorizontalLayout

    Class UIHorizontalLayout

    Represents a horizontal layout that will layout out its child elements left to right.

    Hierarchy (View Summary)

    Index
    • get bounds(): Immutable<rsx.UIRectPoint>

      Sets the bounds of the UI element. Relative to a parent UI panel. Equivalent to calling setPosition(), setWidth() and setHeight().

      If scalable is set to true, the size will be scaled linearly with the DPI scaling factor of the surface the elements gets attached. It false, the element will have this exact size no matter the DPI scaling factor.

      Returns Immutable<rsx.UIRectPoint>

    • set bounds(value: Immutable<rsx.UIRectPoint>): void

      Parameters

      Returns void

    • get boundsInPixels(): Immutable<Rect2>

      Gets or sets non-clipped bounds of the UI element in pixels. Relative to a parent UI panel.

      Returns Immutable<Rect2>

    • set boundsInPixels(value: Immutable<Rect2>): void

      Parameters

      Returns void

    • get childCount(): number

      Returns number of child elements in the layout.

      Returns number

    • get clippedVisibleBounds(): Immutable<rsx.UIRectPoint>

      Returns the clipped bounds of the UI element including the margins. Relative to a parent UI panel.

      Returns Immutable<rsx.UIRectPoint>

    • get clippedVisibleBoundsInPixels(): Immutable<rsx.UIRectPixel>

      Returns the clipped bounds of the UI element including the margins. Relative to a parent UI panel.

      Returns Immutable<rsx.UIRectPixel>

    • get clippedVisibleScreenBounds(): Immutable<rsx.UIRectPoint>

      Returns the clipped bounds of the UI element including the margins. In Screenspace.

      Returns Immutable<rsx.UIRectPoint>

    • get clippedVisibleScreenBoundsInPixels(): Immutable<rsx.UIRectPixel>

      Returns the clipped bounds of the UI element including the margins. In Screenspace.

      Returns Immutable<rsx.UIRectPixel>

    • get debugName(): string

      Sets the debug name for the UI element.

      Returns string

    • set debugName(value: string): void

      Parameters

      • value: string

      Returns void

    • get disabled(): boolean

      Disables or enables the element. Disabled elements cannot be interacted with and have a faded out appearance.

      Returns boolean

    • set disabled(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get displayType(): EnumValue<UIDisplayType>

      Hides or shows this element and recursively applies the same state to all the child elements. This will not remove the element from the layout, the room for it will still be reserved but it just won't be visible.

      Returns EnumValue<UIDisplayType>

    • set displayType(value: EnumValue<UIDisplayType>): void

      Parameters

      Returns void

    • get dpiScale(): number

      Gets the scaling factor for the element's parent surface. This element must be attached to a valid surface in order to retrieve the scale factor. If the element is not attached to a surface, 1.0 is returned.

      Returns number

      The scale factor for the element's parent surface.

    • get fixedHeight(): number

      Sets the element size to be fixed using the specified value.

      Returns number

    • set fixedHeight(value: number): void

      Parameters

      • value: number

      Returns void

    • set fixedHeightInPixels(value: number): void

      Sets the element size to be fixed using the specified value in pixels.

      Parameters

      • value: number

      Returns void

    • get fixedWidth(): number

      Sets the element size to be fixed using the specified value.

      Returns number

    • set fixedWidth(value: number): void

      Parameters

      • value: number

      Returns void

    • set fixedWidthInPixels(value: number): void

      Sets the element size to be fixed using the specified value in pixels.

      Parameters

      • value: number

      Returns void

    • get flexibleHeight(): Immutable<Range>

      Sets a flexible element height in points. The element will be resized according to its contents and parent layout but will always stay within the provided range. If maximum height is zero, the element is allowed to expand as much as it needs.

      Returns Immutable<Range>

    • set flexibleHeight(value: Immutable<Range>): void

      Parameters

      Returns void

    • get flexibleWidth(): Immutable<Range>

      Sets a flexible element width in points. The element will be resized according to its contents and parent layout but will always stay within the provided range. If maximum width is zero, the element is allowed to expand as much as it needs.

      Returns Immutable<Range>

    • set flexibleWidth(value: Immutable<Range>): void

      Parameters

      Returns void

    • get isDestroyed(): boolean

      Checks if the underlying native UIElement has been destroyed.

      Returns boolean

    • get isFixedHeight(): boolean

      Determines if this element is a fixed on its height.

      Returns boolean

    • get isFixedWidth(): boolean

      Determines if this element is a fixed on its width.

      Returns boolean

    • get isFlexibleHeight(): boolean

      Determines if this element is a flexible on its height.

      Returns boolean

    • get isFlexibleWidth(): boolean

      Determines if this element is a flexible on its width.

      Returns boolean

    • get isLayoutBarrier(): boolean

      Specifies that layout passes of children elements should start from this element.

      Returns boolean

    • set isLayoutBarrier(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get isOverflowBarrier(): boolean

      Specifies that overflow content (e.g. shadows from CSS filters) are clipped at this element's bounds.

      Returns boolean

    • set isOverflowBarrier(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get isUpdating(): boolean

      Specifies that per-frame updates are enabled. If enabled, the element's onUpdate method will be called every frame.

      Returns boolean

      Per-frame updates are expensive and most UI elements should be built using a fully event-driven approach. Do not enable per-frame updates unless there is no event available that can be used to drive the required behavior.

    • set isUpdating(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get isVisible(): boolean

      Activates or deactivates this element and recursively applies the same state to all the child elements. This has the same effect as SetDisplayType(UIDisplayType::Hidden), but when disabled it will also remove the element from the layout, essentially having the same effect is if you destroyed the element.

      Returns boolean

    • set isVisible(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get minimumHeight(): number

      Sets the minimum height in points of the element when used in a layout.

      Returns number

    • set minimumHeight(value: number): void

      Parameters

      • value: number

      Returns void

    • get minimumWidth(): number

      Sets the minimum width in points of the element when used in a layout.

      Returns number

    • set minimumWidth(value: number): void

      Parameters

      • value: number

      Returns void

    • get parent(): UIElementBase

      Returns the layout this element belongs to, if any.

      Returns UIElementBase

    • get position(): Immutable<rsx.UIPoint>

      Sets element position relative to parent UI panel in points.

      Returns Immutable<rsx.UIPoint>

      Be aware that this value will be ignored if UI element is part of a layout since then the layout controls its placement.

    • set position(value: Immutable<rsx.UIPoint>): void

      Parameters

      Returns void

    • set positionInteger(value: Immutable<rsx.UIPixel>): void

      Sets element position relative to parent UI panel in pixels.

      Parameters

      Returns void

      Be aware that this value will be ignored if UI element is part of a layout since then the layout controls its placement.

    • get readOnly(): boolean

      Disables or enables the element. Disabled elements cannot be interacted with and have a faded out appearance.

      Returns boolean

    • set readOnly(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get screen(): Screen

      Returns the screen on which the element is displayed, if any.

      Returns Screen

    • get screenBounds(): Immutable<rsx.UIRectPoint>

      Returns non-clipped bounds of the UI element in screenspace.

      Returns Immutable<rsx.UIRectPoint>

      This call can be potentially expensive if the UI state is dirty.

    • get screenBoundsInPixels(): Immutable<rsx.UIRectPixel>

      Returns non-clipped bounds of the UI element in screenspace.

      Returns Immutable<rsx.UIRectPixel>

      This call can be potentially expensive if the UI state is dirty.

    • get sizeHint(): Immutable<rsx.UISizePoint>

      Gets the size hint for this element.

      Returns Immutable<rsx.UISizePoint>

      The size hint represents an approximation of the size. The actual size depends on the layouting that is done by the parent element. Layouts typically use the size hint to calculate the intial size of the element when distributing the available layout space.

    • get sizeHintInPixels(): Immutable<rsx.UISizePixel>

      Gets the size hint for this element.

      Returns Immutable<rsx.UISizePixel>

      The size hint represents an approximation of the size. The actual size depends on the layouting that is done by the parent element. Layouts typically use the size hint to calculate the intial size of the element when distributing the available layout space.

    • get styleClassName(): string

      Sets the CSS class names for this element (space-separated).

      Returns string

    • set styleClassName(value: string): void

      Parameters

      • value: string

      Returns void

    • get styleElementId(): string

      Sets the element ID for CSS selectors.

      Returns string

    • set styleElementId(value: string): void

      Parameters

      • value: string

      Returns void

    • get visibleBounds(): Immutable<rsx.UIRectPoint>

      Returns non-clipped visible bounds of the UI element (bounds exclude the margins). Relative to the parent UI panel.

      Returns Immutable<rsx.UIRectPoint>

      This call can be potentially expensive as the bounds need to be calculated based on current UI state.

    • get visibleBoundsInPixels(): Immutable<rsx.UIRectPixel>

      Returns non-clipped visible bounds of the UI element (bounds exclude the margins). Relative to the parent UI panel.

      Returns Immutable<rsx.UIRectPixel>

      This call can be potentially expensive as the bounds need to be calculated based on current UI state.

    • get window(): RenderWindow

      Get the window in which the element is positioned.

      Returns RenderWindow

    • Adds a new element to the layout after all existing elements.

      Parameters

      Returns boolean

    • Adds a new flexible space as a child of this layout. Flexible space expands to fill all available space in the layout. Space is inserted after all existing elements.

      Returns UIFlexibleSpace

      Newly created flexible space.

    • Adds a new UIGridLayout as a child of this layout. Layout is inserted after all existing elements.

      Parameters

      • tileSize: Immutable<Size2>

        The size of the grid tiles.

      • isAutoResizing: boolean

        Determines if the grid layout resizes to fit the full width.

      • ...options: UIOption[]

        Options that allow you to control how is the layout positioned and sized.

      Returns UIGridLayout

      Newly created vertical layout.

    • Adds a new UI panel as a child of this layout. Panel is inserted after all existing elements.

      Parameters

      • ...options: UIOption[]

        Options that allow you to control how is the panel positioned and sized.

      Returns UIPanel

      Newly created UI panel.

    • Adds a colored background panel to the layout.

      Parameters

      • color: Immutable<SRGBColor>

        The color.

      • Optionaldepth: number

        The panel depth, should be greater than 0 to be in the background. (Default: 10)

      • OptionalcornerRadius: number

        The optional corner radius.

      • OptionalborderColor: Immutable<SRGBColor>
      • OptionalborderWidth: number

      Returns UIPanel

    • Adds a new UI panel as a child of this layout. Panel is inserted after all existing elements.

      Parameters

      • depth: number

        Depth at which to position the panel. Panels with lower depth will be displayed in front of panels with higher depth. Provided depth is relative to the depth of the parent UI panel. The depth value will be clamped if outside of the depth range of the parent UI panel.

      • ...options: UIOption[]

        Options that allow you to control how is the panel positioned and sized.

      Returns UIPanel

      Newly created UI panel.

    • Adds a new UI panel as a child of this layout. Panel is inserted after all existing elements.

      Parameters

      • depth: number

        Depth at which to position the panel. Panels with lower depth will be displayed in front of panels with higher depth. Provided depth is relative to the depth of the parent UI panel. The depth value will be clamped if outside of the depth range of the parent UI panel.

      • depthRangeMin: number

        Smallest depth offset allowed by any child UI panels. If a child panel has a depth offset lower than this value it will be clamped.

      • depthRangeMax: number

        Largest depth offset allowed by any child UI panels. If a child panel has a depth offset higher than this value it will be clamped.

      • ...options: UIOption[]

        Options that allow you to control how is the panel positioned and sized.

      Returns UIPanel

      Newly created UI panel.

    • Adds a new fixed space object. Fixed space inserts a blank space with specific width or height (depending on layout type) in the layout. Space is inserted after all existing elements.

      Parameters

      • size: number

        Size of the space in pixels. This will represent either width or height depending whether the layout is vertical or horizontal.

      • Optionalscalable: boolean

        If this is true, this value will be scaled by the widget scaling factor.

      Returns UIFixedSpace

      Newly created fixed space.

    • Adds a CSS class to the element.

      Parameters

      • className: string

        The class name to add.

      Returns void

    • Adds a new vertical layout as a child of this layout. Layout is inserted after all existing elements.

      Parameters

      • ...options: UIOption[]

        Options that allow you to control how is the layout positioned and sized.

      Returns UIVerticalLayout

      Newly created vertical layout.

    • Creates an animation that executes an action lambda once the delay elapsed.

      Parameters

      • action: () => void

        The action to execute.

      • Optionaldelay: number

        The delay until the action is executed. Defaults to no delay.

      • Optionalrepeating: number | boolean

        Whether the animation should repeat or not. Defaults to false. Set to true, to repeat forever. Set to false, to never repeat. Set to a number, to indicate the repeat count.

      Returns EditorAnimation

      The created animation.

    • Animates a property of the UIElement. The animation is automatically started.

      Type Parameters

      • T

        The type of property to be animated.

      Parameters

      • propertyName: string

        The name of the property to be animated on the UIElement.

      • starting: T

        The starting value of the property.

      • ending: T

        The ending value of the property.

      • Optionalduration: number

        The animation duration in seconds. Defaults to 1 seconds.

      • OptionaleasingCurve: Const<EasingCurve>

        The easing curve to be used. Defaults to

      • Optionalrepeating: number | boolean

        Whether the animation should repeat or not. Defaults to false. Set to true, to repeat forever. Set to false, to never repeat. Set to a number, to indicate the repeat count.

      Returns EditorAnimation

      The created animation.

      EasingCurve.inOutQuadratic.

    • Animates a property of the UIElement using a generic lambda function. The animation is automatically started.

      Type Parameters

      • T

      Parameters

      • setter: (value: T) => void

        The lambda that is called when the value is updated. The lambda should be used to assign the value on the u

      • starting: T

        The starting value of the property.

      • ending: T

        The ending value of the property.

      • Optionalduration: number

        The animation duration in seconds. Defaults to 1 seconds.

      • OptionaleasingCurve: Const<EasingCurve>

        The easing curve to be used. Defaults to

      • Optionalrepeating: number | boolean

        Whether the animation should repeat or not. Defaults to false. Set to true, to repeat forever. Set to false, to never repeat. Set to a number, to indicate the repeat count.

      Returns EditorAnimation

      The created animation.

      EasingCurve.inOutQuadratic.

    • Creates an animation that takes delay seconds to execute.

      Parameters

      • delay: number

        The delay in seconds.

      Returns EditorAnimation

      The created animation.

      This animation is usedful when creating compound animations that are chained together by calls to then. This is helpful to create an animation that performs an action, waits and performs another action.

    • Removes all child elements and destroys them.

      Returns void

    • Virtual

      Destroys this element and all its children. Removes the element from parent layout/panel.

      Returns void

      Calling methods on a destroyed element is a no-operation. Destroyed elements aren't allowed to be assigned as children of other elements, or be parents of other elements.

    • Updates the layout of the UI element. Updates child elements positions, sizes, clip rectangles and depths so they fit into the provided bounds, while respecting their layout options.

      Returns void

      This may trigger the layout of more than this element and it's children! It can potentially update the layout of the whole UI tree.

    • Returns non-clipped bounds of the UI element. Relative to a parent UI panel.

      Parameters

      • OptionalrelativeTo: UIElementBase

        Parent panel of the provided element relative to which to return the bounds. If null the bounds relative to the first parent panel are returned. Behavior is undefined if provided panel is not a parent of the element.

      Returns Rect2

      This call can be potentially expensive if the UI state is dirty.

    • Return the child element at the specified index.

      Parameters

      • index: number

        The index of the child element.

      Returns UIElementBase

      The child element, or null if the index is out of range.

    • Checks if the element has a specific CSS class.

      Parameters

      • className: string

        The class name to check.

      Returns boolean

      True if the class is present.

    • Inserts a UI element before the element at the specified index.

      Parameters

      • index: number

        The index where to insert the element.

      • element: UIElementBase

        The new element to insert.

      Returns boolean

    • Adds a new flexible space as a child of this layout. Flexible space expands to fill all available space in the layout. is inserted before the element at the specified index.

      Parameters

      • index: number

      Returns UIFlexibleSpace

      Newly created flexible space.

    • Adds a new horizontal layout as a child of this layout. Layout is inserted before the element at the specified index.

      Parameters

      • index: number

        Index to insert the layout at. This must be in range [0, GetNumChildren()).

      • ...options: UIOption[]

        Options that allow you to control how is the layout positioned and sized.

      Returns UIHorizontalLayout

      Newly created horizontal layout.

    • Adds a new UI panel as a child of this layout. Panel is inserted before the element at the specified index.

      Parameters

      • index: number

        Index to insert the panel at. This must be in range [0, GetNumChildren()).

      • ...options: UIOption[]

        Options that allow you to control how is the panel positioned and sized.

      Returns UIPanel

      Newly created UI panel.

    • Adds a new UI panel as a child of this layout. Panel is inserted before the element at the specified index.

      Parameters

      • index: number

        Index at which to insert the panel.

      • Optionaldepth: number

        Depth at which to position the panel. Panels with lower depth will be displayed in front of panels with higher depth. Provided depth is relative to the depth of the parent UI panel. The depth value will be clamped if outside of the depth range of the parent UI panel.

      • OptionaldepthRangeMin: number

        Smallest depth offset allowed by any child UI panels. If a child panel has a depth offset lower than this value it will be clamped.

      • OptionaldepthRangeMax: number

        Largest depth offset allowed by any child UI panels. If a child panel has a depth offset higher than this value it will be clamped.

      • ...options: UIOption[]

        Options that allow you to control how is the panel positioned and sized.

      Returns UIPanel

      Newly created UI panel.

    • Adds a new fixed space object. Fixed space inserts a blank space with specific width or height (depending on layout type) in the layout. Space is inserted after all existing elements.

      Parameters

      • index: number

        Index at which to insert the space.

      • size: number

        Size of the space in pixels. This will represent either width or height depending whether the layout is vertical or horizontal.

      Returns UIFixedSpace

      Newly created fixed space.

    • Adds a new vertical layout as a child of this layout. Layout is inserted before the element at the specified index.

      Parameters

      • index: number

        Index to insert the layout at. This must be in range [0, GetNumChildren()).

      • ...options: UIOption[]

        Options that allow you to control how is the layout positioned and sized.

      Returns UIVerticalLayout

      Newly created vertical layout.

    • Determines if the specified element is a child of this. If recursive is set, the method searches through the hierarchy to see if element is a nested child.

      Parameters

      Returns boolean

    • Virtual

      Called when the element has been added to a surface or window.

      Returns void

      This event allows to immediately access the layout data and bounds of the element and it's immediate parents and children. The event is helpful to perform initialization and registration to events. Implementing classes must call super.

    • Virtual

      Called when the element has been removed from a surface or window.

      Returns void

      Layout data and bounds will no longer be available at this point. The event is helpful to perform cleanup and unregistration from events. Implementing classes must call super.

    • Virtual

      Called when the element has been registered with its parent.

      Returns void

    • Virtual

      Called when the element is about to be unregistered from its parent.

      Returns void

    • Virtual

      Called when the element is updating.

      Returns void

      This is method is only called if the element has been marked as requiring updates.

      Per-frame updates are expensive and most UI elements should be built using a fully event-driven approach. Do not enable per-frame updates unless there is no event available that can be used to drive the required behavior.

    • Removes a child element at the specified index.

      Parameters

      • idx: number

      Returns boolean

    • Removes a CSS class from the element.

      Parameters

      • className: string

        The class name to remove.

      Returns void

    • Virtual

      Resets element dimensions to their initial values dictated by the element's style.

      Returns void

    • Sets the bounds of the UI element. Relative to a parent UI panel. Equivalent to calling setPosition(), setWidth() and setHeight().

      If scalable is set to true, the size will be scaled linearly with the DPI scaling factor of the surface the elements gets attached. It false, the element will have this exact size no matter the DPI scaling factor.

      Parameters

      Returns void

    • Parameters

      • value: number

      Returns void

    • Parameters

      • value: number

      Returns void

    • Unregisters all running animations for the UIElement.

      Returns number

      The number of animations that were unregistered.

    • Toggles a CSS class on the element.

      Parameters

      • className: string

        The class name to toggle.

      Returns boolean

      True if the class is now present, false otherwise.

    • Scales a point value by using the element's DPI scale to the current pixel value.

      Parameters

      • valueInPoints: number

        The element to scale a value for. This element must be attached to a valid widget in order to retrieve the scale factor. If the element is not attached to a widget, no scaling is performed.

      Returns number

      The value in pixels.

    • Converts a pixel value to points by using the element's DPI scale.

      Parameters

      • valueInPixels: number

        The element to scale a value for. This element must be attached to a valid widget in order to retrieve the scale factor. If the element is not attached to a widget, no scaling is performed.

      Returns number

      The value in points.

    onLayoutSizeChanged: Event<
        [oldSize: Immutable<Size2>, newSize: Immutable<Size2>],
    >

    Event fired whenever the UI element size changes from a layout update.

    The old size of the UI element, in points.

    The new size of the UI element, in points.

    onRegistrationChanged: Event<[isRegistered: boolean]>

    Event fired whenever the UI element is registered with or unregistered from a parent element.

    This does not mean that the element is currently visible on screen or that it is part of a layout. Use onActiveSurfaceChanged to determine if the element is part of a layout that is currently rendered.

    True if the new state is registered in a parent element.

    onActiveSurfaceChanged: Event<[isRegistered: boolean]>

    Event fired whenever the UI element is registered with or unregistered from a surface.

    True if the new state is registered in a surface.