UsoUIElements 0.1.0
Data Centric implimentation of Unity's UI Elements (UI Toolkit)
Loading...
Searching...
No Matches
GWG.UsoUIElements.UsoSliderInt Class Reference

A custom integer slider control that extends Unity's SliderInt with USO UI framework functionality. Provides enhanced styling, field validation, data binding capabilities, and integration with the USO UI system. More...

Inheritance diagram for GWG.UsoUIElements.UsoSliderInt:

Public Member Functions

 UsoSliderInt ()
 Initializes a new instance of the UsoSliderInt class with default settings. Creates an integer slider with USO framework integration and default range configuration (0 to 100).
 UsoSliderInt (string fieldName)
 Initializes a new instance of the UsoSliderInt class with the specified field name. Creates an integer slider with custom identification for binding and reference purposes.
 UsoSliderInt (string fieldName, string fieldLabelText)
 Initializes a new instance of the UsoSliderInt class with field name and label text. Creates an integer slider with custom identification and display label for user interface clarity.
 UsoSliderInt (string fieldName, string fieldLabelText, out UsoSliderInt newField)
 Initializes a new instance of the UsoSliderInt class with field name, label text, and returns a reference. Creates an integer slider with custom identification, display label, and provides an out parameter for immediate access.
 UsoSliderInt (string fieldName, string fieldLabelText, string fieldBindingPath, BindingMode fieldBindingMode)
 Initializes a new instance of the UsoSliderInt class with field name, label text, and data binding configuration. Creates a fully configured integer slider with custom identification, display label, and automatic data binding for value synchronization.
 UsoSliderInt (string fieldName, string fieldLabelText, string fieldBindingPath, BindingMode fieldBindingMode, out UsoSliderInt newField)
 Initializes a new instance of the UsoSliderInt class with complete configuration and returns a reference. Creates a fully configured integer slider with custom identification, display label, automatic data binding, and immediate access to the created instance.
void ApplyBinding (string fieldBindingProp, string fieldBindingPath, BindingMode fieldBindingMode)
 Applies data binding to the specified property of this control using Unity's data binding system. Configures the binding with the provided path and mode for automatic data synchronization.
UsoLineItem GetParentLineItem ()
 Retrieves the first ancestor UsoLineItem control in the visual tree hierarchy. This is useful for accessing parent container functionality and maintaining proper UI structure.
void InitElement (string fieldName)
 Initializes the USO UI element with the specified field name and applies default integer slider configuration. This method sets up the basic USO framework integration and configures the slider's default range and styling.
void SetFieldStatus (FieldStatusTypes fieldStatus)
 Updates the field's status type, which affects its visual appearance and validation state. The status change is automatically reflected in the UI through the FieldStatus property.
void ShowFieldStatus (bool status)
 Controls the visibility and functionality of the field status/validation system. When disabled, removes validation-related styling from the control.
Public Member Functions inherited from GWG.UsoUIElements.IUsoUiElement
void AddToClassList (string className)
 Adds the specified CSS class name to this element's class list. This method is inherited from Unity's VisualElement and enables dynamic styling modifications.
void ClearBindings ()
 Removes all data binding configurations from this element. This method is inherited from Unity's VisualElement and provides cleanup functionality for data bindings.
void RemoveFromClassList (string className)
 Removes the specified CSS class name from this element's class list. This method is inherited from Unity's VisualElement and provides dynamic styling capabilities.

Properties

FieldStatusTypes FieldStatus [get, private set]
 Gets the current field status type, which determines the visual state and validation feedback. This property is automatically reflected in the UI through CSS class modifications.
bool FieldStatusEnabled [get, private set]
 Gets or sets whether field status/validation functionality is enabled for this control. When enabled, adds validation CSS class for styling. When disabled, removes validation styling.

Private Attributes

FieldStatusTypes _fieldStatus
bool _fieldStatusEnabled = true

Static Private Attributes

const string DefaultBindProp = "value"
 Default binding property used when applying data bindings to this field. Binds to the 'value' property which controls the current slider position/value.
const string ElementClass = "uso-slider"
 CSS class name applied to all UsoSliderInt instances for styling purposes. Uses the same class as UsoSlider to maintain consistent styling between float and integer sliders.
const string ElementValidationClass = "uso-field-validation"
 CSS class name applied when field validation/status functionality is enabled.

Detailed Description

A custom integer slider control that extends Unity's SliderInt with USO UI framework functionality. Provides enhanced styling, field validation, data binding capabilities, and integration with the USO UI system.

This control implements the IUsoUiElement interface to provide consistent behavior across the USO UI framework. It supports field status indicators, automatic data binding for integer values, and custom styling through CSS classes. The control is pre-configured with a default range of 0 to 100, but can be customized through the standard Unity SliderInt properties. The control supports various constructor overloads for different initialization scenarios including labeling and data binding configuration. Note that this control shares the same CSS class as UsoSlider ("uso-slider") for consistent styling between float and integer sliders.

Constructor & Destructor Documentation

◆ UsoSliderInt() [1/6]

GWG.UsoUIElements.UsoSliderInt.UsoSliderInt ( )

Initializes a new instance of the UsoSliderInt class with default settings. Creates an integer slider with USO framework integration and default range configuration (0 to 100).

◆ UsoSliderInt() [2/6]

GWG.UsoUIElements.UsoSliderInt.UsoSliderInt ( string fieldName)

Initializes a new instance of the UsoSliderInt class with the specified field name. Creates an integer slider with custom identification for binding and reference purposes.

Parameters
fieldNameThe name to assign to this slider element.

◆ UsoSliderInt() [3/6]

GWG.UsoUIElements.UsoSliderInt.UsoSliderInt ( string fieldName,
string fieldLabelText )

Initializes a new instance of the UsoSliderInt class with field name and label text. Creates an integer slider with custom identification and display label for user interface clarity.

Parameters
fieldNameThe name to assign to this slider element.
fieldLabelTextThe label text to display alongside the slider control.

◆ UsoSliderInt() [4/6]

GWG.UsoUIElements.UsoSliderInt.UsoSliderInt ( string fieldName,
string fieldLabelText,
out UsoSliderInt newField )

Initializes a new instance of the UsoSliderInt class with field name, label text, and returns a reference. Creates an integer slider with custom identification, display label, and provides an out parameter for immediate access.

Parameters
fieldNameThe name to assign to this slider element.
fieldLabelTextThe label text to display alongside the slider control.
newFieldOutput parameter that receives a reference to the newly created slider.

◆ UsoSliderInt() [5/6]

GWG.UsoUIElements.UsoSliderInt.UsoSliderInt ( string fieldName,
string fieldLabelText,
string fieldBindingPath,
BindingMode fieldBindingMode )

Initializes a new instance of the UsoSliderInt class with field name, label text, and data binding configuration. Creates a fully configured integer slider with custom identification, display label, and automatic data binding for value synchronization.

Parameters
fieldNameThe name to assign to this slider element.
fieldLabelTextThe label text to display alongside the slider control.
fieldBindingPathThe path to the data source property for automatic value binding.
fieldBindingModeThe binding mode that controls data flow between source and target.

◆ UsoSliderInt() [6/6]

GWG.UsoUIElements.UsoSliderInt.UsoSliderInt ( string fieldName,
string fieldLabelText,
string fieldBindingPath,
BindingMode fieldBindingMode,
out UsoSliderInt newField )

Initializes a new instance of the UsoSliderInt class with complete configuration and returns a reference. Creates a fully configured integer slider with custom identification, display label, automatic data binding, and immediate access to the created instance.

Parameters
fieldNameThe name to assign to this slider element.
fieldLabelTextThe label text to display alongside the slider control.
fieldBindingPathThe path to the data source property for automatic value binding.
fieldBindingModeThe binding mode that controls data flow between source and target.
newFieldOutput parameter that receives a reference to the newly created slider.

Member Function Documentation

◆ ApplyBinding()

void GWG.UsoUIElements.UsoSliderInt.ApplyBinding ( string fieldBindingProp,
string fieldBindingPath,
BindingMode fieldBindingMode )

Applies data binding to the specified property of this control using Unity's data binding system. Configures the binding with the provided path and mode for automatic data synchronization.

Parameters
fieldBindingPropThe property name on this control to bind to.
fieldBindingPathThe path to the data source property to bind from.
fieldBindingModeThe binding mode that determines how data flows between source and target.
Exceptions
ExceptionThrown when binding setup fails. Original exception is preserved and re-thrown.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ GetParentLineItem()

UsoLineItem GWG.UsoUIElements.UsoSliderInt.GetParentLineItem ( )

Retrieves the first ancestor UsoLineItem control in the visual tree hierarchy. This is useful for accessing parent container functionality and maintaining proper UI structure.

Returns
The parent UsoLineItem if found; otherwise, null.

◆ InitElement()

void GWG.UsoUIElements.UsoSliderInt.InitElement ( string fieldName)

Initializes the USO UI element with the specified field name and applies default integer slider configuration. This method sets up the basic USO framework integration and configures the slider's default range and styling.

Parameters
fieldNameThe name to assign to the element. Can be null for unnamed elements.

Default configuration includes:

  • Range from 0 to 100 (lowValue = 0, highValue = 100)
  • USO CSS class for consistent styling with other slider controls
  • Field status functionality enabled The integer range (0-100) is more suitable for typical integer input scenarios compared to the float slider's 0-1 range.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ SetFieldStatus()

void GWG.UsoUIElements.UsoSliderInt.SetFieldStatus ( FieldStatusTypes fieldStatus)

Updates the field's status type, which affects its visual appearance and validation state. The status change is automatically reflected in the UI through the FieldStatus property.

Parameters
fieldStatusThe new field status type to apply.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ ShowFieldStatus()

void GWG.UsoUIElements.UsoSliderInt.ShowFieldStatus ( bool status)

Controls the visibility and functionality of the field status/validation system. When disabled, removes validation-related styling from the control.

Parameters
statusTrue to enable field status functionality; false to disable it.

Implements GWG.UsoUIElements.IUsoUiElement.

Member Data Documentation

◆ _fieldStatus

FieldStatusTypes GWG.UsoUIElements.UsoSliderInt._fieldStatus
private

◆ _fieldStatusEnabled

bool GWG.UsoUIElements.UsoSliderInt._fieldStatusEnabled = true
private

◆ DefaultBindProp

const string GWG.UsoUIElements.UsoSliderInt.DefaultBindProp = "value"
staticprivate

Default binding property used when applying data bindings to this field. Binds to the 'value' property which controls the current slider position/value.

◆ ElementClass

const string GWG.UsoUIElements.UsoSliderInt.ElementClass = "uso-slider"
staticprivate

CSS class name applied to all UsoSliderInt instances for styling purposes. Uses the same class as UsoSlider to maintain consistent styling between float and integer sliders.

◆ ElementValidationClass

const string GWG.UsoUIElements.UsoSliderInt.ElementValidationClass = "uso-field-validation"
staticprivate

CSS class name applied when field validation/status functionality is enabled.

Property Documentation

◆ FieldStatus

FieldStatusTypes GWG.UsoUIElements.UsoSliderInt.FieldStatus
getprivate set

Gets the current field status type, which determines the visual state and validation feedback. This property is automatically reflected in the UI through CSS class modifications.

The current FieldStatusTypes value indicating the field's validation state.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ FieldStatusEnabled

bool GWG.UsoUIElements.UsoSliderInt.FieldStatusEnabled
getprivate set

Gets or sets whether field status/validation functionality is enabled for this control. When enabled, adds validation CSS class for styling. When disabled, removes validation styling.

True if field status functionality is enabled; otherwise, false. Default is true.

Implements GWG.UsoUIElements.IUsoUiElement.