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

A custom row layout container element that extends Unity's VisualElement with USO UI framework functionality and horizontal layout configuration. Provides enhanced styling, field validation, data binding capabilities, and integration with the USO UI system for structured horizontal content organization. More...

Inheritance diagram for GWG.UsoUIElements.UsoRowElement:

Public Member Functions

 UsoRowElement ()
 Initializes a new instance of the UsoRowElement class with default settings. Creates a horizontal layout container with USO framework integration and automatic row configuration.
 UsoRowElement (string fieldName)
 Initializes a new instance of the UsoRowElement class with the specified field name. Creates a horizontal layout container with custom identification and full-width styling configuration.
 UsoRowElement (string fieldName, out UsoRowElement newField)
 Initializes a new instance of the UsoRowElement class with field name and returns a reference. Creates a horizontal layout container with custom identification and provides an out parameter for immediate access.
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.
new void InitElement (string fieldName="")
 Initializes the USO UI element with the specified field name and applies horizontal layout configuration. This method sets up the basic USO framework integration and configures the element for row-based layout behavior.
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 = false

Static Private Attributes

const string DefaultBindProp = ""
 Default binding property used when applying data bindings to this field. Currently set to empty string as row elements typically manage child element layout rather than direct values.
const string ElementClass = "uso-row-element"
 CSS class name applied to all UsoRowElement instances for styling purposes.
const string ElementValidationClass = "uso-field-validation"
 CSS class name applied when field validation/status functionality is enabled.

Detailed Description

A custom row layout container element that extends Unity's VisualElement with USO UI framework functionality and horizontal layout configuration. Provides enhanced styling, field validation, data binding capabilities, and integration with the USO UI system for structured horizontal content organization.

This control implements the IUsoUiElement interface to provide consistent behavior across the USO UI framework. It supports field status indicators, automatic data binding capabilities, and custom styling through CSS classes. The control is specifically designed as a horizontal layout container with automatic flex direction configuration set to row layout. It features automatic full-width styling (100% width) to provide consistent horizontal layout behavior across the application. Row elements are commonly used for creating horizontal form layouts, toolbar arrangements, and side-by-side content presentations that require consistent spacing, alignment, and validation management throughout the USO framework. The control has field status functionality disabled by default, focusing on its role as a structural layout container.

Constructor & Destructor Documentation

◆ UsoRowElement() [1/3]

GWG.UsoUIElements.UsoRowElement.UsoRowElement ( )

Initializes a new instance of the UsoRowElement class with default settings. Creates a horizontal layout container with USO framework integration and automatic row configuration.

◆ UsoRowElement() [2/3]

GWG.UsoUIElements.UsoRowElement.UsoRowElement ( string fieldName)

Initializes a new instance of the UsoRowElement class with the specified field name. Creates a horizontal layout container with custom identification and full-width styling configuration.

Parameters
fieldNameThe name to assign to this row element.

This constructor specifically sets the width to 100% in addition to the standard initialization, ensuring consistent full-width behavior for named row elements.

◆ UsoRowElement() [3/3]

GWG.UsoUIElements.UsoRowElement.UsoRowElement ( string fieldName,
out UsoRowElement newField )

Initializes a new instance of the UsoRowElement class with field name and returns a reference. Creates a horizontal layout container with custom identification and provides an out parameter for immediate access.

Parameters
fieldNameThe name to assign to this row element.
newFieldOutput parameter that receives a reference to the newly created row element.

Member Function Documentation

◆ ApplyBinding()

void GWG.UsoUIElements.UsoRowElement.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.

While row elements primarily handle layout, this method enables binding to container-level properties such as visibility, styling characteristics, or other layout-related attributes.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ GetParentLineItem()

UsoLineItem GWG.UsoUIElements.UsoRowElement.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()

new void GWG.UsoUIElements.UsoRowElement.InitElement ( string fieldName = "")

Initializes the USO UI element with the specified field name and applies horizontal layout configuration. This method sets up the basic USO framework integration and configures the element for row-based layout behavior.

Parameters
fieldNameThe name to assign to the element. Default is empty string if not specified.

The initialization process includes setting the flex direction to row for horizontal layout, configuring full-width styling (100% width), applying appropriate CSS classes, and enabling field status functionality according to the default settings. The 'new' keyword is used to hide any inherited InitElement method and provide row-specific initialization behavior.

Implements GWG.UsoUIElements.IUsoUiElement.

◆ SetFieldStatus()

void GWG.UsoUIElements.UsoRowElement.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.UsoRowElement.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.UsoRowElement._fieldStatus
private

◆ _fieldStatusEnabled

bool GWG.UsoUIElements.UsoRowElement._fieldStatusEnabled = false
private

◆ DefaultBindProp

const string GWG.UsoUIElements.UsoRowElement.DefaultBindProp = ""
staticprivate

Default binding property used when applying data bindings to this field. Currently set to empty string as row elements typically manage child element layout rather than direct values.

◆ ElementClass

const string GWG.UsoUIElements.UsoRowElement.ElementClass = "uso-row-element"
staticprivate

CSS class name applied to all UsoRowElement instances for styling purposes.

◆ ElementValidationClass

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

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

Property Documentation

◆ FieldStatus

FieldStatusTypes GWG.UsoUIElements.UsoRowElement.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.UsoRowElement.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 false for row elements.

Row elements have field status functionality disabled by default since they primarily serve as layout containers rather than interactive or validatable content elements.

Implements GWG.UsoUIElements.IUsoUiElement.