|
UsoUIElements 0.1.0
Data Centric implimentation of Unity's UI Elements (UI Toolkit)
|
A custom label control that extends Unity's Label with USO UI framework functionality. Provides enhanced styling, field validation, data binding capabilities, and integration with the USO UI system. More...
Public Member Functions | |
| UsoLabel () | |
| Initializes a new instance of the UsoLabel class with default settings. Creates an empty label with USO framework integration and default label type styling. | |
| UsoLabel (string fieldLabelText) | |
| Initializes a new instance of the UsoLabel class with the specified text. Creates a label with custom text content and default label type styling. | |
| UsoLabel (string fieldLabelText, LabelType fieldLabelType) | |
| Initializes a new instance of the UsoLabel class with text and label type. Creates a label with custom text content and specific visual styling based on the label type. | |
| UsoLabel (string fieldLabelText, LabelType fieldLabelType, out UsoLabel newField) | |
| Initializes a new instance of the UsoLabel class with text, label type, and returns a reference. Creates a label with custom text, styling, and provides an out parameter for immediate access to the created instance. | |
| UsoLabel (string fieldName, string fieldLabelText, LabelType fieldLabelType) | |
| Initializes a new instance of the UsoLabel class with field name, text, and label type. Creates a label with custom identification, text content, and specific visual styling. | |
| UsoLabel (string fieldName, string fieldLabelText, LabelType fieldLabelType, out UsoLabel newField) | |
| Initializes a new instance of the UsoLabel class with field name, text, label type, and returns a reference. Creates a fully configured label and provides an out parameter for immediate access to the created instance. | |
| UsoLabel (string fieldName, string fieldLabelText, LabelType fieldLabelType, string bindingPath, BindingMode fieldBindingMode=BindingMode.ToTarget) | |
| Initializes a new instance of the UsoLabel class with complete configuration including data binding. Creates a label with custom identification, text, styling, and automatic data binding for dynamic content updates. | |
| UsoLabel (string fieldName, string fieldLabelText, LabelType fieldLabelType, string fieldBindingPath, BindingMode fieldBindingMode, out UsoLabel newField) | |
| Initializes a new instance of the UsoLabel class with complete configuration, data binding, and reference output. Creates a fully configured label with automatic data binding 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. | |
| void | InitElement (string fieldName=null) |
| Initializes the USO UI element with the specified field name and applies necessary styling classes. This method sets up the basic USO framework integration for the control. | |
| 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 Member Functions | |
| void | InitElement (string fieldName, LabelType fieldLabelType) |
| Private initialization method that sets up the label with USO framework integration and applies type-specific styling. This method configures the basic element properties and adds appropriate CSS classes based on the label type. | |
| void | InitElement (string fieldName, LabelType fieldLabelType, string fieldBindingPath, BindingMode fieldBindingMode) |
| Private initialization method that combines element setup with data binding configuration. This overload provides convenient setup for constructors that need both element initialization and binding. | |
Private Attributes | |
| FieldStatusTypes | _fieldStatus |
| bool | _fieldStatusEnabled = true |
Static Private Attributes | |
| const string | DefaultBindProp = "text" |
| Default binding property used when applying data bindings to this field. Binds to the 'text' property which controls the displayed text content. | |
| const string | ElementClass = "uso-label" |
| CSS class name applied to all UsoLabel instances for styling purposes. | |
| const string | ElementValidationClass = "uso-field-validation" |
| CSS class name applied when field validation/status functionality is enabled. | |
A custom label control that extends Unity's Label 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 text content, and custom styling through CSS classes. The control includes support for different label types (Header, SubHeader, Title, Subtitle, Description, Default) that automatically apply appropriate CSS classes for consistent visual hierarchy throughout the application.
| GWG.UsoUIElements.UsoLabel.UsoLabel | ( | ) |
Initializes a new instance of the UsoLabel class with default settings. Creates an empty label with USO framework integration and default label type styling.
| GWG.UsoUIElements.UsoLabel.UsoLabel | ( | string | fieldLabelText | ) |
Initializes a new instance of the UsoLabel class with the specified text. Creates a label with custom text content and default label type styling.
| fieldLabelText | The text content to display in the label. |
| GWG.UsoUIElements.UsoLabel.UsoLabel | ( | string | fieldLabelText, |
| LabelType | fieldLabelType ) |
Initializes a new instance of the UsoLabel class with text and label type. Creates a label with custom text content and specific visual styling based on the label type.
| fieldLabelText | The text content to display in the label. |
| fieldLabelType | The label type that determines visual styling and hierarchy level. |
| GWG.UsoUIElements.UsoLabel.UsoLabel | ( | string | fieldLabelText, |
| LabelType | fieldLabelType, | ||
| out UsoLabel | newField ) |
Initializes a new instance of the UsoLabel class with text, label type, and returns a reference. Creates a label with custom text, styling, and provides an out parameter for immediate access to the created instance.
| fieldLabelText | The text content to display in the label. |
| fieldLabelType | The label type that determines visual styling and hierarchy level. |
| newField | Output parameter that receives a reference to the newly created label. |
| GWG.UsoUIElements.UsoLabel.UsoLabel | ( | string | fieldName, |
| string | fieldLabelText, | ||
| LabelType | fieldLabelType ) |
Initializes a new instance of the UsoLabel class with field name, text, and label type. Creates a label with custom identification, text content, and specific visual styling.
| fieldName | The name to assign to this label element. |
| fieldLabelText | The text content to display in the label. |
| fieldLabelType | The label type that determines visual styling and hierarchy level. |
| GWG.UsoUIElements.UsoLabel.UsoLabel | ( | string | fieldName, |
| string | fieldLabelText, | ||
| LabelType | fieldLabelType, | ||
| out UsoLabel | newField ) |
Initializes a new instance of the UsoLabel class with field name, text, label type, and returns a reference. Creates a fully configured label and provides an out parameter for immediate access to the created instance.
| fieldName | The name to assign to this label element. |
| fieldLabelText | The text content to display in the label. |
| fieldLabelType | The label type that determines visual styling and hierarchy level. |
| newField | Output parameter that receives a reference to the newly created label. |
| GWG.UsoUIElements.UsoLabel.UsoLabel | ( | string | fieldName, |
| string | fieldLabelText, | ||
| LabelType | fieldLabelType, | ||
| string | bindingPath, | ||
| BindingMode | fieldBindingMode = BindingMode::ToTarget ) |
Initializes a new instance of the UsoLabel class with complete configuration including data binding. Creates a label with custom identification, text, styling, and automatic data binding for dynamic content updates.
| fieldName | The name to assign to this label element. |
| fieldLabelText | The initial text content to display in the label. |
| fieldLabelType | The label type that determines visual styling and hierarchy level. |
| bindingPath | The path to the data source property for automatic text binding. |
| fieldBindingMode | The binding mode that controls data flow between source and target. Default is ToTarget. |
| GWG.UsoUIElements.UsoLabel.UsoLabel | ( | string | fieldName, |
| string | fieldLabelText, | ||
| LabelType | fieldLabelType, | ||
| string | fieldBindingPath, | ||
| BindingMode | fieldBindingMode, | ||
| out UsoLabel | newField ) |
Initializes a new instance of the UsoLabel class with complete configuration, data binding, and reference output. Creates a fully configured label with automatic data binding and provides an out parameter for immediate access.
| fieldName | The name to assign to this label element. |
| fieldLabelText | The initial text content to display in the label. |
| fieldLabelType | The label type that determines visual styling and hierarchy level. |
| fieldBindingPath | The path to the data source property for automatic text binding. |
| fieldBindingMode | The binding mode that controls data flow between source and target. |
| newField | Output parameter that receives a reference to the newly created label. |
| void GWG.UsoUIElements.UsoLabel.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.
| fieldBindingProp | The property name on this control to bind to. |
| fieldBindingPath | The path to the data source property to bind from. |
| fieldBindingMode | The binding mode that determines how data flows between source and target. |
| Exception | Thrown when binding setup fails. Original exception is preserved and re-thrown. |
Implements GWG.UsoUIElements.IUsoUiElement.
| UsoLineItem GWG.UsoUIElements.UsoLabel.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.
|
private |
Private initialization method that sets up the label with USO framework integration and applies type-specific styling. This method configures the basic element properties and adds appropriate CSS classes based on the label type.
| fieldName | The name to assign to this label element. |
| fieldLabelType | The label type that determines which CSS class to apply for styling. |
Label type CSS class mapping:
|
private |
Private initialization method that combines element setup with data binding configuration. This overload provides convenient setup for constructors that need both element initialization and binding.
| fieldName | The name to assign to this label element. |
| fieldLabelText | The label type that determines visual styling and hierarchy level. |
| fieldBindingPath | The path to the data source property for automatic text binding. |
| fieldBindingMode | The binding mode that controls data flow between source and target. |
| void GWG.UsoUIElements.UsoLabel.InitElement | ( | string | fieldName = null | ) |
Initializes the USO UI element with the specified field name and applies necessary styling classes. This method sets up the basic USO framework integration for the control.
| fieldName | Optional name to assign to the element. If null, no name is set. |
Implements GWG.UsoUIElements.IUsoUiElement.
| void GWG.UsoUIElements.UsoLabel.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.
| fieldStatus | The new field status type to apply. |
Implements GWG.UsoUIElements.IUsoUiElement.
| void GWG.UsoUIElements.UsoLabel.ShowFieldStatus | ( | bool | status | ) |
Controls the visibility and functionality of the field status/validation system. When disabled, removes validation-related styling from the control.
| status | True to enable field status functionality; false to disable it. |
Implements GWG.UsoUIElements.IUsoUiElement.
|
private |
|
private |
|
staticprivate |
Default binding property used when applying data bindings to this field. Binds to the 'text' property which controls the displayed text content.
|
staticprivate |
CSS class name applied to all UsoLabel instances for styling purposes.
|
staticprivate |
CSS class name applied when field validation/status functionality is enabled.
|
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.
|
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.