Table of Contents

Class UiStyle

Namespace
MLEM.Ui.Style
Assembly
MLEM.Ui.dll

The style settings for a UiSystem. Each Element uses these style settings by default, however you can also change these settings per element using the elements' individual style settings. Additional styles for built-in or custom element types can easily be added using AddCustomStyle<T>(Action<T>, bool).

public class UiStyle : GenericDataHolder, IGenericDataHolder
Inheritance
UiStyle
Implements
Derived
Inherited Members

Constructors

UiStyle()

Creates a new set of style settings with the default values.

public UiStyle()

UiStyle(UiStyle)

Creates a new set of style settings with values inherited from the given original style settings.

public UiStyle(UiStyle original)

Parameters

original UiStyle

The original style settings, to copy into the new instance.

Fields

ActionSound

The SoundEffectInfo that should be played when an element's OnPressed and OnSecondaryPressed events are called. Note that this sound is only played if the callbacks have any subscribers.

public SoundEffectInfo ActionSound

Field Value

SoundEffectInfo

AdditionalFonts

A set of additional fonts that can be used for the <f FontName> formatting code

public Dictionary<string, GenericFont> AdditionalFonts

Field Value

Dictionary<string, GenericFont>

ButtonDisabledColor

The color that the Button element uses when it IsDisabled

public Color ButtonDisabledColor

Field Value

Color

ButtonDisabledTexture

The texture that the Button element uses when it IsDisabled

public NinePatch ButtonDisabledTexture

Field Value

NinePatch

ButtonHoveredColor

The color that the Button element renders with when it is moused over (IsMouseOver)

public Color ButtonHoveredColor

Field Value

Color

ButtonHoveredTexture

The texture that the Button element uses when it is moused over (IsMouseOver) Note that, if you just want to change the button's color when hovered, use ButtonHoveredColor.

public NinePatch ButtonHoveredTexture

Field Value

NinePatch

ButtonTexture

The texture that the Button element uses

public NinePatch ButtonTexture

Field Value

NinePatch

CheckboxCheckmark

The texture that the Checkbox element renders on top of its regular texture when it is Checked

public TextureRegion CheckboxCheckmark

Field Value

TextureRegion

CheckboxDisabledColor

The color that the Checkbox element uses when it IsDisabled.

public Color CheckboxDisabledColor

Field Value

Color

CheckboxDisabledTexture

The texture that the Checkbox element uses when it IsDisabled.

public NinePatch CheckboxDisabledTexture

Field Value

NinePatch

CheckboxHoveredColor

The color that the Checkbox element renders with when it is moused over (IsMouseOver)

public Color CheckboxHoveredColor

Field Value

Color

CheckboxHoveredTexture

The texture that the Checkbox element uses when it is moused over (IsMouseOver)

public NinePatch CheckboxHoveredTexture

Field Value

NinePatch

CheckboxTextOffsetX

The width of the space between a Checkbox and its Label

public float CheckboxTextOffsetX

Field Value

float

CheckboxTexture

The texture that the Checkbox element uses

public NinePatch CheckboxTexture

Field Value

NinePatch

Font

The font that Paragraph and other elements should use for rendering. Note that, to specify a bold and italic font for TextFormatter, you should use Bold and Italic.

public GenericFont Font

Field Value

GenericFont

LinkColor

The color that a Paragraph's Paragraph.Link codes should have. This value is passed to LinkCode.

public Color? LinkColor

Field Value

Color?

MouseEnterAnimation

A UiAnimation that is played when the mouse enters an element.

public UiAnimation MouseEnterAnimation

Field Value

UiAnimation

MouseExitAnimation

A UiAnimation that is played when the mouse exists an element.

public UiAnimation MouseExitAnimation

Field Value

UiAnimation

PanelChildPadding

The ChildPadding to apply to a Panel by default

public Padding PanelChildPadding

Field Value

Padding

PanelColor

The color that the Panel element draws with.

public Color PanelColor

Field Value

Color

PanelScrollBarOffset

The amount of pixels of room there should be between a Panel's scroll bar and the rest of its content

public float PanelScrollBarOffset

Field Value

float

PanelScrollerSize

The size of the scroller of a Panel's scroll bar

public Vector2 PanelScrollerSize

Field Value

Vector2

PanelStepPerScroll

The amount that a Panel's scrollable area is moved per single movement of the scroll wheel

public float PanelStepPerScroll

Field Value

float

PanelTexture

The texture that the Panel element uses

public NinePatch PanelTexture

Field Value

NinePatch

ProgressBarColor

The color that the ProgressBar element renders with

public Color ProgressBarColor

Field Value

Color

ProgressBarProgressColor

The color that the ProgressBar renders its progress texture with

public Color ProgressBarProgressColor

Field Value

Color

ProgressBarProgressPadding

The padding that the ProgressBar uses for its progress texture (ProgressBarProgressTexture)

public Vector2 ProgressBarProgressPadding

Field Value

Vector2

ProgressBarProgressTexture

The texture that the ProgressBar uses for displaying its progress

public NinePatch ProgressBarProgressTexture

Field Value

NinePatch

ProgressBarTexture

The texture that the ProgressBar element uses for its background

public NinePatch ProgressBarTexture

Field Value

NinePatch

RadioCheckmark

The texture that the RadioButton renders on top of its regular texture when it is Checked

public TextureRegion RadioCheckmark

Field Value

TextureRegion

RadioHoveredColor

The color that the RadioButton element renders with when it is moused over (IsMouseOver)

public Color RadioHoveredColor

Field Value

Color

RadioHoveredTexture

The texture that the RadioButton element uses when it is moused over (IsMouseOver)

public NinePatch RadioHoveredTexture

Field Value

NinePatch

RadioTexture

The texture that the RadioButton element uses

public NinePatch RadioTexture

Field Value

NinePatch

ScrollBarBackground

The background texture that the ScrollBar element uses

public NinePatch ScrollBarBackground

Field Value

NinePatch

ScrollBarScrollerTexture

The texture that the scroll indicator of the ScrollBar element uses

public NinePatch ScrollBarScrollerTexture

Field Value

NinePatch

ScrollBarSmoothScrollFactor

The factor with which a ScrollBar's smooth scrolling happens

public float ScrollBarSmoothScrollFactor

Field Value

float

ScrollBarSmoothScrolling

Whether or not a ScrollBar should use smooth scrolling

public bool ScrollBarSmoothScrolling

Field Value

bool

SelectionIndicator

The texture that is rendered on top of the SelectedElement

public NinePatch SelectionIndicator

Field Value

NinePatch

TextAlignment

The TextAlignment that a Paragraph should use by default.

public TextAlignment TextAlignment

Field Value

TextAlignment

TextColor

The color that the text of a Paragraph should have

public Color TextColor

Field Value

Color

TextFieldCaretWidth

The width that a TextField's caret should render with

public float TextFieldCaretWidth

Field Value

float

TextFieldHoveredColor

The color that the TextField renders with when it is moused over (IsMouseOver)

public Color TextFieldHoveredColor

Field Value

Color

TextFieldHoveredTexture

The texture that the TextField element uses when it is moused over (IsMouseOver)

public NinePatch TextFieldHoveredTexture

Field Value

NinePatch

TextFieldTextOffsetX

The x position that a TextField's text should start rendering at, based on the x position of the text field

public float TextFieldTextOffsetX

Field Value

float

TextFieldTexture

The texture that the TextField element uses

public NinePatch TextFieldTexture

Field Value

NinePatch

TextScale

The scale that text should be rendered with in Paragraph and other elements

public float TextScale

Field Value

float

TooltipAutoNavAnchor

The auto-nav anchor that is used or tooltips by default.

public Anchor TooltipAutoNavAnchor

Field Value

Anchor

TooltipAutoNavOffset

The offset of the Tooltip element's top center coordinate from the bottom center of the element snapped to when DisplayInAutoNavMode is true.

public Vector2 TooltipAutoNavOffset

Field Value

Vector2

TooltipBackground

The texture that the Tooltip uses for its background

public NinePatch TooltipBackground

Field Value

NinePatch

TooltipChildPadding

The ChildPadding to apply to a Tooltip by default

public Padding TooltipChildPadding

Field Value

Padding

TooltipDelay

The amount of time that the mouse has to be over an element with a Tooltip for the tooltip to appear

public TimeSpan TooltipDelay

Field Value

TimeSpan

TooltipMouseAnchor

The mouse anchor that is used for tooltips by default.

public Anchor TooltipMouseAnchor

Field Value

Anchor

TooltipOffset

The offset of the Tooltip element's top left corner from the mouse position

public Vector2 TooltipOffset

Field Value

Vector2

TooltipTextColor

The color that the text of a Tooltip should have

public Color TooltipTextColor

Field Value

Color

TooltipTextWidth

The width of a Tooltip's default text Paragraph

public float TooltipTextWidth

Field Value

float

TooltipUseAutoNavBehaviorForMouse

Whether tooltips should use auto-nav rendering behavior for tooltips even when using a mouse by default.

public bool TooltipUseAutoNavBehaviorForMouse

Field Value

bool

Methods

AddCustomStyle<T>(Action<T>, bool)

Adds an action to the given Element type T that allows applying any kind of custom styling or behavior to it. Custom styles added in this manner can be applied to an element using ApplyCustomStyle(Element).

public void AddCustomStyle<T>(Action<T> style, bool add = false) where T : Element

Parameters

style Action<T>

The style action to add.

add bool

Whether the style function should be added to the existing style settings rather than replacing them.

Type Parameters

T

The Element type that the style should apply to.

ApplyCustomStyle(Element)

Applies a set of custom styling actions to the given element which were added through AddCustomStyle<T>(Action<T>, bool). This method is automatically invoked in InitStyle(UiStyle).

public bool ApplyCustomStyle(Element element)

Parameters

element Element

The element to apply custom styling to.

Returns

bool

Whether any custom styling exists for the given element.