Class UIElementStyle

UI element style that determines the look of a UI element, as well as the element's default layout options. Different looks can be provided for different element states.

Hierarchy

  • FrameworkObject
    • UIElementStyle

Constructors

  • Parameters

    • OptionalisInternalConstructor: boolean

    Returns UIElementStyle

Accessors

  • get font(): Font
  • Font to use for all text within the UI element.

    Returns Font

  • set font(value): void
  • Parameters

    Returns void

  • get fontSize(): number
  • Font size to use for all text within the UI element.

    Returns number

  • set fontSize(value): void
  • Parameters

    • value: number

    Returns void

  • get height(): number
  • Wanted height of the UI element in pixels. Only used if IsHeightFixed is enabled.

    Returns number

  • set height(value): void
  • Parameters

    • value: number

    Returns void

  • get isDefault(): boolean
  • Determines if the style is the default style.

    Returns boolean

  • get isDrawEnabled(): boolean
  • Determines whether the UI drawing for the element is enabled or not. If false, the UIElement will not draw any of it's contents.

    Returns boolean

  • set isDrawEnabled(value): void
  • Parameters

    • value: boolean

    Returns void

  • get isHeightFixed(): boolean
  • Determines should the layout resize the element depending on available size. If true no resizing will be done.

    Returns boolean

  • set isHeightFixed(value): void
  • Parameters

    • value: boolean

    Returns void

  • get isUsingWordWrap(): boolean
  • Should the text word wrap if it doesn't fit.

    Returns boolean

  • set isUsingWordWrap(value): void
  • Parameters

    • value: boolean

    Returns void

  • get isWidthFixed(): boolean
  • Determines should the layout resize the element depending on available size. If true no resizing will be done.

    Returns boolean

  • set isWidthFixed(value): void
  • Parameters

    • value: boolean

    Returns void

  • get maximumHeight(): number
  • Maximum height allowed for the UI element. Used by the layout only when exact height is not specified.

    Returns number

  • set maximumHeight(value): void
  • Parameters

    • value: number

    Returns void

  • get maximumWidth(): number
  • Maximum width allowed for the UI element. Used by the layout only when exact width is not specified.

    Returns number

  • set maximumWidth(value): void
  • Parameters

    • value: number

    Returns void

  • get minimumHeight(): number
  • Minimum height allowed for the UI element. Used by the layout only when exact height is not specified.

    Returns number

  • set minimumHeight(value): void
  • Parameters

    • value: number

    Returns void

  • get minimumWidth(): number
  • Minimum width allowed for the UI element. Used by the layout only when exact width is not specified.

    Returns number

  • set minimumWidth(value): void
  • Parameters

    • value: number

    Returns void

  • get width(): number
  • Wanted width of the UI element in pixels. Only used if IsWidthFixed is enabled.

    Returns number

  • set width(value): void
  • Parameters

    • value: number

    Returns void

Methods

  • Registers a new sub-style that is used by complex UI elements that contain one or multiple sub-elements.

    Parameters

    • uiType: string

      Name of the sub-element this style is to be used for. This depends on UI element the style is applied to.

    • styleName: string

      Name of the style in UI skin to use for the sub-element.

    Returns void

  • Gets the optimal size for a style.

    Returns Vector2

  • Returns a named color from the style defined in the style. This can be used by complex UI elements that wish to customize the colors they are rendered in.

    Parameters

    • name: string

      The color parameter name. This depends on UI element the style is applied to.

    Returns Immutable<SRGBColor>

  • Returns a named color from the style defined in the style. This can be used by complex UI elements that wish to customize the colors they are rendered in.

    Parameters

    • name: string

      The color parameter name. This depends on UI element the style is applied to.

    • defaultColor: Immutable<SRGBColor>

      The default color to be used if the style doesn't define a color with the given name.

    Returns SRGBColor

  • Returns a named color from the style defined in the style. This can be used by complex UI elements that wish to customize the colors they are rendered in.

    Searches for a override in the given UIElementStateStyle. If no such override is found, it will look for a default color in the parent style. If no such color is defined in the style, returns the given default color.

    Parameters

    • name: string

      The color parameter name. This depends on UI element the style is applied to.

    • state: Immutable<UIElementStateStyle>

      The state style to look for a color first. If no such color is defined in the state, search will fallback to looking the style.

    Returns Immutable<SRGBColor>

  • Returns a named color from the style defined in the style. This can be used by complex UI elements that wish to customize the colors they are rendered in.

    Searches for a override in the given UIElementStateStyle. If no such override is found, it will look for a default color in the parent style. If no such color is defined in the style, returns the given default color.

    Parameters

    • name: string

      The color parameter name. This depends on UI element the style is applied to.

    • state: Immutable<UIElementStateStyle>

      The state style to look for a color first. If no such color is defined in the state, search will fallback to looking the style.

    • defaultColor: Immutable<SRGBColor>

      The default color to be used if the style doesn't define a color with the given name.

    Returns SRGBColor

  • Returns a named float parameter from the style defined in the style. This can be used by complex UI elements that wish to customize rendering parameters such as a rounder border radius.

    Parameters

    • name: string

      The float parameter name. This depends on UI element the style is applied to.

    • OptionaldefaultValue: number

      The default value to be used if the style doesn't define a parameter with the given name.

    Returns number

  • Returns a named float parameter from the style defined in the given state or style. This can be used by complex UI elements that wish to customize rendering parameters such as a rounder border radius.

    Searches for a override in the given UIElementStateStyle. If no such override is found, it will look for a default value in the parent style. If no such value is defined in the style, returns the given default value.

    Parameters

    • name: string

      The float parameter name. This depends on UI element the style is applied to.

    • state: Immutable<UIElementStateStyle>

      The state style to look for a value first. If no such value is defined in the state, search will fallback to looking the style.

    • OptionaldefaultValue: number

      The default value to be used if the style doesn't define a parameter with the given name.

    Returns number